MacOS app as background process with system tray icon and native menu…

Right, so a few things going on here. My current goal is to create an app which sits in the background listening to midi input. It will have a couple of basic settings which I want to be accessible via a native menu attached to a SystemTrayIconComponent. Sounds doable.

I started by creating an audio application in the Projucer.

Here are my issues:

  1. I don’t need the app to have any form of main window, and no dock icon. It will live entirely in the taskbar, with no main menu. I’m able to remove the dock icon via Process::setDockIconVisible (false) but this still allows the app to be brought to the foreground when the SystemTrayIconComponent is clicked, thus showing a bare bones main menu.
    Edit: this is solved by getting rid of the automatically created main document window. Duh.

  2. I’m getting an assert when trying to show the native system tray menu. In my overridden mouseDown method I’m creating a PopupMenu and calling SystemTrayIconComponent::showDropdownMenu. The assert I’m getting occurs in juce_mac_MainMenu::createNSMenu, where I’m informed I’m "calling this before making sure the OSX main menu stuff was initialised?" Hmm… I don’t even want a main menu?

  3. I’m not very good at troubleshooting this myself. Someone please help :slight_smile:

Thanks in advance!