Skip to content

Commit 3feae30

Browse files
committed
Option to limit max backlight level #3559
1 parent fbdf853 commit 3feae30

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

app/Input/InputDispatcher.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -916,11 +916,12 @@ public static void SetBacklight(int delta, bool force = false)
916916
bool onBattery = SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online;
917917

918918
int backlight = onBattery ? backlight_battery : backlight_power;
919+
int backlightMax = AppConfig.Get("max_brightness", 3);
919920

920-
if (delta >= 4)
921-
backlight = ++backlight % 4;
921+
if (delta > backlightMax)
922+
backlight = ++backlight % (backlightMax + 1);
922923
else
923-
backlight = Math.Max(Math.Min(3, backlight + delta), 0);
924+
backlight = Math.Max(Math.Min(backlightMax, backlight + delta), 0);
924925

925926
if (onBattery)
926927
AppConfig.Set("keyboard_brightness_ac", backlight);

0 commit comments

Comments
 (0)