From: copycat-killer Date: Tue, 4 Oct 2016 09:02:43 +0000 (+0200) Subject: bat: catch AC and discharging case; #199 comment 251025564 X-Git-Url: https://git.madduck.net/etc/awesome.git/commitdiff_plain/4173f5bec3008deb306191fe7049e78e77763e5e?ds=inline;hp=--cc bat: catch AC and discharging case; #199 comment 251025564 --- 4173f5bec3008deb306191fe7049e78e77763e5e 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"