feat(hypr): implement display and keyboard backlight dimming

This commit is contained in:
2026-03-06 19:35:59 +01:00
parent f659be1b00
commit b6fa9dc31e
3 changed files with 84 additions and 2 deletions

35
hypr/scripts/dim-display.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -euo pipefail
SCREEN_DEVICE="amdgpu_bl1"
STATE_DIR="${XDG_RUNTIME_DIR:-/tmp}/hypridle"
SCREEN_STATE_FILE="$STATE_DIR/screen"
mkdir -p "$STATE_DIR"
save_current() {
brightnessctl -d "$SCREEN_DEVICE" g >"$SCREEN_STATE_FILE"
}
dim() {
save_current
brightnessctl -d "$SCREEN_DEVICE" set 10%
}
restore() {
[[ -f "$SCREEN_STATE_FILE" ]] && brightnessctl -d "$SCREEN_DEVICE" s "$(cat "$SCREEN_STATE_FILE")"
}
case "${1:-}" in
dim)
dim
;;
restore)
restore
;;
*)
echo "Usage: $0 {dim|restore}"
exit 1
;;
esac