refactoring regarding errors from codeclimate
This commit is contained in:
parent
30789499f5
commit
0185335e66
1 changed files with 10 additions and 12 deletions
|
@ -24,20 +24,18 @@ class Module(bumblebee.engine.Module):
|
||||||
step = self.parameter("step", 2)
|
step = self.parameter("step", 2)
|
||||||
|
|
||||||
if bumblebee.util.which("light"):
|
if bumblebee.util.which("light"):
|
||||||
engine.input.register_callback(self, button=bumblebee.input.WHEEL_UP,
|
self.register_cmd(engine, "light -A {}%".format(step),
|
||||||
cmd="light -A {}%".format(step))
|
"light -U {}%".format(step))
|
||||||
engine.input.register_callback(self, button=bumblebee.input.WHEEL_DOWN,
|
|
||||||
cmd="light -U {}%".format(step))
|
|
||||||
elif bumblebee.util.which("brightnessctl"):
|
elif bumblebee.util.which("brightnessctl"):
|
||||||
engine.input.register_callback(self, button=bumblebee.input.WHEEL_UP,
|
self.register_cmd(engine, "brightnessctl s {}%+".format(step),
|
||||||
cmd="brightnessctl s {}%+".format(step))
|
"brightnessctl s {}%-".format(step))
|
||||||
engine.input.register_callback(self, button=bumblebee.input.WHEEL_DOWN,
|
|
||||||
cmd="brightnessctl s {}%-".format(step))
|
|
||||||
else:
|
else:
|
||||||
engine.input.register_callback(self, button=bumblebee.input.WHEEL_UP,
|
self.register_cmd(engine, "xbacklight +{}%".format(step),
|
||||||
cmd="xbacklight +{}%".format(step))
|
"xbacklight -{}%".format(step))
|
||||||
engine.input.register_callback(self, button=bumblebee.input.WHEEL_DOWN,
|
|
||||||
cmd="xbacklight -{}%".format(step))
|
def register_cmd(self, engine, upCmd, downCmd):
|
||||||
|
engine.input.register_callback(self, button=bumblebee.input.WHEEL_UP, cmd=upCmd)
|
||||||
|
engine.input.register_callback(self, button=bumblebee.input.WHEEL_DOWN, cmd=downCmd)
|
||||||
|
|
||||||
def brightness(self, widget):
|
def brightness(self, widget):
|
||||||
if isinstance(self._brightness, float):
|
if isinstance(self._brightness, float):
|
||||||
|
|
Loading…
Reference in a new issue