Default behavior: The option key forces a Tab
I have a document based macOS app, with a custom NSDocumentController
. The app can handle two types of documents, each with their own windows and views.
Now, if the user has turned off the option to always create Tabs in windows, cmd-N
will always create a fresh window.
And if the user types cmd-option-N
, the framework automatically creates a Tab inside the front window regardless of the global or app's tabbing preference. This requires no extra programming on my part.
So far, so good.
Now, I have a secondary document type that gets created by cmd-shift-N
. This creates, thanks to my custom DocumentController, a new window each time as well, as expected.
The challenge: Achieve the same with an additional modifier
I want the user to be able to type cmd-shift-option-N
to create a new Tab inside an existing document window, just like cmd-option-N
does for the primary document type.
However, it seems that the framework only handles a plain cmd-option-N
for auto-creating Tabs. For other modifier combinations (like here, with shift), this doesn't appear to work: If I have set up a menu only for cmd-shift-N
, then pressing cmd-shift-option-N
will just beep. And if I add an explicit menu for cmd-shift-option-N
, it creates a new window and not a Tab as desired.
So I need to emulate the behavior of turning the new document into a Tab instead of into a new Window. How do I do that, with the global tabbing more set to not create tabs?