5

I have a macOS app that has a main menu in the menu bar (not an NSStatusItem). I would like this main menu to be visible when one of the app's windows is focused. However, I do not want this window to have a dock icon.

When I set LSUIElement to true, I notice that the menu bar never appears.

I have a feeling LSUIElement breaks the menu bar completely. Is there an alternative approach to giving an app menu bar menus without having a dock icon?

I'm on 10.14.3. What's strange is others seem to have success creating a menu bar in the app. But no matter how many times I focus my app, the menu bar does not appear.

setActivationPolcy(...) seems to prevent the main menu from appearing entirely. LSUIElement does not show the menu either.

Dany Joumaa
  • 2,030
  • 6
  • 30
  • 45
  • Possible duplicate of [Hiding the dock icon without hiding the menu bar](https://stackoverflow.com/questions/23313571/hiding-the-dock-icon-without-hiding-the-menu-bar) – Willeke Feb 26 '19 at 08:03
  • Hi @Willeke, after doing a little research, I realized that my menu bar is actually not appearing at all from the bundle where LSUIElement is set to true. (I confused it with a very similar looking menu coming from a different process). Do you know why LSUIElement might prevent the menu from showing entirely? – Dany Joumaa Feb 26 '19 at 18:03
  • 1
    **LSUIElement** tells Launch Services to run the app as an agent, which are run in the background with no Dock item or menu. Although a NSStatusItem can be used and they can put up a window, that is how they are supposed to work. You might take a look at using toolbar or popup button items in your window. – red_menace Feb 27 '19 at 02:48
  • Yeah -- seems like there was no way around it. I've worked around the issue entirely. Thank you! – Dany Joumaa Feb 28 '19 at 17:35

0 Answers0