Merge pull request #3637 from TripleTrable/backlight/add_min_brightness
#2275 Backlight: Add minimum brightness
This commit is contained in:
@ -81,6 +81,11 @@ The *backlight* module displays the current backlight level.
|
|||||||
default: 1.0 ++
|
default: 1.0 ++
|
||||||
The speed at which to change the brightness when scrolling.
|
The speed at which to change the brightness when scrolling.
|
||||||
|
|
||||||
|
*min-brightness*: ++
|
||||||
|
typeof: double ++
|
||||||
|
default: 0.0 ++
|
||||||
|
The minimum brightness of the backlight.
|
||||||
|
|
||||||
*menu*: ++
|
*menu*: ++
|
||||||
typeof: string ++
|
typeof: string ++
|
||||||
Action that popups the menu.
|
Action that popups the menu.
|
||||||
|
@ -112,6 +112,14 @@ bool waybar::modules::Backlight::handleScroll(GdkEventScroll *e) {
|
|||||||
step = config_["scroll-step"].asDouble();
|
step = config_["scroll-step"].asDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double min_brightness = 0;
|
||||||
|
if (config_["min-brightness"].isDouble()) {
|
||||||
|
min_brightness = config_["min-brightness"].asDouble();
|
||||||
|
}
|
||||||
|
if (backend.get_scaled_brightness(preferred_device_) <= min_brightness &&
|
||||||
|
ct == util::ChangeType::Decrease) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
backend.set_brightness(preferred_device_, ct, step);
|
backend.set_brightness(preferred_device_, ct, step);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user