paulsri / alfred-airpods-selector

Use Alfred to Switch Between AirPods and Default Audio Sources on macOS
MIT License
54 stars 3 forks source link

not works, any things wrong ? #1

Open aizigao opened 7 years ago

aizigao commented 7 years ago
$ SwitchAudioSource -a
weixiangzhe airpods (input)
Built-in Input (input)
weixiangzhe airpods (output)
Built-in Output (output)
toggle=$1

switch="/usr/local/bin/SwitchAudioSource"
airpods1="AirPods Bedroom"
airpods3="AirPods Office"
airpods2="AirPods Travel"
mic="Built-in Microphone"
output="Built-in Output"

if [ $toggle = "off" ]; then
  $switch -t input -s "$mic" > /dev/null 2>&1 && $switch -t output -s "$output" > /dev/null 2>&1
  echo "Disabled"
else
  $switch -t input -s "$airpods1" > /dev/null 2>&1 && $switch -t output -s "$airpods1" > /dev/null 2>&1
  $switch -t input -s "$airpods2" > /dev/null 2>&1 && $switch -t output -s "$airpods2" > /dev/null 2>&1
  $switch -t input -s "$airpods3" > /dev/null 2>&1 && $switch -t output -s "$airpods3" > /dev/null 2>&1
  echo "Enabled"
fi
artemnovichkov commented 7 years ago

Replace: airpods1="AirPods Bedroom" With: airpods1="weixiangzhe airpods"