Created
February 16, 2018 16:54
-
-
Save jbrechtel/27ee916777a19e232c1ddebf7efe099a to your computer and use it in GitHub Desktop.
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/sh | |
#pacmd set-default-sink alsa_output.usb-Logitech_Logitech_G933_Gaming_Wireless_Headset-00.analog-stereo | |
#pacmd set-default-source alsa_input.usb-Logitech_Logitech_G933_Gaming_Wireless_Headset-00.analog-mono | |
function switchAudio() { | |
case "$1" in | |
"logitech") | |
local sink="alsa_output.usb-Logitech_Logitech_G933_Gaming_Wireless_Headset-00.analog-stereo" | |
local source="alsa_input.usb-Logitech_Logitech_G933_Gaming_Wireless_Headset-00.analog-mono" | |
;; | |
"jabra") | |
local sink="alsa_output.usb-0b0e_Jabra_SPEAK_410_USB_0023781DBDF8x010100-00.analog-stereo" | |
local source="alsa_input.usb-0b0e_Jabra_SPEAK_410_USB_0023781DBDF8x010100-00.analog-mono" | |
;; | |
esac; | |
local sourceCommand="pactl move-source-output {} $source" | |
local sinkCommand="pactl move-sink-input {} $sink" | |
pactl list | grep -o -E 'Sink Input #([0-9]+)' | cut -d"#" -f2 | xargs -I '{}' $sinkCommand | |
pactl list | grep -o -E 'Source Output #([0-9]+)' | cut -d"#" -f2 | xargs -I '{}' $sourceCommand | |
} | |
switchAudio $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment