From: Dmitry Sidorov Date: Thu, 7 Jul 2016 12:52:36 +0000 (+0300) Subject: Battery remaining percentage must be int, not float X-Git-Url: https://git.madduck.net/etc/awesome.git/commitdiff_plain/cbab9ef81befe8be7c3b518f270b7084407e6ceb?ds=inline;hp=-c Battery remaining percentage must be int, not float --- cbab9ef81befe8be7c3b518f270b7084407e6ceb diff --git a/widgets/bat.lua b/widgets/bat.lua index 91e826e..ec9a289 100644 --- a/widgets/bat.lua +++ b/widgets/bat.lua @@ -131,7 +131,7 @@ local function worker(args) local hours = math.floor(rate_time) local minutes = math.floor((rate_time - hours) * 60) - bat_now.perc = tonumber(string.format("%d", math.min(100, sum_energy_percentage / #batteries))) + bat_now.perc = tonumber(string.format("%d", math.floor(math.min(100, sum_energy_percentage / #batteries)))) 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" then