Backlight: Add minimum brightness
As currently it is possible to turn the brightness to zero which may not be desirable, this patch add a configurable brightness check.
This commit is contained in:
@ -112,6 +112,14 @@ bool waybar::modules::Backlight::handleScroll(GdkEventScroll *e) {
|
||||
step = config_["scroll-step"].asDouble();
|
||||
}
|
||||
|
||||
double min_brightness = 10;
|
||||
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);
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user