[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.
This commit is contained in:
Tobias Witek 2016-11-03 19:43:30 +01:00
parent 7b62aeb67c
commit 329f546879

View file

@ -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)