Reputation: 1542
I have a macOS Catalyst app that supports multiple windows, but it has built in tabs, and that's why I would like to disable the native Menu Bar's "Show Tab Bar" option.
As you can see on the image below, it's actually breaking my layout, and since my app will never use this feature I would like to get rid of it, is there a way to do this?
Here's the option I would like to completely disable:
Upvotes: 3
Views: 1617
Reputation: 5217
I came here looking for the answer in an AppKit app. Turns out you can do this in a Storyboard by selecting your NSWindow
instance and setting this value:
Here, set "Tabbing Mode" to "Disallowed" and those menu items (and that capability) are gone.
And of course, you can do this in code as well:
window.tabbingMode = .disallowed
Upvotes: 2
Reputation: 490
With Mac OS Monterey you can use the Window tab opt-out in Info.plist
called UIApplicationSupportsTabbedSceneCollection
<key>UIApplicationSceneManifest-macos</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
<key>UIApplicationSupportsTabbedSceneCollection</key>
<false/>
</dict>
Source - WWDC 21 Presentation: What's new in Mac Catalyst (@7:45)
Upvotes: 2
Reputation: 5145
This is the solution I was given by an Apple developer last summer, which calls an AppKit method to disable tabs and the menu items:
Class _nswindow = NSClassFromString(@"NSWindow");
[_nswindow setAllowsAutomaticWindowTabbing:NO];
You need to do the ugly NSClassFtomString thing because AppKit is not available in Catalyst, but it’s okay to ship an app that does this (I do).
Oh and that’s Objective-C not Swift, obviously. Calling “private” API from Swift is tricky; I recommend either bridging to use ObjC or using the Dynamic library like so: Dynamic.NSWindow.setAllowsAutomaticWindowTabbing(false)
.
Upvotes: 4