Skip to content

Commit ad32726

Browse files
committed
Change bat widget discharging state char from U+2212 to U+002D
This avoids using a unicode character that looks just like a hyphen but isn't, leading to subtle bugs when developers write code that interacts with the bat_linux widget.
1 parent 5b9b496 commit ad32726

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

widgets/bat_linux.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ local function worker(format, warg)
3131
["Unknown\n"] = "",
3232
["Charged\n"] = "",
3333
["Charging\n"] = "+",
34-
["Discharging\n"] = ""
34+
["Discharging\n"] = "-"
3535
}
3636

3737
-- Get current power usage in watt
@@ -80,7 +80,7 @@ local function worker(format, warg)
8080
if rate ~= nil and rate ~= 0 then
8181
if state == "+" then
8282
timeleft = (tonumber(capacity) - tonumber(remaining)) / tonumber(rate)
83-
elseif state == "" then
83+
elseif state == "-" then
8484
timeleft = tonumber(remaining) / tonumber(rate)
8585
else
8686
return {state, percent, time, wear, curpower}

0 commit comments

Comments
 (0)