Last active
August 29, 2015 14:27
-
-
Save rkfg/bf85ab97b9a7783e57f9 to your computer and use it in GitHub Desktop.
PulseAudio monitor switch
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/sh | |
INDEX=$(pacmd list-source-outputs | sed -n 's#\s*index\: \([0-9]*\)#\1#p' | head -n 1) | |
if [ -z "$INDEX" ] | |
then | |
exit 1 | |
fi | |
MONITOR=$(pacmd list-sources | sed -n 's#\s*name: <\(.*\.monitor\)>#\1#p' | head -n 1) | |
INPUT=$(pacmd list-sources | sed -n 's#\s*name: <\(.*_input.*\)>#\1#p' | head -n 1) | |
if [ "$1" = "-m" ] | |
then | |
pacmd move-source-output $INDEX $MONITOR | |
else | |
pacmd move-source-output $INDEX $INPUT | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment