Cocoa Application with Menubar but no Dock Icon / switch menu
Posted
by Frank R.
on Stack Overflow
See other posts from Stack Overflow
or by Frank R.
Published on 2010-04-21T12:58:44Z
Indexed on
2010/04/22
0:23 UTC
Read the original article
Hit count: 669
Hi,
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
© Stack Overflow or respective owner