From 7b07ef538a4800ced196b122044c51810514a7d1 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Sat, 19 Jan 2019 14:51:48 +0100 Subject: [PATCH 1/2] [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. --- bumblebee/config.py | 5 +++++ bumblebee/output.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/bumblebee/config.py b/bumblebee/config.py index 9f6384a..68bd796 100644 --- a/bumblebee/config.py +++ b/bumblebee/config.py @@ -63,6 +63,8 @@ def create_parser(): help="Location of the debug log file") parser.add_argument("-i", "--iconset", default="auto", 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 @@ -108,4 +110,7 @@ class Config(bumblebee.store.Store): def logfile(self): return os.path.expanduser(self._args.logfile) + def autohide(self): + return self._args.autohide + # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 diff --git a/bumblebee/output.py b/bumblebee/output.py index 35c1895..5c6ff92 100644 --- a/bumblebee/output.py +++ b/bumblebee/output.py @@ -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) From bff5322cff96956d4c3511d0abcfec916e514571 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Sat, 19 Jan 2019 14:54:37 +0100 Subject: [PATCH 2/2] [doc] Add note about --autohide to README --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index b39b29d..f70e2af 100644 --- a/README.md +++ b/README.md @@ -171,6 +171,9 @@ $ ./bumblebee-status -d -m 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 Modules and commandline utilities are only required for modules, the core itself has no external dependencies at all.