[modules/battery] Add warning and critical functionality for battery
This commit is contained in:
parent
83bb1deb52
commit
293c8453be
1 changed files with 6 additions and 0 deletions
|
@ -14,6 +14,12 @@ class Module(bumblebee.module.Module):
|
|||
|
||||
return "{:02d}%".format(self._capacity)
|
||||
|
||||
def warning(self):
|
||||
return self._capacity < 20
|
||||
|
||||
def critical(self):
|
||||
return self._capacity < 10
|
||||
|
||||
def state(self):
|
||||
with open("/sys/class/power_supply/{}/status".format(self._battery)) as f:
|
||||
self._status = f.read().strip()
|
||||
|
|
Loading…
Reference in a new issue