Fix the next top-level window doesn't get focus when closing the main window in Windows
This commit is contained in:
parent
2458889a09
commit
7883693d73
10
src/main.js
10
src/main.js
|
@ -415,20 +415,24 @@ app.on('ready', function() {
|
|||
}
|
||||
else { // Minimize or hide the window for close button.
|
||||
event.preventDefault();
|
||||
const hide_window = (window) => {
|
||||
window.hide();
|
||||
window.blur(); // To move focus to the next top-level window in Windows
|
||||
};
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
mainWindow.hide();
|
||||
hide_window(mainWindow);
|
||||
break;
|
||||
case 'linux':
|
||||
if (config.minimizeToTray) {
|
||||
mainWindow.hide();
|
||||
hide_window(mainWindow);
|
||||
}
|
||||
else {
|
||||
mainWindow.minimize();
|
||||
}
|
||||
break;
|
||||
case 'darwin':
|
||||
mainWindow.hide();
|
||||
hide_window(mainWindow);
|
||||
if (config.minimizeToTray) {
|
||||
app.dock.hide();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue