X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/37c4198cdf300b4dab002e5cbc9ea2590f17f168..63455361db71b0dde286f85331c6c69f00a3fba7:/widgets/bat.lua diff --git a/widgets/bat.lua b/widgets/bat.lua index 8cc1ea9..61ad6a3 100644 --- a/widgets/bat.lua +++ b/widgets/bat.lua @@ -69,13 +69,6 @@ local function worker(args) local rate_voltage = tonumber(first_line(bstr .. "/voltage_now")) local rate_power = tonumber(first_line(bstr .. "/power_now")) - -- if rate = 0 or rate not defined skip the round - if not (rate_power and rate_power > 0) and - not (rate_current and rate_current > 0) - then - return - end - -- energy_now(P)[uWh], charge_now(I)[uAh] local energy_now = tonumber(first_line(bstr .. "/energy_now") or first_line(bstr .. "/charge_now")) @@ -91,6 +84,14 @@ local function worker(args) bat_now.status = first_line(bstr .. "/status") or "N/A" bat_now.ac_status = first_line(astr .. "/online") or "N/A" + -- if rate = 0 or rate not defined skip the round + if not (rate_power and rate_power > 0) and + not (rate_current and rate_current > 0) and + not (bat_now.status == "Full") + then + return + end + local rate_time = 0 if bat_now.status == "Charging" then