Skip to content

Instantly share code, notes, and snippets.

@mconnell
Last active August 24, 2018 09:22
Show Gist options
  • Save mconnell/3a15d650a04671aadc33efecc0be1a08 to your computer and use it in GitHub Desktop.
Save mconnell/3a15d650a04671aadc33efecc0be1a08 to your computer and use it in GitHub Desktop.
AppleScript for quickly flipping between 2 audio sources
-- Open automator
-- * New Service
-- * Service Recieves: no input
-- * Paste the following
-- * Alter audio sources to match your machine
-- * Save
-- Open Keyboard
-- * Shortcuts
-- * Services
-- * Bind to shortcut
-- https://github.com/deweller/switchaudio-osx
-- brew install switchaudio-osx
-- Names of Audio Sources
set sourceA to "Display Audio"
set sourceB to "Microsoft LifeChat LX_6000"
set switchAudio to "/usr/local/Cellar/switchaudio-osx/1.0.0/bin/SwitchAudioSource"
set audioSource to do shell script switchAudio & " -c"
if audioSource is equal to sourceA then
do shell script switchAudio & " -s \"" & sourceB & "\""
else
do shell script switchAudio & " -s \"" & sourceA & "\""
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment