mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-11 17:38:38 +00:00
If level a battery less 10% it will be red.
This commit is contained in:
parent
5ab19ee27b
commit
e65c57dbaa
@ -130,6 +130,19 @@ class BatteryInfo: NSObject {
|
|||||||
|
|
||||||
title += String(current) + "%" + timeRemaining
|
title += String(current) + "%" + timeRemaining
|
||||||
button?.title = title
|
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)
|
||||||
|
])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user