From c9161c20ef025a034b0d5ebe386632e8fc1e4eed Mon Sep 17 00:00:00 2001 From: Sheppy Date: Sat, 25 Mar 2017 11:24:55 +0100 Subject: [PATCH] various bugfixes --- herbstluftwm/panel_content.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/herbstluftwm/panel_content.py b/herbstluftwm/panel_content.py index 39608e5..2b0e06d 100755 --- a/herbstluftwm/panel_content.py +++ b/herbstluftwm/panel_content.py @@ -77,7 +77,15 @@ def battery(): try: bat = hl_utils.shexec("acpi -b") bat = re.compile(r'Battery [0-9]+: ').sub('',bat) - return color_panel(bat.strip('\n'),get_color(int(bat.split('%')[0][-2:].rstrip('%'))+BAT_COLOR_OFFSET,0,100)) + plain = int(bat.split('%')[0][-2:].rstrip('%')) + + cur_time = [bat.split('%, ')[1].split(' ')[0].split(':')] + + if plain > 10: + plain += BAT_COLOR_OFFSET + if plain <= 1: + return color_panel(">>>>>>>>>>>>>>>> --------------- WARNING BATTER FAILURE IMMINENT --------------- <<<<<<<<<<<<<",RED) + return color_panel(bat.strip('\n'),get_color(plain,0,100)) except ValueError as e: return color_panel(str(e),RED) else: