简体   繁体   中英

flashFrame: false on Electron app don't work

I´m trying to make my Electron app don't flash the frame when are minimized, because all times when it are minimized, it flash the frame, and some times, if I dont have focus in other program, it reopen automatically. I just want it to stop flash the frame.

This happens all times: 闪光灯架打开 闪光灯关闭

Here is my main.js file:

function createWindow() {
  mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    show: false,
    titleBarStyle: 'hidden',
    flashFrame: false                        //I TRIED THIS
  })
  mainWindow.flashFrame(false)               //I TRIED THIS
  splash = new BrowserWindow({
    width: 800,
    frame: false,
    height: 600
  })
  splash.loadURL(`file://${__dirname}/splash.html`);
  mainWindow.loadURL(url.format({
    pathname: path.join(__dirname, 'index.html'),
    protocol: 'file:',
    slashes: true
  }))

  var myVar = setInterval(dentroyWindows, 3000)
  function dentroyWindows() {
    splash.destroy()
    mainWindow.show()
  }

  mainWindow.on('closed', function () {
    mainWindow = null
  })
}

app.on('ready', createWindow)

app.on('activate', function () {
  if (mainWindow === null) {
    createWindow()
  }
})

app.on('browser-window-created', function (e, window) {
  window.setMenu(null);
  window.flashFrame(false);                  //I TRIED THIS
});

First things first, flashFrame is not an option in the Electron API so it will not do anything:

mainWindow = new BrowserWindow({
  ...
  flashFrame: false
})

because all times when it are minimized, it flash the frame, and some times, if I dont have focus in other program, it reopen automatically.

This is not normal behaviour. Flashing of the taskbar will only happen if show() or focus() or restore() are called or your app is getting focus through some other means. Without a repository that reproduces this behaviour it will be very hard for anybody to advise on a fix.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM