[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:
parent
5ae659cdac
commit
22419b813f
1 changed files with 11 additions and 4 deletions
|
@ -8,6 +8,7 @@ Parameters:
|
|||
|
||||
"""
|
||||
|
||||
import bumblebee.util
|
||||
import bumblebee.input
|
||||
import bumblebee.output
|
||||
import bumblebee.engine
|
||||
|
@ -22,10 +23,16 @@ class Module(bumblebee.engine.Module):
|
|||
self._device_path = self.parameter("device_path", "/sys/class/backlight/intel_backlight")
|
||||
step = self.parameter("step", 2)
|
||||
|
||||
engine.input.register_callback(self, button=bumblebee.input.WHEEL_UP,
|
||||
cmd="xbacklight +{}%".format(step))
|
||||
engine.input.register_callback(self, button=bumblebee.input.WHEEL_DOWN,
|
||||
cmd="xbacklight -{}%".format(step))
|
||||
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,
|
||||
cmd="xbacklight -{}%".format(step))
|
||||
|
||||
def brightness(self, widget):
|
||||
if isinstance(self._brightness, float):
|
||||
|
|
Loading…
Reference in a new issue