Search code examples
macosiconsmenubardock

Menu Bar app being launched by Dock Icon (Mac OS X)


I'm working on a Menu Bar app and I've added the LSUIElement so the icon won't appear in the dock when the app is in use (And also to remove the File, Edit, View etc at the left of the menu bar).

The problem is that I want the app to be launched by the Icon and by adding the LSUIElement the only way to luanch the app is thru xcode.

I've seen that in the Mac app Caffiene it launches by the icon but it doesn't appear in the dock that it's running etc which is excatly what I want/need.

So I was wondering if you guys know how to do this.

Thank you in advance!


Solution

  • If you want to have a dock icon but not show the app as running in the Dock, simply create two applications:

    Status Menu Application

    This is the actual application that sets up the menu and contains the application's logic. It has LSUIElement set.

    Launcher Application

    This application has a dock icon. It contains the status menu application in its bundle. Its sole job is to launch the status menu application and then quit itself.