[modules/brightness] Add missing integer casting for calculation
To display a nice percentage-based brightness, round it to int in all circumstances.
This commit is contained in:
parent
da4dd7c7a1
commit
f164aee5c9
1 changed files with 1 additions and 1 deletions
|
@ -16,7 +16,7 @@ class Module(bumblebee.module.Module):
|
||||||
with open("/sys/class/backlight/intel_backlight/max_brightness") as f:
|
with open("/sys/class/backlight/intel_backlight/max_brightness") as f:
|
||||||
self._max = int(f.read())
|
self._max = int(f.read())
|
||||||
self._brightness = self._brightness if self._brightness < self._max else self._max
|
self._brightness = self._brightness if self._brightness < self._max else self._max
|
||||||
self._percent = round(self._brightness * 100 / self._max)
|
self._percent = int(round(self._brightness * 100 / self._max))
|
||||||
|
|
||||||
return bumblebee.output.Widget(self, "{:02d}%".format(self._percent))
|
return bumblebee.output.Widget(self, "{:02d}%".format(self._percent))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue