[core/output] Evaluate "hidden()" callback of modules

This commit is contained in:
tobi-wan-kenobi 2020-04-28 20:11:02 +02:00
parent f2e0d3c0ee
commit f1341772e5
2 changed files with 5 additions and 0 deletions

View file

@ -40,6 +40,9 @@ class Module(core.input.Object):
self.theme = theme self.theme = theme
def hidden(self):
return False
def parameter(self, key, default=None): def parameter(self, key, default=None):
value = default value = default

View file

@ -162,6 +162,8 @@ class i3(object):
if widget.module() and self.__config.autohide(widget.module().name()): if widget.module() and self.__config.autohide(widget.module().name()):
if not any(state in widget.state() for state in [ 'warning', 'critical']): if not any(state in widget.state() for state in [ 'warning', 'critical']):
continue continue
if module.hidden():
continue
blocks.extend(self.__separator_block(module, widget)) blocks.extend(self.__separator_block(module, widget))
blocks.append(self.__content_block(module, widget)) blocks.append(self.__content_block(module, widget))
core.event.trigger('next-widget') core.event.trigger('next-widget')