[modules/battery] Add warning and critical functionality for battery

This commit is contained in:
Tobias Witek 2016-10-31 12:01:21 +01:00
parent 83bb1deb52
commit 293c8453be

View file

@ -14,6 +14,12 @@ class Module(bumblebee.module.Module):
return "{:02d}%".format(self._capacity) return "{:02d}%".format(self._capacity)
def warning(self):
return self._capacity < 20
def critical(self):
return self._capacity < 10
def state(self): def state(self):
with open("/sys/class/power_supply/{}/status".format(self._battery)) as f: with open("/sys/class/power_supply/{}/status".format(self._battery)) as f:
self._status = f.read().strip() self._status = f.read().strip()