internal: fix bat charge state

Counts fully charged and pending charge as charging, same as prior to
90c051cf
This commit is contained in:
2 * r + 2 * t 2025-10-08 13:16:25 +11:00
parent 8326407e24
commit dbb3d7c67b
2 changed files with 2 additions and 2 deletions

View file

@ -235,7 +235,7 @@ StyledRect {
}
const perc = UPower.displayDevice.percentage;
const charging = UPower.displayDevice.state === UPowerDeviceState.Charging;
const charging = [UPowerDeviceState.Charging, UPowerDeviceState.FullyCharged, UPowerDeviceState.PendingCharge].includes(UPower.displayDevice.state);
if (perc === 1)
return charging ? "battery_charging_full" : "battery_full";
let level = Math.floor(perc * 7);

View file

@ -114,7 +114,7 @@ ColumnLayout {
active: UPower.displayDevice.isLaptopBattery
sourceComponent: FetchText {
text: `BATT: ${UPower.displayDevice.state === UPowerDeviceState.Charging ? "(+) " : ""}${Math.round(UPower.displayDevice.percentage * 100)}%`
text: `BATT: ${[UPowerDeviceState.Charging, UPowerDeviceState.FullyCharged, UPowerDeviceState.PendingCharge].includes(UPower.displayDevice.state) ? "(+) " : ""}${Math.round(UPower.displayDevice.percentage * 100)}%`
}
}
}