I found this project which works almost perfectly as a base for what I'm trying to do https://github.com/shpakovski/Popup. It places an icon at the menu bar which when clicked displays a popup. The popup internal NSWindow is controlled by its delegate which is called PanelController. It's delegate methods are executed most of the time as it is expected, for example, the (void)windowDidResignKey:(NSNotification *)notification is executed when I click almost anywhere. Though, it is not executed the first time I click another item of the menu bar, for example the skype item. This is what I get:
Any ideas on which NSWindow delegate method am I missing to intercept that first click on another menu bar item?