From 8a16d3cb3accc0b6eead8b7b4dc933f10bd92c72 Mon Sep 17 00:00:00 2001 From: me Date: Fri, 31 Jan 2020 11:30:48 +0200 Subject: [PATCH] extract method --- bumblebee/output.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/bumblebee/output.py b/bumblebee/output.py index 224e3f0..696d540 100644 --- a/bumblebee/output.py +++ b/bumblebee/output.py @@ -335,6 +335,17 @@ class WidgetDrawer(object): self._config = config self._widgets = [] + def add_separator(self, widget, separator): + """Add separator (if theme has one)""" + if separator: + self._widgets.append({ + u"full_text": separator, + "separator": False, + "color": self._theme.separator_fg(widget), + "background": self._theme.separator_bg(widget), + "separator_block_width": self._theme.separator_block_width(widget), + }) + def draw(self, widget, module=None, engine=None): """ Keep the same argument signature as I3BarOutput.draw() @@ -369,14 +380,8 @@ class WidgetDrawer(object): full_text = u"{}{}".format(full_text, suffix) separator = self._theme.separator(widget) - if separator: - self._widgets.append({ - u"full_text": separator, - "separator": False, - "color": self._theme.separator_fg(widget), - "background": self._theme.separator_bg(widget), - "separator_block_width": self._theme.separator_block_width(widget), - }) + self.add_separator(widget, separator) + width = self._theme.minwidth(widget) if width: