Last Updated or created 2022-04-11
Doing my work from home via Jitsi (Jabra headset) and Listening to music on my speakers. Sometimes i want to switch output. For example spotify on my headset.
Using below code, i can easily switch between output sinks.
#!/bin/bash if [ -z "$1" ]; then echo "DEVICE" pactl list sinks | egrep "^Sink|Description" | sed 'N;s/\n/,/' |sed -e 's/\t/ /g' | cut -f2,5- -d" " echo "APPLICATIONS" pactl list sink-inputs | egrep -ie "^Sink|application.name" | grep -v "\-application-name" | sed 'N;s/\n/,/' | sed -e 's/\t/ /g' | sed -e 's/ / /g' | cut -f3,6- -d" " echo "Usage: $0 APPID DEVICEID" >&2 exit 1 fi pactl move-sink-input $1 $2
It shows output devices, and applications which are using audio sinks.
Just match them up.