I have a foreground application that shows a NSStatusItem
along with a menu (via NSStatusItem setMenu:(NSMenu *)menu
). However, this menu does not display when I am looking at another app in fullscreen mode (say Safari) in Lion.
I know that I can make it work by setting NSBGOnly
to true in the Info.plist
file (or NSUIElement
), but both methods will make my app icon disappear from the task switcher as well as hide the main menu once I manage to focus my app.
Finally, I have tried setting NSUIElement
to true and do the following in my app upon startup (see also How to hide the Dock icon):
ProcessSerialNumber psn = { 0, kCurrentProcess };
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
This made the menubar appear again as well as the dock icon but the original problem (status item menu does not show up in another fullscreen app) is visible again. Whatever I try, I can't win.
Any suggestions would be highly appreciated!