diff --git a/bumblebee/modules/battery.py b/bumblebee/modules/battery.py index 83c5580..2b3b8de 100644 --- a/bumblebee/modules/battery.py +++ b/bumblebee/modules/battery.py @@ -22,9 +22,7 @@ class Module(bumblebee.module.Module): self._capacity = int(f.read()) self._capacity = self._capacity if self._capacity < 100 else 100 - return [ - bumblebee.output.Widget(self,"{:02d}%".format(self._capacity)) - ] + return bumblebee.output.Widget(self,"{:02d}%".format(self._capacity)) def warning(self): return self._capacity < self._config.parameter("battery.warning", 20) diff --git a/bumblebee/modules/cpu.py b/bumblebee/modules/cpu.py index 4e58a21..0df03a1 100644 --- a/bumblebee/modules/cpu.py +++ b/bumblebee/modules/cpu.py @@ -21,11 +21,7 @@ class Module(bumblebee.module.Module): def widgets(self): self._perc = psutil.cpu_percent(percpu=False) - return [ - bumblebee.output.Widget(self, - "{:05.02f}%".format(self._perc) - ) - ] + return bumblebee.output.Widget(self, "{:05.02f}%".format(self._perc)) def warning(self): return self._perc > self._config.parameter("cpu.warning", 70) diff --git a/bumblebee/modules/time.py b/bumblebee/modules/time.py index 38e42d9..358e75b 100644 --- a/bumblebee/modules/time.py +++ b/bumblebee/modules/time.py @@ -32,10 +32,6 @@ class Module(bumblebee.module.Module): self._fmt = config.parameter(param_name, default) def widgets(self): - return [ - bumblebee.output.Widget(self, - datetime.datetime.now().strftime(self._fmt) - ) - ] + return bumblebee.output.Widget(self, datetime.datetime.now().strftime(self._fmt)) # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 diff --git a/bumblebee/output.py b/bumblebee/output.py index 143439a..ac5a57d 100644 --- a/bumblebee/output.py +++ b/bumblebee/output.py @@ -66,6 +66,11 @@ class Output(object): pass def draw(self, widgets, theme): + if not type(widgets) is list: + widgets = [ widgets ] + self._draw(widgets, theme) + + def _draw(self, widgets, theme): pass def flush(self): diff --git a/bumblebee/outputs/i3.py b/bumblebee/outputs/i3.py index fe7797e..2259e1a 100644 --- a/bumblebee/outputs/i3.py +++ b/bumblebee/outputs/i3.py @@ -42,7 +42,7 @@ class Output(bumblebee.output.Output): def start(self): print json.dumps({ "version": 1, "click_events": True }) + "[" - def draw(self, widgets, theme): + def _draw(self, widgets, theme): for widget in widgets: if theme.separator(widget): self._data.append({