From 7883693d737041af8db0e69a598ca88e224859e7 Mon Sep 17 00:00:00 2001 From: Yuya Ochiai Date: Fri, 26 Aug 2016 22:09:14 +0900 Subject: [PATCH] Fix the next top-level window doesn't get focus when closing the main window in Windows --- src/main.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main.js b/src/main.js index f6cd4688..96270f08 100644 --- a/src/main.js +++ b/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(); }