[core/output] Minor refactoring - widget assembly

This commit is contained in:
Tobias Witek 2020-02-09 13:30:40 +01:00
parent 4e2a645bd3
commit b157aa9fb5

View file

@ -31,16 +31,20 @@ class i3(object):
def stop(self): def stop(self):
return { 'suffix': '\n]' } return { 'suffix': '\n]' }
def update(self, affected_modules=None): def widgets(self, module):
for module in self._modules: widgets = []
module.update()
self._status[module] = []
for widget in module.widgets(): for widget in module.widgets():
self._status[module].append({ widgets.append({
'full_text': widget.full_text(), 'full_text': widget.full_text(),
'instance': widget.id(), 'instance': widget.id(),
'name': module.id(), 'name': module.id(),
}) })
return widgets
def update(self, affected_modules=None):
for module in self._modules:
module.update()
self._status[module] = self.widgets(module)
def statusline(self): def statusline(self):
widgets = [] widgets = []