[modules/brightness] Use 'light' instead of 'xbacklight'

If available, use 'light' for setting the background light, as per
suggestion of RiadhAmami - thanks!

fixes #332
This commit is contained in:
Tobias Witek 2018-11-24 10:56:27 +01:00
parent 5ae659cdac
commit 22419b813f

View file

@ -8,6 +8,7 @@ Parameters:
"""
import bumblebee.util
import bumblebee.input
import bumblebee.output
import bumblebee.engine
@ -22,6 +23,12 @@ class Module(bumblebee.engine.Module):
self._device_path = self.parameter("device_path", "/sys/class/backlight/intel_backlight")
step = self.parameter("step", 2)
if bumblebee.util.which("light"):
engine.input.register_callback(self, button=bumblebee.input.WHEEL_UP,
cmd="light -A {}%".format(step))
engine.input.register_callback(self, button=bumblebee.input.WHEEL_DOWN,
cmd="light -U {}%".format(step))
else:
engine.input.register_callback(self, button=bumblebee.input.WHEEL_UP,
cmd="xbacklight +{}%".format(step))
engine.input.register_callback(self, button=bumblebee.input.WHEEL_DOWN,