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.
This commit is contained in:
David Udelson 2017-05-27 12:19:42 -04:00
parent 5b9b4961d8
commit ad327267bd
1 changed files with 2 additions and 2 deletions

View File

@ -31,7 +31,7 @@ local function worker(format, warg)
["Unknown\n"] = "", ["Unknown\n"] = "",
["Charged\n"] = "", ["Charged\n"] = "",
["Charging\n"] = "+", ["Charging\n"] = "+",
["Discharging\n"] = "" ["Discharging\n"] = "-"
} }
-- Get current power usage in watt -- Get current power usage in watt
@ -80,7 +80,7 @@ local function worker(format, warg)
if rate ~= nil and rate ~= 0 then if rate ~= nil and rate ~= 0 then
if state == "+" then if state == "+" then
timeleft = (tonumber(capacity) - tonumber(remaining)) / tonumber(rate) timeleft = (tonumber(capacity) - tonumber(remaining)) / tonumber(rate)
elseif state == "" then elseif state == "-" then
timeleft = tonumber(remaining) / tonumber(rate) timeleft = tonumber(remaining) / tonumber(rate)
else else
return {state, percent, time, wear, curpower} return {state, percent, time, wear, curpower}