This commit is contained in:
ltadeu6 2026-04-02 10:27:17 -03:00
parent 55c7c928e9
commit 0b4eacb4ba
15 changed files with 2371 additions and 4 deletions

36
configs/waybar/switch_sink.sh Executable file
View file

@ -0,0 +1,36 @@
#!/usr/bin/env sh
# Cycle default sink and move existing inputs.
if ! command -v pactl >/dev/null 2>&1; then
exit 1
fi
current="$(pactl get-default-sink 2>/dev/null)"
[ -z "$current" ] && exit 1
sinks="$(pactl list short sinks | awk '{print $2}')"
[ -z "$sinks" ] && exit 1
next=""
found=0
for s in $sinks; do
if [ "$found" -eq 1 ]; then
next="$s"
break
fi
if [ "$s" = "$current" ]; then
found=1
fi
done
# If current is last or not found, wrap to first.
if [ -z "$next" ]; then
next="$(printf '%s\n' "$sinks" | head -n 1)"
fi
pactl set-default-sink "$next" || exit 1
# Move existing audio streams to the new sink.
for input in $(pactl list short sink-inputs | awk '{print $1}'); do
pactl move-sink-input "$input" "$next" >/dev/null 2>&1 || true
done