MacOS keybound Audio Switcher

I constantly switch between speakers and headset.. like 5-6 times per day for conference calls and such…. and changing the audio source was super annoying.. SO THIS BECAME A THING.

Automator:

Using MacOS “Automator” and “switchaudio-osx” from Brew I was able to automate switching to my logitech 533 headset automagically. I have this setup on a key binding for control+F13

The code:

on run {input, parameters}
	set theSwitch to "/usr/local/Cellar/switchaudio-osx/1.0.0/SwitchAudioSource"
	set theSource to do shell script theSwitch & " -c"
	try
		if theSource = "Built-in Output" then
			do shell script theSwitch & " -t output -s \"G533 Gaming Headset\""
			do shell script theSwitch & " -t input -s \"G533 Gaming Headset\""
			display notification "Audio switched to G533 Headset." with title " Audio Input/Output Switcher"
		else
			do shell script theSwitch & " -t output -s \"Built-in Output\""
			do shell script theSwitch & " -t input -s \"Built-in Microphone\""
			display notification "Audio switched to Internal iMac Devices." with title " Audio Input/Output Switcher"
		end if
	end try
	return input
end run

You’re welcome.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.