X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/70bee86b8b4e796a7f399f5d795b080ae8f3a4f6..2d8e93f18961e2d5c051b749e667a0ddc9d14ae3:/widgets/bat.lua diff --git a/widgets/bat.lua b/widgets/bat.lua index 5f049e2..3b9cca0 100644 --- a/widgets/bat.lua +++ b/widgets/bat.lua @@ -49,20 +49,20 @@ local function worker(args) bg = "#FFFFFF" } - function update() - bat_now = { - status = "Not present", - ac_status = "N/A", - perc = "N/A", - time = "N/A", - watt = "N/A" - } - - bat_now.n_status = {} - for i = 1, #batteries do - bat_now.n_status[i] = "Not present" - end + bat_now = { + status = "Not present", + ac_status = "N/A", + perc = "N/A", + time = "N/A", + watt = "N/A" + } + bat_now.n_status = {} + for i = 1, #batteries do + bat_now.n_status[i] = "Not present" + end + + function update() local sum_rate_current = 0 local sum_rate_voltage = 0 local sum_rate_power = 0 @@ -110,8 +110,7 @@ local function worker(args) bat_now.ac_status = first_line(string.format("/sys/class/power_supply/%s/online", ac)) or "N/A" -- update {perc,time,watt} iff rate > 0 and battery not full - if (sum_rate_current > 0 or sum_rate_power > 0) - and bat_now.status ~= "N/A" and bat_now.status ~= "Full" + if (sum_rate_current > 0 or sum_rate_power > 0) and not (bat_now.status == "Full") then local rate_time = 0