commit 616c35ee7b9cf0db0a4ab68d5e6ce79e37ba1794
parent 6f66af17e15ed657e5ae2d1d1c951ea9249bbf16
Author: bsandro <email@bsandro.tech>
Date: Thu, 8 Sep 2022 03:08:58 +0300
Battery percentage bugfix.
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dwmstatus.c b/dwmstatus.c
@@ -202,7 +202,9 @@ getbattery(void)
}
percentage = cur_charge / full_charge * 100.0;
- if (charger_state == '-') {
+ if ((int)percentage == 100) {
+ remaining = 0;
+ } else if (charger_state == '-') {
remaining = cur_charge / consumption * 60.0;
} else {
remaining = (full_charge - cur_charge) / consumption * 60.0;