1
0
mirror of https://github.com/Toxblh/MTMR.git synced 2026-01-10 17:08:39 +00:00

If level a battery less 10% it will be red.

This commit is contained in:
Toxblh 2018-04-24 22:53:56 +01:00
parent 5ab19ee27b
commit e65c57dbaa

View File

@ -130,6 +130,19 @@ class BatteryInfo: NSObject {
title += String(current) + "%" + timeRemaining
button?.title = title
if current < 10 && ACPower != "AC Power" {
let pstyle = NSMutableParagraphStyle()
pstyle.alignment = .center
button?.attributedTitle = NSMutableAttributedString(
string: title,
attributes: [
NSAttributedStringKey.foregroundColor: NSColor.red,
NSAttributedStringKey.paragraphStyle: pstyle,
NSAttributedStringKey.font: NSFont.systemFont(ofSize: 16)
])
}
}
}