From f2dc5f4b40b891708f3d80d8f3dfeeaa2c7911f3 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Sun, 15 Mar 2020 14:01:09 +0100 Subject: [PATCH] [core/output] Implement autohide Allow output to automatically hide widgets that are *not* in any critical mode --- core/config.py | 3 +++ core/output.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/core/config.py b/core/config.py index c90aad8..4d6c1a3 100644 --- a/core/config.py +++ b/core/config.py @@ -39,4 +39,7 @@ class Config(util.store.Store): def iconset(self): return self._args.iconset + def autohide(self, name): + return name in self._args.autohide + # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 diff --git a/core/output.py b/core/output.py index a8358fc..874ce9c 100644 --- a/core/output.py +++ b/core/output.py @@ -93,6 +93,9 @@ class i3(object): def widgets(self, module): widgets = [] for widget in module.widgets(): + if self._config.autohide(widget.module().name()): + if not any(state in widget.state() for state in [ 'warning', 'critical']): + continue widgets += self.__separator(module, widget) widgets += self.__main(module, widget, self._status[widget]) core.event.trigger('next-widget')