From 293c8453be469f0680f18877b0d968c7ec72a0e7 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Mon, 31 Oct 2016 12:01:21 +0100 Subject: [PATCH] [modules/battery] Add warning and critical functionality for battery --- bumblebee/modules/battery.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bumblebee/modules/battery.py b/bumblebee/modules/battery.py index 4feb5e8..7b95480 100644 --- a/bumblebee/modules/battery.py +++ b/bumblebee/modules/battery.py @@ -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()