diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-02-01 06:53:06 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-02-01 06:53:36 +0100 |
commit | e5a9885da21c0bd7300987a0cc39c981ec5f257d (patch) | |
tree | 3cbb415de3c53ade1103accd120ba504e21d3d97 | |
parent | 4808f43077c9b4bf161e37c6fffc1e9dfbbccf98 (diff) |
battery_wgt: handle capacity being unknown
Use a special color for the arc to indicate this state.
-rw-r--r-- | battery_wgt.lua | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/battery_wgt.lua b/battery_wgt.lua index ddf4120..c4a0fea 100644 --- a/battery_wgt.lua +++ b/battery_wgt.lua @@ -44,9 +44,10 @@ local COLORS = { MAIN_BG = '#ffffff11', - CHARGING = "#43a047", - CHARGE_MEDIUM = "#c0ca33", - CHARGE_LOW = "#e53935", + CHARGING = "#43a047", + CHARGE_MEDIUM = "#c0ca33", + CHARGE_LOW = "#e53935", + CHARGE_UNKNOWN = "#990099", NOTIFY_LOW_FG = "#EEE9EF", NOTIFY_LOW_BG = "#F06060", @@ -116,6 +117,10 @@ function BatteryWidget:_update() else self._arc.colors = { COLORS.MAIN_FG } end + else + -- capacity level unavailable + self._arc.colors = { COLORS.CHARGE_UNKNOWN } + self._arc.value = self._bat.status == self._bat.STATUS.CHARGING and 50 or 100 end -- build tooltip text |