Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions switch
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/bin/bash
query="{query}"
[ $query = "{query}" ] && query="$@"
device="$(echo $query | sed -e 's/ (input)$//' -e 's/ (output)$//')"

device="{query}"

if [[ $query =~ (input) ]]; then
type=input
else
type=output
fi

if [ -x /usr/local/bin/SwitchAudioSource ]; then
/usr/local/bin/SwitchAudioSource -t $type -s "$device"
elif [ -x "$(which SwitchAudioSource)" ]; then
Expand Down