If Xcode installed, with the binary named AudioSwitcher and located at ~/bin, use:Īs suggested from this Stack Exchange thread. If Homebrew installed, with the binary named SwitchAudioSource, use: ![]() Note: You can run the switchaudio-osx binary (named either AudioSwitcher or SwitchAudioSource) in Terminal to see the names of the input/output devices available, as well as the command options. Save any unsaved changes in any open documents and restart your computer. Click "add shortcut" and press a unique key combination, for example Command-Option-Control-A. Locate and select the service you created. Navigate to > System Preferences > Keyboard > Shortcuts > Services. Create a keyboard shortcut for the service. Press the Command-S keys to save the service with an appropriate name.ģ. Press the Build button to build and the Run button to test. Set theSource to do shell script theSwitch & " -c"ĭo shell script theSwitch & " -s \"Logitech USB Headset\""ĭo shell script theSwitch & " -s \"Built-in Output\"" As an example, assuming the switchaudio-osx binary is named AudioSwitcher located in the bin folder of you Home directory, and switching between the Built-in Output and a Logitech USB Headset, the script is: Next, type or copy/paste your Applescript code. At the top of the Workflow area set Service receives "no input" in "any application". Select Utilities from the Library and drag Run Applescript from the Action list into the Workflow area. Open Automator and choose Service for the document type. If you installed switchaudio-osx via Homebrew, you should find the binary located at /usr/local/Cellar/switchaudio-osx/1.0.0/SwitchAudioSource.Ģ. Since you'll be using AppleScript, you'll need to to quote the full path to the binary as well as use the correct name. If using this method, the binary will be named AudioSwitcher as opposed to SwitchAudioSource when using archive export. Press the Command-C keys to copy, navigate to a location of your choosing, and press the Command-V keys to paste. A Finder window will open showing the binary. Click the disclosure triangle beside the AudioSwitcher folder in the Project Navigator, click the disclosure triangle beside the Products folder, Control-click the AudioSwitcher binary, and click Show in Finder. Optionally, rather than export an archive, you can copy and paste the product build. One suggestion is to create a bin folder in your Home directory (i.e. Move the binary to a location of your choosing. Within the folder you will find the built binary in /Products/usr/local/bin/. ![]() A Finder window will open showing a date and time stamped SwitchAudioSource folder on the Desktop. Select Save Built Products and click Next. With the SwitchAudioSource archive selected, click Export. Once the Build Succeeded message displays, navigate to Product > Archive from the menu bar and click Archive. With AudioSwitcher selected in the Project Navigator, press the Command-B keys to build, or navigate to Product > Build from the menu bar and click Build. Install additional components if prompted. You can download Xcode from the Mac App Store if not installed. Open the unzipped switchaudio-osx-master folder and double-click AudioSwitcher.xcodeproj to open in Xcode. The easiest method is to install with Homebrew from the command-line using Terminal:Īnother method is to download the ZIP file from. As a precaution, backup your computer before proceeding.ġ. You can do this with Automator, Applescript, and the command-line utility switchaudio-osx.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |