More tweaks

This commit is contained in:
David Heinemeier Hansson
2026-05-18 22:10:26 +02:00
parent 74f71236e0
commit 9daa0e6ed3
3 changed files with 50 additions and 7 deletions
+12 -1
View File
@@ -33,7 +33,18 @@ Item {
return defaultIcons[index]
}
function modeLabel() { return UPower.onBattery ? "Battery" : "Charging" }
function modeLabel() {
var device = UPower.displayDevice
var percentage = device && device.isPresent ? device.percentage : 0
if (!UPower.onBattery && percentage >= 1) {
return "Fully charged"
} else if (UPower.onBattery) {
return "Battery"
} else {
return "Charging"
}
}
function refresh() {
if (!batteryProc.running) batteryProc.running = true