You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently a user can set window.nativeTabs but to be able to create such tabs there's only these options:
Set "Prefer tabs" to "Always" in the global macOS settings. This works because if window.nativeTabs is set to true, VS Code sets tabbingIdentifier, which causes macOS to open in a native tab when the global option is set.
Call the workbench.action.newWindowTab command, also accessible by menu with Window -> New Tab (see Add a command to open a new window as tab (Sierra tabs) #25919). This causes VS Code to call addTabbedWindow to force opening in a tab regardless of the global macOS setting.
Both of these have drawbacks:
Setting the global option is not desirable for all users as this has global effect, for instance this causes Finder windows to always open in tabs.
Using the newWindowTab command does not work in the general case, for instance when using other commands or actions that open a new window.
Furthermore the current behavior is non-obvious as users expect enabling native tabs would immediately work for all actions that create a new window. It's not obvious users need to change the global setting, see #25919 (comment), and I saw other comments from confused users in other posts.
I think ideally setting window.nativeTabs to true should cause all new windows to open in tabs by default. Creating a new window would still be possible by first creating a new tab then dragging it out, same process as when the global macOS setting for tabs is set to "always". However I guess it's too late to change that behaviour so the next best thing would be to add a new setting.
The following patch works well for me. It calls addTabbedWindow() for all new windows if the window.openNewWindowsInNativeTabs is set:
diff --git a/src/vs/platform/windows/electron-main/windowsMainService.ts b/src/vs/platform/windows/electron-main/windowsMainService.ts
index 594b8364353..04547d828f1 100644
--- a/src/vs/platform/windows/electron-main/windowsMainService.ts+++ b/src/vs/platform/windows/electron-main/windowsMainService.ts@@ -1529,9 +1529,10 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
});
mark('code/didCreateCodeWindow');
// Add as window tab if configured (macOS only)
- if (options.forceNewTabbedWindow) {+ const forceNewTabbedWindow = this.configurationService.getValue<boolean>('window.openNewWindowsInNativeTabs')+ if (forceNewTabbedWindow || options.forceNewTabbedWindow) {
const activeWindow = this.getLastActiveWindow();
activeWindow?.addTabbedWindow(createdWindow);
}
I'd be happy to send a PR with a properly documented setting if you're interested.
Currently a user can set
window.nativeTabsbut to be able to create such tabs there's only these options:Set "Prefer tabs" to "Always" in the global macOS settings. This works because if
window.nativeTabsis set totrue, VS Code setstabbingIdentifier, which causes macOS to open in a native tab when the global option is set.Call the
workbench.action.newWindowTabcommand, also accessible by menu with Window -> New Tab (see Add a command to open a new window as tab (Sierra tabs) #25919). This causes VS Code to calladdTabbedWindowto force opening in a tab regardless of the global macOS setting.Both of these have drawbacks:
Setting the global option is not desirable for all users as this has global effect, for instance this causes Finder windows to always open in tabs.
Using the
newWindowTabcommand does not work in the general case, for instance when using other commands or actions that open a new window.Furthermore the current behavior is non-obvious as users expect enabling native tabs would immediately work for all actions that create a new window. It's not obvious users need to change the global setting, see #25919 (comment), and I saw other comments from confused users in other posts.
I think ideally setting
window.nativeTabstotrueshould cause all new windows to open in tabs by default. Creating a new window would still be possible by first creating a new tab then dragging it out, same process as when the global macOS setting for tabs is set to "always". However I guess it's too late to change that behaviour so the next best thing would be to add a new setting.The following patch works well for me. It calls
addTabbedWindow()for all new windows if thewindow.openNewWindowsInNativeTabsis set:I'd be happy to send a PR with a properly documented setting if you're interested.