Created
March 25, 2012 08:18
-
-
Save iley/2192354 to your computer and use it in GitHub Desktop.
Change output device in pulseaudio
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
#!/usr/bin/env bash | |
sinks=($(pacmd list-sinks | grep index | \ | |
awk '{ if ($1 == "*") print "1",$3; else print "0",$2 }')) | |
inputs=($(pacmd list-sink-inputs | grep index | awk '{print $2}')) | |
[[ ${sinks[0]} = 0 ]] && swap=${sinks[1]} || swap=${sinks[3]} | |
pacmd set-default-sink $swap &> /dev/null | |
for i in ${inputs[*]}; do pacmd move-sink-input $i $swap &> /dev/null; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment