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
+16 -17
View File
@@ -47,18 +47,16 @@ 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
# 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 if (( current < 5 )); then
(( target = current + 1 )) (( target = current + 1 ))
else else
@@ -67,7 +65,7 @@ if [[ $step == "+5%" ]]; then
(( target > 100 )) && target=100 (( target > 100 )) && target=100
step="$target%" step="$target%"
elif [[ $step == "5%-" ]]; then elif [[ $step == "5%-" ]]; then
if (( current <= 5 )); then if (( current <= 5 )); then
(( target = current - 1 )) (( target = current - 1 ))
else else
@@ -76,10 +74,11 @@ elif [[ $step == "5%-" ]]; then
(( target < 1 )) && target=1 (( target < 1 )) && target=1
step="$target%" step="$target%"
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")"
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")"