Extract turning brightness devices on/off

This commit is contained in:
David Heinemeier Hansson
2026-05-06 12:12:26 +02:00
parent ca74b4d1c5
commit 4d11f8cc06
3 changed files with 25 additions and 10 deletions
+14 -6
View File
@@ -1,15 +1,10 @@
#!/bin/bash
# omarchy:summary=Adjust brightness on the most likely display device.
# omarchy:args=<step>
# omarchy:args=<step|off|on>
step="${1:-+5%}"
if omarchy-hyprland-monitor-focused-apple; then
omarchy-brightness-display-apple "$step"
exit
fi
# Start with the first possible output, then refine to the most likely given an order heuristic.
device="$(ls -1 /sys/class/backlight 2>/dev/null | head -n1)"
for candidate in amdgpu_bl* intel_backlight acpi_video*; do
@@ -19,6 +14,19 @@ for candidate in amdgpu_bl* intel_backlight acpi_video*; do
fi
done
if [[ $step == "off" ]]; then
hyprctl dispatch dpms off >/dev/null 2>&1
exit 0
elif [[ $step == "on" ]]; then
hyprctl dispatch dpms on >/dev/null 2>&1
exit 0
fi
if omarchy-hyprland-monitor-focused-apple; then
omarchy-brightness-display-apple "$step"
exit
fi
# Current brightness percentage
current=$(brightnessctl -d "$device" -m | cut -d',' -f4 | tr -d '%')