Skip to content

Instantly share code, notes, and snippets.

@syui
Created August 16, 2014 23:00
Show Gist options
  • Save syui/ec4976bffefca1c745d7 to your computer and use it in GitHub Desktop.
Save syui/ec4976bffefca1c745d7 to your computer and use it in GitHub Desktop.
function au(){
case $1 in
-o|*)
SwitchAudioSource -a | grep output | cut -d '(' -f 1 | sed -e 's/ *$//' -e 's/$/"/g' -e 's/^/"/g' | peco | xargs -J % SwitchAudioSource -s %
;;
-i)
SwitchAudioSource -a | grep input | cut -d '(' -f 1 | sed -e 's/ *$//' -e 's/$/"/g' -e 's/^/"/g' | peco | xargs -J % SwitchAudioSource -t input -s %
;;
esac
#zle reset-prompt
}
zle -N au
bindkey '\^^' au
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment