[modules/progress] improved autohide functionality

Simplify the previous autohide functionality by adding a flag that lets
a module (e.g. progress) indicate that the current state should be
"revealed" (not auto-hidden).

This vastly simplifies the implementation.

see #835
This commit is contained in:
tobi-wan-kenobi 2021-11-06 08:21:08 +01:00
parent 5ad211f862
commit 26e4bdd7eb
2 changed files with 2 additions and 2 deletions

View file

@ -229,7 +229,7 @@ class i3(object):
for widget in module.widgets(): for widget in module.widgets():
if widget.module and self.__config.autohide(widget.module.name): if widget.module and self.__config.autohide(widget.module.name):
if not any( if not any(
state in widget.state() for state in ["warning", "critical"] state in widget.state() for state in ["warning", "critical", "no-autohide"]
): ):
continue continue
if module.hidden(): if module.hidden():

View file

@ -101,7 +101,7 @@ class Module(core.module.Module):
def state(self, widget): def state(self, widget):
if self.__active: if self.__active:
return "copying" return ["copying", "no-autohide"]
return "pending" return "pending"