mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
Extract turning brightness devices on/off
This commit is contained in:
@@ -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 '%')
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Adjust keyboard backlight brightness using available steps.
|
||||
# omarchy:args=<up|down|cycle>
|
||||
# omarchy:args=<up|down|cycle|off|restore>
|
||||
|
||||
direction="${1:-up}"
|
||||
|
||||
@@ -19,6 +19,14 @@ if [[ -z $device ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $direction == "off" ]]; then
|
||||
brightnessctl -sd "$device" set 0 >/dev/null
|
||||
exit 0
|
||||
elif [[ $direction == "restore" ]]; then
|
||||
brightnessctl -rd "$device" >/dev/null
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Get current and max brightness to determine step size.
|
||||
max_brightness="$(brightnessctl -d "$device" max)"
|
||||
current_brightness="$(brightnessctl -d "$device" get)"
|
||||
|
||||
@@ -5,6 +5,5 @@
|
||||
# omarchy:name=wake
|
||||
# omarchy:examples=omarchy system wake
|
||||
|
||||
hyprctl dispatch dpms on >/dev/null 2>&1
|
||||
brightnessctl -r >/dev/null 2>&1
|
||||
brightnessctl -rd '*::kbd_backlight' >/dev/null 2>&1
|
||||
omarchy-brightness-display on
|
||||
omarchy-brightness-keyboard restore
|
||||
|
||||
Reference in New Issue
Block a user