“Minimize All” with NSBorderlessWindowMask
First, a rather long backstory: I’m working on creating a custom window design based on an NSBorderlessWindowMask-style NSWindow subclass, but I’m running into trouble recreating some of the basic window commands. I mainly followed this post on creating custom window shapes, and used the advice from Craig Hockenberry in the comments in order to get the “Close” and “Minimize” menu items to work correctly. The problem comes in when I try to do the “Minimize All” command (and, I suspect, eventually the “Zoom All” command).
It appears the obvious method to use, NSApplication’s -miniaturizeAll:, simply doesn’t work with NSBorderlessWindowMask-style windows, so that defeats that option pretty quickly. After discovering that, I set out to build my own version of the method that would work on my custom window subclass. To do so, I subclassed NSApplication and overrode -miniaturizeAll:, replacing it with a method that simply looped through the window array and called -miniaturize: on each window. For a long time, it appeared this method simply wasn’t working. I eventually tracked it down to the -miniaturize: call itself: even with no other inputs, this call was simply non-operable in my “Miniaturize All” method. Finally, I decided to try connecting the single-window “Minimize” menu item to my “Miniaturize All” method, and it worked (albeit with incorrect behavior; the windows minimized in order rather than simultaneously).
As far as I can tell (after more testing), -miniaturize: doesn’t like being triggered with the option-key modifier. My best guess is that it tries to be smart about it, and calls the (non-working) original -miniaturizeAll: method.
So, at last, my question: Is there a way to get the standard “Minimize All” menu item (command-option-M, simultaneous minimization) working with a custom NSBorderlessWindowMask-style window?