Merge pull request #5210 from gitmpr/fix/backlight-min-brightness-step-clamp
fix(backlight): clamp scroll step to min-brightness
This commit is contained in:
@@ -118,10 +118,16 @@ bool waybar::modules::Backlight::handleScroll(GdkEventScroll* e) {
|
|||||||
if (config_["min-brightness"].isDouble()) {
|
if (config_["min-brightness"].isDouble()) {
|
||||||
min_brightness = config_["min-brightness"].asDouble();
|
min_brightness = config_["min-brightness"].asDouble();
|
||||||
}
|
}
|
||||||
if (backend.get_scaled_brightness(preferred_device_) <= min_brightness &&
|
if (ct == util::ChangeType::Decrease) {
|
||||||
ct == util::ChangeType::Decrease) {
|
const double current = backend.get_scaled_brightness(preferred_device_);
|
||||||
|
if (current <= min_brightness) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (current - step < min_brightness) {
|
||||||
|
backend.set_scaled_brightness(preferred_device_, static_cast<int>(std::round(min_brightness)));
|
||||||
|
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