update bat_freebsd

This commit is contained in:
mutlusun 2019-03-08 08:20:27 +01:00
parent 96c9d59eb5
commit 1003ed4e92
1 changed files with 7 additions and 3 deletions

View File

@ -8,8 +8,8 @@ local string = {
gmatch = string.gmatch, gmatch = string.gmatch,
match = string.match, match = string.match,
format = string.format format = string.format
} }
-- }}} -- }}}
local bat_freebsd = {} local bat_freebsd = {}
@ -22,9 +22,9 @@ local function worker(format, warg)
bat_info[key] = value bat_info[key] = value
end end
end end
f:close()
-- current state -- current state
-- see: https://github.com/freebsd/freebsd/blob/master/usr.sbin/acpi/acpiconf/acpiconf.c
local state local state
if bat_info["State"] == "high" then if bat_info["State"] == "high" then
state = "" state = ""
@ -34,8 +34,12 @@ local function worker(format, warg)
state = "+" state = "+"
elseif bat_info["State"] == "discharging" then elseif bat_info["State"] == "discharging" then
state = "-" state = "-"
elseif bat_info["State"] == "critical discharging" then
state = "!"
elseif bat_info["State"] == "critical" then
state = "!"
else else
state = "" state = "N/A"
end end
-- battery capacity in percent -- battery capacity in percent