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>
15 lines
505 B
Bash
Executable file
15 lines
505 B
Bash
Executable file
#!/usr/bin/env bash
|
|
# Adjust volume and emit current percentage to the wob overlay FIFO.
|
|
# Usage: wob-volume.sh up|down
|
|
|
|
set -u
|
|
|
|
case "${1:-}" in
|
|
up) wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+ ;;
|
|
down) wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- ;;
|
|
*) echo "usage: $0 up|down" >&2; exit 2 ;;
|
|
esac
|
|
|
|
fifo="${XDG_RUNTIME_DIR:-/tmp}/hypr-wob.${HYPRLAND_INSTANCE_SIGNATURE:-default}"
|
|
[[ -p "$fifo" ]] || exit 0
|
|
wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{printf "%d\n", $2*100}' > "$fifo"
|