[modules/battery] Remove leading zeroes and use minwidth

This commit is contained in:
Tobias Witek 2017-06-15 13:21:59 +02:00
parent 302e14007b
commit d189b3a335
2 changed files with 5 additions and 5 deletions

View file

@ -16,9 +16,9 @@ import bumblebee.engine
class Module(bumblebee.engine.Module): class Module(bumblebee.engine.Module):
def __init__(self, engine, config): def __init__(self, engine, config):
super(Module, self).__init__(engine, config, widget = bumblebee.output.Widget(full_text=self.capacity)
bumblebee.output.Widget(full_text=self.capacity) widget.set("theme.minwidth", "100%")
) super(Module, self).__init__(engine, config, widget)
battery = self.parameter("device", "BAT0") battery = self.parameter("device", "BAT0")
self._path = "/sys/class/power_supply/{}".format(battery) self._path = "/sys/class/power_supply/{}".format(battery)
self._capacity = 100 self._capacity = 100
@ -29,7 +29,7 @@ class Module(bumblebee.engine.Module):
return "ac" return "ac"
if self._capacity == -1: if self._capacity == -1:
return "n/a" return "n/a"
return "{:03d}%".format(self._capacity) return "{}%".format(self._capacity)
def update(self, widgets): def update(self, widgets):
self._ac = False self._ac = False

View file

@ -26,7 +26,7 @@ class Module(bumblebee.engine.Module):
cmd="gnome-system-monitor") cmd="gnome-system-monitor")
def utilization(self, _): def utilization(self, _):
return "{:6.01f}%".format(self._utilization) return "{:.01f}%".format(self._utilization)
def update(self, widgets): def update(self, widgets):
self._utilization = psutil.cpu_percent(percpu=False) self._utilization = psutil.cpu_percent(percpu=False)