[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
This commit is contained in:
parent
928c37a972
commit
138bd01b76
2 changed files with 4 additions and 1 deletions
|
@ -53,7 +53,6 @@ def read_input(inp):
|
||||||
log.debug("failed to parse event: {}".format(e))
|
log.debug("failed to parse event: {}".format(e))
|
||||||
log.debug("exiting click event processing")
|
log.debug("exiting click event processing")
|
||||||
poll.unregister(sys.stdin.fileno())
|
poll.unregister(sys.stdin.fileno())
|
||||||
poll.close()
|
|
||||||
inp.has_event = True
|
inp.has_event = True
|
||||||
inp.clean_exit = True
|
inp.clean_exit = True
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ Parameters:
|
||||||
* battery.warning : Warning threshold in % of remaining charge (defaults to 20)
|
* battery.warning : Warning threshold in % of remaining charge (defaults to 20)
|
||||||
* battery.critical : Critical threshold in % of remaining charge (defaults to 10)
|
* 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.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
|
import os
|
||||||
|
@ -102,6 +103,9 @@ class Module(bumblebee.engine.Module):
|
||||||
elif capacity < int(self.parameter("warning", 20)):
|
elif capacity < int(self.parameter("warning", 20)):
|
||||||
state.append("warning")
|
state.append("warning")
|
||||||
|
|
||||||
|
if bumblebee.util.asbool(self.parameter("decorate", True)) == False:
|
||||||
|
return state
|
||||||
|
|
||||||
if widget.get("ac"):
|
if widget.get("ac"):
|
||||||
state.append("AC")
|
state.append("AC")
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue