From c078d7ad0537017f4e7cbb40d8dabdf69db14372 Mon Sep 17 00:00:00 2001 From: boobachad <83977152+boobachad@users.noreply.github.com> Date: Fri, 1 May 2026 20:13:32 +0530 Subject: [PATCH] Implement non-uniform brightness step adjustments (#5525) * Implement non-uniform brightness step adjustments Add logic for non-uniform step size adjustments based on current brightness level. * Ensure percentages are moved in a consistent manner so we don't get rounding errors * Ensure we don't go below 1% To prevent screen from turning off entirely on some models --------- Co-authored-by: David Heinemeier Hansson --- bin/omarchy-brightness-display | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/bin/omarchy-brightness-display b/bin/omarchy-brightness-display index 493265d4..c7048568 100755 --- a/bin/omarchy-brightness-display +++ b/bin/omarchy-brightness-display @@ -14,6 +14,31 @@ for candidate in amdgpu_bl* intel_backlight acpi_video*; do fi done +# Current brightness percentage +current=$(brightnessctl -d "$device" -m | cut -d',' -f4 | tr -d '%') + +# Apply non-uniform step size: 1% steps if at or below 5%, otherwise set an +# absolute target percentage to avoid raw backlight rounding causing uneven OSD steps. +if [[ $step == "+5%" ]]; then + if (( current < 5 )); then + (( target = current + 1 )) + else + (( target = current + 5 )) + fi + + (( target > 100 )) && target=100 + step="$target%" +elif [[ $step == "5%-" ]]; then + if (( current <= 5 )); then + (( target = current - 1 )) + else + (( target = current - 5 )) + fi + + (( target < 1 )) && target=1 + step="$target%" +fi + # Set the actual brightness of the display device. brightnessctl -d "$device" set "$step" >/dev/null