Created
February 20, 2019 22:52
-
-
Save alete89/2d2f72c93f1257b4959b83718727e9ae to your computer and use it in GitHub Desktop.
Switch sound output device
This file contains hidden or 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 | |
new_sink=$(pacmd list-sinks | grep index | tee /dev/stdout | grep -m1 -A1 "* index" | tail -1 | cut -c12-) | |
echo "Setting default sink to: $new_sink"; | |
pacmd set-default-sink $new_sink | |
pacmd list-sink-inputs | grep index | while read line | |
do | |
echo "Moving input: "; | |
echo $line | cut -f2 -d' '; | |
echo "to sink: $new_sink"; | |
pacmd move-sink-input `echo $line | cut -f2 -d' '` $new_sink | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment