Merge branch 'master' into partial-update-on-input

To make sure that all conflicts are resolved and because the
autohide feature is so nice.
This commit is contained in:
Tobias Witek 2019-01-19 14:56:25 +01:00
commit d9df96adcb
3 changed files with 11 additions and 0 deletions

View file

@ -171,6 +171,9 @@ $ ./bumblebee-status -d -m <list of modules>
This will create a file called `~/bumblebee-status-debug.log` by default. The file name can be changed by using the `-f` or `--logfile` option. This will create a file called `~/bumblebee-status-debug.log` by default. The file name can be changed by using the `-f` or `--logfile` option.
### Advanced Usage
If you want to have a minimal bar that stays out of the way, you can use the `-a` or `--autohide` switch to specify a list of module names. All those modules will only be displayed when (and as long as) their state is either warning or critical (high CPU usage, low disk space, etc.). As long as the module is in a "normal" state and does not require attention, it will remain hidden.
# Required Modules # Required Modules
Modules and commandline utilities are only required for modules, the core itself has no external dependencies at all. Modules and commandline utilities are only required for modules, the core itself has no external dependencies at all.

View file

@ -63,6 +63,8 @@ def create_parser():
help="Location of the debug log file") help="Location of the debug log file")
parser.add_argument("-i", "--iconset", default="auto", parser.add_argument("-i", "--iconset", default="auto",
help="Specify the name of an iconset to use (overrides theme default)") help="Specify the name of an iconset to use (overrides theme default)")
parser.add_argument("-a", "--autohide", nargs="+", default=[],
help="Specify a list of modules to hide when not in warning/error state")
return parser return parser
@ -108,4 +110,7 @@ class Config(bumblebee.store.Store):
def logfile(self): def logfile(self):
return os.path.expanduser(self._args.logfile) return os.path.expanduser(self._args.logfile)
def autohide(self):
return self._args.autohide
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4

View file

@ -152,6 +152,9 @@ class I3BarOutput(object):
"""Draw a single widget""" """Draw a single widget"""
if widget.get_module() and widget.get_module().hidden(): if widget.get_module() and widget.get_module().hidden():
return 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
separator = self._theme.separator(widget) separator = self._theme.separator(widget)
if separator: if separator: