[core/output] Unify common i3 attributes
This commit is contained in:
parent
84833dc7db
commit
0a266b607e
2 changed files with 27 additions and 24 deletions
|
@ -38,40 +38,42 @@ class i3(object):
|
|||
def stop(self):
|
||||
return { 'suffix': '\n]' }
|
||||
|
||||
def __separator(self, widget):
|
||||
if not self._theme.separator():
|
||||
return []
|
||||
return [{
|
||||
'full_text': self._theme.separator(),
|
||||
'color': self._theme.bg(widget),
|
||||
'background': self._theme.bg('previous'),
|
||||
'separator': False,
|
||||
'separator_block_width': self._theme.separator_block_width(),
|
||||
'border_top': self._theme.border_top(),
|
||||
'border_left': self._theme.border_left(),
|
||||
'border_right': self._theme.border_right(),
|
||||
'border_bottom': self._theme.border_bottom(),
|
||||
}]
|
||||
|
||||
def __main(self, module, widget):
|
||||
return [{
|
||||
'full_text': widget.full_text(),
|
||||
'instance': widget.id(),
|
||||
'name': module.id(),
|
||||
'color': self._theme.fg(widget),
|
||||
'background': self._theme.bg(widget),
|
||||
def __common_attributes(self, module, widget):
|
||||
return {
|
||||
'separator': self._theme.default_separators(),
|
||||
'separator_block_width': self._theme.separator_block_width(),
|
||||
'border_top': self._theme.border_top(),
|
||||
'border_left': self._theme.border_left(),
|
||||
'border_right': self._theme.border_right(),
|
||||
'border_bottom': self._theme.border_bottom(),
|
||||
}]
|
||||
'instance': widget.id(),
|
||||
'name': module.id(),
|
||||
}
|
||||
|
||||
def __separator(self, module, widget):
|
||||
if not self._theme.separator():
|
||||
return []
|
||||
attr = self.__common_attributes(module, widget)
|
||||
attr.update({
|
||||
'full_text': self._theme.separator(),
|
||||
'color': self._theme.bg(widget),
|
||||
'background': self._theme.bg('previous'),
|
||||
})
|
||||
return [attr]
|
||||
|
||||
def __main(self, module, widget):
|
||||
attr = self.__common_attributes(module, widget)
|
||||
attr.update({
|
||||
'full_text': widget.full_text(),
|
||||
'color': self._theme.fg(widget),
|
||||
'background': self._theme.bg(widget),
|
||||
})
|
||||
return [attr]
|
||||
|
||||
def widgets(self, module):
|
||||
widgets = []
|
||||
for widget in module.widgets():
|
||||
widgets += self.__separator(widget)
|
||||
widgets += self.__separator(module, widget)
|
||||
widgets += self.__main(module, widget)
|
||||
core.event.trigger('next-widget')
|
||||
return widgets
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
## Backwards-compatibility
|
||||
- aliases
|
||||
- icons (prefix/postfix)
|
||||
- charts (braille)
|
||||
- minimize modules
|
||||
- hide modules if not in warning/error state (-a)
|
||||
|
|
Loading…
Reference in a new issue