Fix the next top-level window doesn't get focus when closing the main window in Windows

This commit is contained in:
Yuya Ochiai 2016-08-26 22:09:14 +09:00
parent 2458889a09
commit 7883693d73

View file

@ -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();
}