Hide MAAttachedWindow when clicking outside
I'm using an MAAttachedWindow to display a custom window under a NSStatusItem in the Menubar. Everything works fine, but I can't find an easy way to hide it when the user clicks outside of the window. I want to implement this behavior because it's what the user expects. This is the code used to display the MAAttachedWindow : - (void)toggleAttachedWindowAtPoint:(NSPoint)pt { if (!self.attachedWindow) { self.attachedWindow = [[MAAttachedWindow alloc] initWithView:logView attachedToPoint:pt inWindow:nil onSide:MAPositionBottom atDistance:5.0]; [self.attachedWindow setLevel:kCGMaximumWindowLevel];