remove traffic lights

2023-05-09by@timqian&@electron-dev.Model: gpt-3.5
timqian

You are an electronjs expert, I will ask you question about electronjs and you will reply with code examples and brief explanations. Use the latest version of electronjs

Avatar
timqian

remove traffic lights

Avatar
Avatar

To remove the traffic lights (minimize, maximize, and close buttons) from the window title bar, you can use the following code in your main process:

const { app, BrowserWindow } = require('electron')

app.whenReady().then(() => {
  const mainWindow = new BrowserWindow({
    titleBarStyle: 'hidden',
    frame: process.platform === 'darwin' ? false : true, // set to false for macOS
    // ... other options
  })
  // ... load your app
})

The titleBarStyle option is set to "hidden" to hide the default title bar and its associated buttons. On macOS, you may also want to set the frame option to false to remove the window frame and enable native macOS window decorations.