Move FIFO setup and percentage emission into helper scripts so the Hyprland config has no raw $VAR references — Hyprland's parser substitutes $varname at parse time, which mangled awk's $2 and $HYPRLAND_INSTANCE_SIGNATURE and left binds broken after reload. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
17 lines
558 B
Bash
Executable file
17 lines
558 B
Bash
Executable file
#!/usr/bin/env bash
|
|
# Adjust backlight and emit current percentage to the wob overlay FIFO.
|
|
# Usage: wob-brightness.sh up|down
|
|
|
|
set -u
|
|
|
|
case "${1:-}" in
|
|
up) brightnessctl -e4 -n2 set 5%+ >/dev/null ;;
|
|
down) brightnessctl -e4 -n2 set 5%- >/dev/null ;;
|
|
*) echo "usage: $0 up|down" >&2; exit 2 ;;
|
|
esac
|
|
|
|
fifo="${XDG_RUNTIME_DIR:-/tmp}/hypr-wob.${HYPRLAND_INSTANCE_SIGNATURE:-default}"
|
|
[[ -p "$fifo" ]] || exit 0
|
|
current=$(brightnessctl get)
|
|
max=$(brightnessctl max)
|
|
awk -v c="$current" -v m="$max" 'BEGIN { printf "%d\n", (c/m)*100 }' > "$fifo"
|