skip to Main Content

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?

Unnecessary tab bar

Here’s the option I would like to completely disable:

enter image description here

3

Answers


  1. 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).

    Login or Signup to reply.
  2. 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)

    Login or Signup to reply.
  3. 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:

    Properties for NSWindow showing "Tabbing Mode" set to "Disallowed"

    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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search