Cleaner flow: Either Apple controls or normal

This commit is contained in:
David Heinemeier Hansson
2026-06-24 13:49:50 +02:00
parent 89abbddc77
commit 0bf29e2f4a
+28 -29
View File
@@ -47,39 +47,38 @@ if omarchy-hyprland-monitor-focused-apple; then
else else
omarchy-brightness-display-apple "$step" omarchy-brightness-display-apple "$step"
fi fi
exit else
fi # Current device highlighted
device="$(omarchy-hw-display)" || exit 1
# Current device highlighted # Current brightness percentage
device="$(omarchy-hw-display)" || exit 1 current=$(display_brightness "$device") || exit 1
# Current brightness percentage # Apply non-uniform step size: 1% steps if at or below 5%, otherwise set an
current=$(display_brightness "$device") || exit 1 # 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
# Apply non-uniform step size: 1% steps if at or below 5%, otherwise set an (( target > 100 )) && target=100
# absolute target percentage to avoid raw backlight rounding causing uneven OSD steps. step="$target%"
if [[ $step == "+5%" ]]; then elif [[ $step == "5%-" ]]; then
if (( current < 5 )); then if (( current <= 5 )); then
(( target = current + 1 )) (( target = current - 1 ))
else else
(( target = current + 5 )) (( target = current - 5 ))
fi
(( target < 1 )) && target=1
step="$target%"
fi fi
(( target > 100 )) && target=100 # Set brightness of the display device.
step="$target%" brightnessctl -d "$device" set "$step" >/dev/null
elif [[ $step == "5%-" ]]; then
if (( current <= 5 )); then
(( target = current - 1 ))
else
(( target = current - 5 ))
fi
(( target < 1 )) && target=1 # Show the new brightness in OSD
step="$target%" (( no_osd )) || omarchy-osd -i brightness -p "$(display_brightness "$device")"
fi fi
# Set brightness of the display device.
brightnessctl -d "$device" set "$step" >/dev/null
# Show the new brightness in OSD
(( no_osd )) || omarchy-osd -i brightness -p "$(display_brightness "$device")"