4

This is yet one more of those "how to switch from running with a dock icon to running without one" questions with a twist.. I don't want the dock icon but I do want a menu bar when the application is at the front. Is that possible?

Running an application with LSUIElement set to 1 in the plist will launch the application without a dock icon, not showing up in the command-tab switch list and without a menu.

You can switch from that mode to the "normal" mode with all three switched on via SetSystemModeUI from 10.2 onwards and via NSApplication setApplicationActivationPolicy since 10.6, but crucially there is no way back to the previous mode (go figure).

So one way around this would be to launch with LSUIElement = 1 and then activate the menu bar when the application gets the focus and deactivate it on the application losing the focus.. alas I can't find a way of doing that.

Can anybody help?

Best regards,

Frank

Frank R.
  • 2,328
  • 1
  • 24
  • 44

2 Answers2

2

I too was looking for a solution, but it turned out to be quite simple: In the project file Info.plist need to add the key

"Application is agent (UIElement)" = YES

Sergey Sergeyev
  • 776
  • 8
  • 12
  • 1
    In fact you answer is right, you can have an full fledged UI app only accessible from menubar, not from dock icon. – Anoop Vaidya Mar 30 '18 at 17:50
0

Unfortunately, this is not possible. You can only transform the process type in one direction (from a background app to a foreground app) and not the other way.

Rob Keniger
  • 45,830
  • 6
  • 101
  • 134
  • I have an app that does exactly this on 10.9 and I'm finding that it's buggy. Once you transform the app to the front, the menu bar (File, Edit, View, etc) sometimes works and sometimes doesn't. You have to select another app, then go back to yours in order for the menu bar to show up. Intermittent. Best practice might be to not use the transform trick. – Bryan Oct 10 '13 at 19:50