[contrib/progress] allow hiding of inactive state

Add a new "hide-able" state "mayhide" that can be utilized by modules
without warning state. This state indicates that the module *may* be
hidden by autohide, if the user configures it like this.

see #835
This commit is contained in:
tobi-wan-kenobi 2021-11-05 14:00:34 +01:00
parent f0ab3ef03a
commit cbd989309d
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", "mayhide"]
): ):
continue continue
if module.hidden(): if module.hidden():

View file

@ -102,7 +102,7 @@ class Module(core.module.Module):
def state(self, widget): def state(self, widget):
if self.__active: if self.__active:
return "copying" return "copying"
return "pending" return ["pending", "mayhide"]
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4