From 138bd01b76bde614277c5e037cd73c384858909d Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Wed, 26 Jun 2019 20:36:04 +0200 Subject: [PATCH] [modules/battery] Allow hiding of icons Use the parameter battery.decorate=False to hide icons such as the AC indicator and the charging symbol. warning and critical states are still propagated. fixes #401 --- bumblebee/input.py | 1 - bumblebee/modules/battery.py | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bumblebee/input.py b/bumblebee/input.py index 710589e..af86757 100644 --- a/bumblebee/input.py +++ b/bumblebee/input.py @@ -53,7 +53,6 @@ def read_input(inp): log.debug("failed to parse event: {}".format(e)) log.debug("exiting click event processing") poll.unregister(sys.stdin.fileno()) - poll.close() inp.has_event = True inp.clean_exit = True diff --git a/bumblebee/modules/battery.py b/bumblebee/modules/battery.py index 4174e56..437a7d2 100644 --- a/bumblebee/modules/battery.py +++ b/bumblebee/modules/battery.py @@ -7,6 +7,7 @@ Parameters: * battery.warning : Warning threshold in % of remaining charge (defaults to 20) * battery.critical : Critical threshold in % of remaining charge (defaults to 10) * battery.showdevice : If set to "true", add the device name to the widget (defaults to False) + * battery.decorate : If set to "false", hides additional icons (charging, etc.) (defaults to True) """ import os @@ -102,6 +103,9 @@ class Module(bumblebee.engine.Module): elif capacity < int(self.parameter("warning", 20)): state.append("warning") + if bumblebee.util.asbool(self.parameter("decorate", True)) == False: + return state + if widget.get("ac"): state.append("AC") else: