Created
March 1, 2024 17:29
-
-
Save varqox/9830fdc5e9599838b9c882eb268b7a78 to your computer and use it in GitHub Desktop.
Select and create combined sink node with Pipewire and set it as default Pulseaudio sink (output)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
list_sinks() { | |
pw-cli list-objects Node | grep -P '^\s+id |^\s+node\.name|^\s+media\.class = "Audio/Sink"' | grep 'media\.class' -B 2 --no-group-separator | paste -sd' \n' | sed 's/^\s*id [0-9]*, type .*node\.name = "\([^"]*\)".*/\1/' | (grep -vP "^($1)$" || true) | |
} | |
pactl unload-module module-combine-sink 2> /dev/null | |
selected_names_regex='' | |
selected_names="" | |
while true; do | |
selected=$((echo && list_sinks "$selected_names_regex") | fzf --layout=reverse) | |
if [ -z "$selected" ]; then | |
break | |
fi | |
selected_names_regex="$selected_names_regex|$selected" | |
selected_names="$selected_names,$selected" | |
done | |
if [ ! -z "$selected_names" ]; then | |
pactl load-module module-combine-sink sink_name='combined' slaves="$selected_names" | |
pactl set-default-sink 'combined' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment