win.toggleTabBar() not working in electron

The documentation gives an option to show the tab bar (win.toggleTabBar()). But for the life of me, I'm just not able to make it work.

The doc says "Toggles the visibility of the tab bar if native tabs are enabled". What are native tabs? How do I enable them.

I want to be able to show the tab bar in electron.

1 answer

  • answered 2019-12-09 13:30 Jeremy Harris

    Per the docs:

    tabbingIdentifier String (optional) - Tab group name, allows opening the window as a native tab on macOS 10.12+. Windows with the same tabbing identifier will be grouped together. This also adds a native new tab button to your window's tab bar and allows your app and window to receive the new-window-for-tab event.

    This was added in 2017 to allow for "native tabs" in OSX. In order for it to work, you must pass a tabbingIdentifier when creating a new BrowserWindow.

    const { BrowserWindow } = require('electron')
    const win = new BrowserWindow({ 
       tabbingIdentifier: 'myTabs'