From 329f54687951757921ce7fa423f3825c329896cd Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Thu, 3 Nov 2016 19:43:30 +0100 Subject: [PATCH] [modules/battery] Cap capacity at 100% Seems like my laptop at work is overly enthusiastic when it comes to charging. I don't believe in 105% capacity. --- bumblebee/modules/battery.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bumblebee/modules/battery.py b/bumblebee/modules/battery.py index 021e1eb..a83a2fd 100644 --- a/bumblebee/modules/battery.py +++ b/bumblebee/modules/battery.py @@ -20,6 +20,7 @@ class Module(bumblebee.module.Module): def data(self): with open("/sys/class/power_supply/{}/capacity".format(self._battery)) as f: self._capacity = int(f.read()) + self._capacity = self._capacity if self._capacity < 100 else 100 return "{:02d}%".format(self._capacity)