From 727997d5e0d9e699ea06959e2325e6a8ba27e6c6 Mon Sep 17 00:00:00 2001
From: Monokles <monokles@protonmail.ch>
Date: Mon, 15 Aug 2016 23:19:09 +0200
Subject: [PATCH] show true battery energy percentage

---
 widgets/bat.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/widgets/bat.lua b/widgets/bat.lua
index ec9a289..00d7183 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.floor(math.min(100, sum_energy_percentage / #batteries))))
+                bat_now.perc    = math.floor((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" then
-- 
2.39.5