diff options
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/BatteryWidget.qml')
| -rw-r--r-- | accounts/gkleen@sif/shell/quickshell/BatteryWidget.qml | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/BatteryWidget.qml b/accounts/gkleen@sif/shell/quickshell/BatteryWidget.qml index da17df2a..f465fa20 100644 --- a/accounts/gkleen@sif/shell/quickshell/BatteryWidget.qml +++ b/accounts/gkleen@sif/shell/quickshell/BatteryWidget.qml | |||
| @@ -102,9 +102,12 @@ Item { | |||
| 102 | color: "white" | 102 | color: "white" |
| 103 | 103 | ||
| 104 | text: { | 104 | text: { |
| 105 | if (!root.batteryDevice?.ready) | ||
| 106 | return "Not ready"; | ||
| 107 | |||
| 105 | const stateStr = UPowerDeviceState.toString(root.batteryDevice.state); | 108 | const stateStr = UPowerDeviceState.toString(root.batteryDevice.state); |
| 106 | var outStr = stateStr; | 109 | var outStr = stateStr; |
| 107 | if (root.batteryDevice.state != UPowerDeviceState.FullyCharged) | 110 | if (root.batteryDevice.state !== UPowerDeviceState.FullyCharged) |
| 108 | outStr += ` ${Math.round(root.batteryDevice.percentage * 100)}%`; | 111 | outStr += ` ${Math.round(root.batteryDevice.percentage * 100)}%`; |
| 109 | 112 | ||
| 110 | function formatTime(t) { | 113 | function formatTime(t) { |
