[backlight] Allow slower value change after a threshold
@@ -9,6 +9,9 @@ Configuration parameters:
(default None)
brightness_minimal: Don't go below this brightness to avoid black screen
(default 1)
+ brightness_slow: If current brightness value is below this threshold,
+ the value is changed by a minimal value instead of the brightness_delta.
+ (default 0)
button_down: Button to click to decrease brightness. Setting to 0 disables.
(default 5)
button_up: Button to click to increase brightness. Setting to 0 disables.
@@ -55,6 +58,7 @@ class Py3status:
brightness_delta = 8
brightness_initial = None
brightness_minimal = 1
+ brightness_slow = 0
button_down = 5
button_up = 4
cache_timeout = 10
@@ -98,12 +102,14 @@ class Py3status:
level = self._get_backlight_level()
button = event['button']
if button == self.button_up:
- level += self.brightness_delta
+ delta = self.brightness_delta if level >= self.brightness_slow else 1
+ level += delta
if level > 100:
level = 100
self._set_backlight_level(level)
elif button == self.button_down:
- level -= self.brightness_delta
+ delta = self.brightness_delta if level > self.brightness_slow else 1
+ level -= delta
if level < self.brightness_minimal:
level = self.brightness_minimal
self._set_backlight_level(level)
