[core] Add "autohide" for distraction-free programming

Add a new parameter "-a|--autohide" that allows you to specify a
list of module names (or aliases) that will be hidden from the bar
*unless* their state is either warning or critical.
This commit is contained in:
Tobias Witek 2019-01-19 14:51:48 +01:00
parent 44a50c0b36
commit 7b07ef538a
2 changed files with 8 additions and 0 deletions

View file

@ -122,6 +122,9 @@ class I3BarOutput(object):
full_text = widget.full_text()
if widget.get_module() and widget.get_module().hidden():
return
if widget.get_module() and widget.get_module().name in self._config.autohide():
if not any(state in widget.state() for state in ["warning", "critical"]):
return
padding = self._theme.padding(widget)
prefix = self._theme.prefix(widget, padding)
suffix = self._theme.suffix(widget, padding)