Hello, I've got tired of getting constantly switched to electron app window after I run npm run dev or make some changes in source code. Is there some way to disable this behaviour?
System
@imomaliev
You can simply change the BrowserWindow API used to mainWindow.showInactive() and set show to false in the constructor options.
https://electron.atom.io/docs/api/browser-window/#winshowinactive
src/main/index.js
mainWindow = new BrowserWindow({
height: 563,
useContentSize: true,
width: 1000,
// disable initial window from showing
show: false
})
// load page with url
mainWindow.loadURL(winURL)
// show window without setting focus
mainWindow.showInactive()
Hope this helps.
@SimulatedGREG Thank you! That helped. I'm learning so much)
No problem. Glad to help 馃槃
@imomaliev
You can simply change the
BrowserWindowAPI used tomainWindow.showInactive()and setshowtofalsein the constructor options.electron.atom.io/docs/api/browser-window/#winshowinactive
src/main/index.js
mainWindow = new BrowserWindow({ height: 563, useContentSize: true, width: 1000, // disable initial window from showing show: false }) // load page with url mainWindow.loadURL(winURL) // show window without setting focus mainWindow.showInactive()Hope this helps.
@SimulatedGREG what if we want to make the window visible but don't want the window to grab focus ?
@SimulatedGREG what if we want to make the window visible but don't want the window to grab focus ?
Actually with showInactive() it does get visible and does not grab the focus.
Most helpful comment
@imomaliev
You can simply change the
BrowserWindowAPI used tomainWindow.showInactive()and setshowtofalsein the constructor options.https://electron.atom.io/docs/api/browser-window/#winshowinactive
src/main/index.js
Hope this helps.