Display current audio output in menu bar?

I use and love Rogue Amoeba's SoundSource, but I've been having a ton of problems with it since Sequoia. Until they (hopefully) fix my issues, I realized I can get the most-used things I do with it from KM in the menu bar. Right now I just have it to switch the output between my speakers plugged into the headphone jack in the Mac mini and my headphones plugged into the headphone jack in my monitor. Is there a way to have KM show what the current output is set to in the menu along with those? I saw some stuff mentioned here, but nothing seems to fit this.

Thanks.

Sure. I think KM can fetch the name using an OS or AppleScript command. Then it could display the name. How do you want the name displayed? Do you want a hotkey to display the name in the notification window? Or do you want the name permanently displayed in the System Menu at the top of the screen? Or do you want the name spoken audibly whenever it changes? There are lots of output options.

When you said "in the menu" I'm guessing you meant in the KM Engine's system menu. No, I don't know how to put it in there, but as I indicate above there are other ways to put it in the macOS system menu.

Sorry, I did mean KM's Status Menu. Right now I have this (misspelling since fixed):

Screenshot 2025-01-26 at 14.13.41

I'd love for it to display the active output above those two.

I don't understand what you mean by "I have this." Is that a menu in the RogueAmoeba application? I can't tell where you got that screenshot from. I think I can make the audio devices show up in the System Menu (I've almost got it working) but I don't know what your screenshot is showing so I'm not sure what to do with that information.

That's a macro group in KM, set to show in the Status Menu.

Ok, let me ponder. If someone comes up with a solution before me, that's okay.

Thank you!

Well, I have some finished code that >should< work, but to my surprise the macOS command "system_profiler SPAudioDataType" does not display the name of the user's selected audio devices. Now I need more time to ponder why that is.

I think the general approach I'm using is sound (pun intended) but I made an incorrect assumption about which macOS command could be used to determine what the user's currently selected audio device is. So I need more time to figure out why.

According to some online information, obtaining the name of the output device (reliably) requires the downloading of a third party utility. I hope this isn't true. I don't want people who use my macros to be required to download third party apps, even if they are open source.

Do you use AirPlay to control any audio devices like HomePods? If not, my solution may work for you, and I could upload it. But if you do use AirPlay, then fetching the name of the Airplay devices is a very difficult problem for me, requiring multiple pages of Swift code, which is rapidly becoming too complex for me.

Fortunately, I guess, I do not use AirPlay. Only wireless I use with my Mac sometimes is AirPods Pro or a Fender Mustang Micro guitar headphone amp with Bluetooth.

Okay, I will upload my solution on a new page on this forum, in a couple of minutes.

Since your macros weren't uploaded for me, you can either take the needed parts from my macro and adapt them into yours, or you can upload your macro so I can adapt them.

Here it is:

Thank you so much for working on this. I added what you said in the comments to the macro group settings, and your macro to my Audio group, but all I get in the menu is the macro title. Am I missing something?

Screenshot 2025-01-26 at 22.26.28

Sorry, I think I neglected to say that under the "With Custom Title" option you should specify the option "Update every second" or something frequent like that. I think the default is "every Minute" which means you wouldn't see anything for a minute. That may explain why you didn't see anything.

Once you do this, the names of the devices will appear on the System Menu Bar, not in the menu itself. If you were expecting the names to appear in the menu, I don't think Keyboard Maestro allows that area to be changed. But I think the best place for this information is in the System Menu Bar, not in the individual menu items.

Ahhh, thank you. Now I see it in the menu bar. I use Bartender, so I wasn't seeing it appear initially. Damn, I wish I could see it in the KM Status Menu along with the output selections I have set up.

Perhaps one of the real wizards on this site can tell us if that's possible. I'm just a wannabe wizard. Isn't that called a squib?

Thanks for all your help. I'll post a new question about this, more streamlined.

1 Like

Hi @ken

Just jumping onboard this thread because I'm a lover of SoundSource and have wanted similar info readily available to me. I've also been looking at mapping hot keys to instantly toggle an effect for a given input application, and I've been exploring how to keep the window pinned and always activated.

Just a quick question: Do you know how KM can detect the SoundSource window, given that it's a menu-bar app, so one could utilise IF 'front window' of 'front App' is not active, THEN .... do something like return to the 'window containing...' 'SoundSource' , for example.

I can't find how KM could manipulate menu-bar apps, but I can see plenty of options for manipulating windows of normal apps. I've had no luck trying to get KM to even 'see' the SoundSource window.

Any help appreciated.

If you show an image of the app, I can probably give you advice. I'm quite experienced with Find Image, and if you show me the app, I can tell you the likelihood of Find Image working for that app.

There are different ways for KM to "detect" if an app is running. One of the most reliable is to have the user open the app with a hotkey. This has certain advantages. Sometimes KM's application trigger can be made to work. but sometimes you need to resort to polling (eg, either with Find Image or with a macOS command like 'ps'. But that should be your last resort.) I don't have SoundSource so I can't help determine which method would work best for you. However if you explain how you activate the app, I might be able to recommend a good solution.

It's not a window, it's a menu -- which is why you are having trouble "seeing" it in KM. You might be able to do something with KM and AppleScript's System Events, but...

SoundSource has excellent Shortcuts support, and KM can execute Shortcuts. Have you tried going down that route?

Sure.

In answer to @Nige_S as well, it is a menu-bar app and I utilise the built-in shortcuts to summon the menu. So in a way I do use keyboard shortcuts to open it, although not as an open-app action in KM. However I've mapped other keyboard shortcuts in KM to activate the app by just triggering the default hotkey (F8) . So double-tapping ⌥A or double-tapping ⌘. , and even a a trackpad gesture has an action to trigger pressing F8 ( which is Function+F8 on a macbook Pro). This is because the pinned menu keeps jumping out of focus and I lose control.

The goal would be to create macros that might first bring the menu to the front, select an app's volume slider and I would use Up/Down arrows to modify.

Doing all of this is probably because of a dissatisfaction with SoundSource's built-in shortcuts, which have you jumping all around the keyboard, although I am happy they exist. There are Siri Shortcuts that will help me but I'm yet to investigate them and I'd be concerned bringing yet another 3rd party app will just slow things down.

I tried OCR to detect the top left corner of the menu, but I couldn't get a stable return as 'true' after trying all sorts of options that I don't fully understand.

Thanks for your help.