Search code examples
objective-cmacosstatusbar

Detect fullscreen menu bar movement


So right now I have an NSWindow that draws itself like an NSToolbar using INAppStoreWindow, and I was wondering if there was any kind of event or message sent out when the menu bar moves while the app is in full screen, so that I could then move the title bar of the window in response (the way a standard NSToolbar works). Clearly NSToolbar knows something that I don't, and it would save me from making an NSTrackingArea on the upper part of my window.

Here's what it does now:

Before

And here's what I'd like to do:

enter image description here

Unfortunately, KVO'ing a fullScreenAccessoryView does not work as well. Frame events are only generated when entering and exiting fullscreen mode, and not when the toolbar is "moved down" by the status bar.


Solution

  • How about this? Create NSStatusBarItem with a custom NSView having width 0 and then track its window's position using NSWindowWillMoveNotification.

    UPDATE: I made a fork of the INAppStoreWindow with a custom toolbar attached to the menubar. Check it out.