Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding tabs to a window with no titlebar

I am trying to add tabs to a window with no titlebar. Setting self.titlebarAppearsTransparent = true or disabling the titlebar blocks system tabs, and I can't find any Safari style tabs in the object panel.

On a normal window, you can create tabs by making two windows and selecting Window > Merge All Windows

This can be seen below the default "Show, Minimize, Zoom" that Xcode makes.

Option shown Normal window, tabs can be created

On a borderless window, the option is not there and is not in first responder

Option not shown Borderless Window, Tabs are not allowed

On a window with a titlebarAppearsTransparent, the option is not there and is not in first responder.

Option not shown titlebarAppearsTransparent window, Tabs are not allowed

Without using Merge all Windows, there doesn't seem to be a builtin Safari style tab view. The tab view that is builtin uses system preferences style tabs and I am trying to get Safari/Finder/System style tabs. I don't want to use custom rendered tabs because they won't work and feel the same way the system tabs do.

like image 725
pfg Avatar asked Oct 17 '22 04:10

pfg


1 Answers

When window-tabbing is enabled, windows can be grouped in tabs as long as all share the same tabbingIdentifier. AppKit automatically calculates such identifiers based on some context inspection but ignores windows with the titlebarAppearsTransparent option set. Therefore just set your own tabbingIdentifier and you're happy to go. As a side-note: The user preferred tabbing behavior for newly created or opened documents can be set in System Preferences > Dock.

window.styleMask |= NSWindowStyleMaskFullSizeContentView;
window.titlebarAppearsTransparent = YES;
window.tabbingMode = NSWindowTabbingModeAutomatic
window.tabbingIdentifier = @"MyDocumentWindow";
like image 121
berbie Avatar answered Oct 21 '22 07:10

berbie