3

I would like to be able to change the output device sometimes, for example to switch between headphones and speakers, without having to use the mouse.

I've figured out how to focus the 'status menu' area (top-right of screen) with a keyboard shortcut (default is Ctrl+Fn+F8), and can select the sound menu.

But when I try to select items in that menu, pressing the arrow keys will only alter the volume (even with modifiers like Cmd or Alt). Even page up/page down!

How can I access the rest of the menu with the keyboard and change the output device?

3 Answers 3

5

YMMV, but because

  1. I can’t rely on having a fixed list of sound sources when I plug & unplug screen & DAC from my macbook
  2. switchaudio-osx exists
  3. I use Apptivate for my keyboard shortcuts

My solution is:

  1. Install switchaudio-osx e.g. with brew install switchaudio-osx

  2. Use SwitchAudioSource -a to show me exactly how all my speakers are named.

  3. Create some 1-line AppleScripts, saving them as applications:

    do shell script "/usr/local/bin/SwitchAudioSource -s 'MacBook Pro Speakers'"

  4. Use Apptivate to give the saved AppleScript app a keyboard shortcut.

As mentioned in other answers, there are other popular alternatives to Apptivate for assigning a keyboard shortcut to an AppleScript application.

Using SwitchAudio has the advantage of not relying on UI list positions. A big help if your list changes. Run SwitchAudioSource with no options to see help text.

3
  • Great answer. Worked great for me and I've used it in a shortcut to. The path to SwitchAudioSource was different on my machine. Mine was in /opt/homebrew/Cellar/switchaudio-osx/1.1.0 you can find out where any brew package is located using brew --prefix switchaudio-osx. Swap the name of the package for your situation.
    – Tom Styles
    Jan 6 at 17:00
  • Oh man, this almost worked for me. I wanted a quick way to quickly go to my airpod max, Bluetooth devices only shows on the switchaudio device list when they are already connected
    – Stargazer
    Feb 15 at 20:51
  • Ah, so sad :-( I take it that if you just turn on the AirPods Max, they don't auto-connect to the Mac? Feb 16 at 21:31
4

I couldn't find a way to do this using the status menu, but another quick way by keyboard is:

  1. Open Sound Preferences (Opt+Volume 🔊 -- any of mute/volume up/down will work)
  2. Use tab + arrow keys to navigate to the "Output" tab if necesssary
  3. tab into the menu and use arrow keys to instantly change output
  4. Cmd+W to close the window

(macOS 10.15)

2
  • What is the "Volume 🔈" key (as mentioned in step 1 in this answer)? Jul 19, 2022 at 17:34
  • @JonSchneider You can use any of volume keys. Volume up, volume down, mute. Opt+Any Volume Key will work. Aug 4, 2022 at 7:34
0

The first answer to Using Apple Script to Manage Sound Output Selection describes how to use an AppleScript to swap between two output devices. This works for me without modification.

There is also Applescript: "can't get tab group 1 of window" which sets to specific devices. It is rather old, so may need some debugging.

Once you have a working script, there are various ways of running it with a keyboard shortcut. The simplest is to use FastScripts.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .