n0paste Share your code online
#!/bin/bash
# Switch PulseAudio ouput device
DEFAULT=$(pacmd list-sinks|grep "*"|awk '{ print $3 }')

if [ "$DEFAULT" -eq 1 ]; then
    DEV=0
else
    DEV=1
fi

pacmd set-default-sink "$DEV" > /dev/null
# change audio output device on running programs
pacmd list-sink-inputs | grep index | while read line
do
    pacmd move-sink-input "$(echo "$line" | cut -f2 -d' ')" "$DEV" > /dev/null
done
Switch between two pulseaudio devices
SyntaxBash
Created01.12.2018 - 16:22
ExpiresNever