From 2ca2e53b6bea2250dc2a23ed671378195e1b41b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=E1=BB=B3nh=20Thi=E1=BB=87n=20L=E1=BB=99c?= Date: Sat, 15 Aug 2026 23:27:21 +0700 Subject: [PATCH] fix(osd): clamp vertical brightness slider (#3067) * fix(osd): clamp vertical brightness slider * fix(osd): keep brightness slider value in sync --- quickshell/Modules/OSD/BrightnessOSD.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/quickshell/Modules/OSD/BrightnessOSD.qml b/quickshell/Modules/OSD/BrightnessOSD.qml index 0cf895956..d4fd686ac 100644 --- a/quickshell/Modules/OSD/BrightnessOSD.qml +++ b/quickshell/Modules/OSD/BrightnessOSD.qml @@ -109,6 +109,7 @@ DankOSD { onSliderValueChanged: newValue => { if (!DisplayService.brightnessAvailable) return; + root._displayBrightness = newValue; DisplayService.setBrightness(newValue, DisplayService.lastIpcDevice, true); resetHideTimer(); } @@ -257,8 +258,9 @@ DankOSD { if (!DisplayService.brightnessAvailable) return; const ratio = 1.0 - (mouse.y / height); - const newValue = Math.round(vertSlider.minimum + ratio * (vertSlider.maximum - vertSlider.minimum)); + const newValue = Math.max(vertSlider.minimum, Math.min(vertSlider.maximum, Math.round(vertSlider.minimum + ratio * (vertSlider.maximum - vertSlider.minimum)))); vertSlider.value = newValue; + root._displayBrightness = newValue; DisplayService.setBrightness(newValue, DisplayService.lastIpcDevice, true); resetHideTimer(); }