Search code examples
objective-ccocoastatusbarmenubarstatusbaritem

is it possible to draw on menubar (not statusbar area)?


Is it possible to place a custom NSView on top of the menubar? I need to have a view permanently visible, as like in the statusbar, but need more real estate. BTW is the real estate of an NSStatusbarItem limited?


Solution

  • A status item can be as big as it needs to be, but menus always take precedence—if the menus and the status bar overlap, the menus will temporarily hide as many status items as necessary from the status bar, to be automatically re-shown once there's space again. This is by design; there is no way for you to defeat that.

    You should either only show things that are worth showing, or enable the user to decide what things are worth showing and only show the ones the user chose.

    If the user switches to an application with enough menus to suppress your status item, they'll just have to deal with that on their own (either by adjusting the order in which they launch status-item applications, so that yours launches earlier and thus is farther right in the status bar, or by switching to another app with fewer menus in order to use your status item).