The plethora of VO bugs introduced in Tahoe have been driving me insane, none moreso than the broken sound icon in the menu bar and the fact that it is unreliable even when used via control centre. I decided to fix it by creating a simple way to switch sound devices on the fly, and I'm including the instructions here for any of you who are also driven mad by these bugs, or who simply want a key command to bring up a list of your available output devices and switch to them.
You will need to use the terminal and script editor. You first need to install the homebrew package manager if you don't have it already. Open terminal (applications > utilities), paste in this line and press enter:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Follow any prompts to complete the installation.
Once homebrew is installed, we can install a little command line application for switching audio devices. enter this command and again press enter:
brew install switchaudio-osx
With that done, quit the terminal and open the APpleScript editor, again in applications > utilities. You should be presented with a blank script file. Paste in the following script:
set pathToTool to ""
if (do shell script "test -f /opt/homebrew/bin/SwitchAudioSource && echo true || echo false") is "true" then
set pathToTool to "/opt/homebrew/bin/SwitchAudioSource"
else if (do shell script "test -f /usr/local/bin/SwitchAudioSource && echo true || echo false") is "true" then
set pathToTool to "/usr/local/bin/SwitchAudioSource"
else
display dialog "This script requires the 'SwitchAudioSource' command-line tool, but it was not found at the standard Homebrew paths." & return & return & "Please ensure Homebrew and SwitchAudioSource are installed correctly." buttons {"OK"} default button "OK" with icon stop
return
end if
set deviceList to paragraphs of (do shell script pathToTool & " -a -t output")
set chosenDevice to choose from list deviceList with prompt "Select a sound output device:" with title "Sound Output Switcher"
if chosenDevice is not false then
set deviceName to item 1 of chosenDevice
do shell script pathToTool & " -s " & quoted form of deviceName
end if
Now you've pasted the script, go to the menu bar and under 'file' select 'Export'. Give it a name (I chose 'Sound Switcher'), and set the file type to Application. YOu can leave the other options as defaults. I saved it in my applications folder.
With your applet created, you can use the Voiceover keyboard commander to tie it to a keyboard shortcut. Open the Voiceover utility, and under 'commands' choose 'edit option key commands'. Add a new command, assign a letter, and for the command itself choose 'open application' from the 'custom commands' menu option. Choose your newly created application, hit done, and close the Voiceover utility. You should now be able to press your chosen command and your new app should launch. If you did everything correctly, you should be presented with a list of the sound output devices on your system. Select one with the arrow keys or by interacting with he table, and hit enter or choose the 'ok' button to select it.
If there's enough interest I may bundle this into an application or create a simple installation script. For now it's a quick and dirty solution that works well. Feel free to leave a comment if you get stuck with the setup, or if you have any suggestions.
Comments
another way around the issue
if you aren't comfortable using this way around the issue, there is another. use VO+CMD+f5 to focus the mouse to the icon in the menu bar, then use VO+shift+space bar to click it. this loads up the interface for switching audio devices relyably for me. Just thought i'd throw this out there as another option.