[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:
Tobi-wan Kenobi 2016-11-09 19:32:26 +01:00
parent da4dd7c7a1
commit f164aee5c9

View file

@ -16,7 +16,7 @@ class Module(bumblebee.module.Module):
with open("/sys/class/backlight/intel_backlight/max_brightness") as f:
self._max = int(f.read())
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))