I am trying to create two windows from the main process. The second window should always be displayed on top of the first window. I read on the Electron website that you need to create a parent and child window for this. This is my code:
let win;
let child;
function createWindow(){
// Create the browser window.
win = new BrowserWindow({width: 1024, height: 768, show: false});
child = new BrowserWindow({parent: win});
child.show();
win.once('ready-to-show', () => {
win.show()
})
// and load the index.html of the app.
win.loadURL(`file:`);
// Emitted when the window is closed.
win.on('closed', () => {
win = null;
});
}
app.on('ready', createWindow);
When I run the program, it creates two windows, but the child window is not always on top. When I close the parent window (win), both windows close. How to make the child window always appear on top? I am using Fedora 24 with Gnome.
source
share