From 4173f5bec3008deb306191fe7049e78e77763e5e Mon Sep 17 00:00:00 2001 From: copycat-killer Date: Tue, 4 Oct 2016 11:02:43 +0200 Subject: [PATCH] bat: catch AC and discharging case; #199 comment 251025564 --- widgets/bat.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/widgets/bat.lua b/widgets/bat.lua index d84a5d8..991885a 100644 --- a/widgets/bat.lua +++ b/widgets/bat.lua @@ -135,6 +135,10 @@ local function worker(args) bat_now.perc = math.floor(math.min(100, (sum_energy_now / sum_energy_full) * 100)) bat_now.time = string.format("%02d:%02d", hours, minutes) bat_now.watt = tonumber(string.format("%.2f", sum_rate_energy / 1e6)) + elseif bat_now.status ~= "Full" and sum_rate_power == 0 and bat_now.ac_status == 1 then + bat_now.perc = math.floor(math.min(100, (sum_energy_now / sum_energy_full) * 100)) + bat_now.time = "00:00" + bat_now.watt = 0 elseif bat_now.status == "Full" then bat_now.perc = 100 bat_now.time = "00:00" -- 2.39.2