[modules/cpu] Enforce minimum width

Set the minimum width of the CPU widget to 99.9% to avoid constant size
changes as the utilization fluctuates between one and two digit numbers.
This commit is contained in:
Tobias Witek 2017-06-15 11:00:22 +02:00
parent e3f6642fcf
commit 7e45e797f1

View file

@ -18,8 +18,9 @@ import bumblebee.engine
class Module(bumblebee.engine.Module):
def __init__(self, engine, config):
super(Module, self).__init__(engine, config,
bumblebee.output.Widget(full_text=self.utilization))
widget = bumblebee.output.Widget(full_text=self.utilization)
widget.set("theme.minwidth", "99.9%")
super(Module, self).__init__(engine, config, widget)
self._utilization = psutil.cpu_percent(percpu=False)
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
cmd="gnome-system-monitor")