diff --git a/core/output.py b/core/output.py index 20fae68..2b0ab2e 100644 --- a/core/output.py +++ b/core/output.py @@ -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 diff --git a/doc/NOTES.md b/doc/NOTES.md index 6ff81f6..1ce031e 100644 --- a/doc/NOTES.md +++ b/doc/NOTES.md @@ -14,6 +14,7 @@ ## Backwards-compatibility - aliases +- icons (prefix/postfix) - charts (braille) - minimize modules - hide modules if not in warning/error state (-a)