[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:
parent
7b62aeb67c
commit
329f546879
1 changed files with 1 additions and 0 deletions
|
@ -20,6 +20,7 @@ class Module(bumblebee.module.Module):
|
||||||
def data(self):
|
def data(self):
|
||||||
with open("/sys/class/power_supply/{}/capacity".format(self._battery)) as f:
|
with open("/sys/class/power_supply/{}/capacity".format(self._battery)) as f:
|
||||||
self._capacity = int(f.read())
|
self._capacity = int(f.read())
|
||||||
|
self._capacity = self._capacity if self._capacity < 100 else 100
|
||||||
|
|
||||||
return "{:02d}%".format(self._capacity)
|
return "{:02d}%".format(self._capacity)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue