internal: fix bat charge state
Counts fully charged and pending charge as charging, same as prior to
90c051cf
This commit is contained in:
parent
8326407e24
commit
dbb3d7c67b
2 changed files with 2 additions and 2 deletions
|
|
@ -235,7 +235,7 @@ StyledRect {
|
||||||
}
|
}
|
||||||
|
|
||||||
const perc = UPower.displayDevice.percentage;
|
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)
|
if (perc === 1)
|
||||||
return charging ? "battery_charging_full" : "battery_full";
|
return charging ? "battery_charging_full" : "battery_full";
|
||||||
let level = Math.floor(perc * 7);
|
let level = Math.floor(perc * 7);
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ ColumnLayout {
|
||||||
active: UPower.displayDevice.isLaptopBattery
|
active: UPower.displayDevice.isLaptopBattery
|
||||||
|
|
||||||
sourceComponent: FetchText {
|
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)}%`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue