Fix that the hidden main window doesn't appear when clicking toast notifications in Windows 10

Only in Windows 10, focus() was used to keep aero snap state.
This commit is contained in:
Yuya Ochiai
2016-07-07 22:10:44 +09:00
parent 35a8e1b0d9
commit b13a5ab687

View File

@@ -107,12 +107,18 @@ notification.override({
},
// Show window even if it is hidden/minimized when notification is clicked.
onclick: function() {
const currentWindow = electron.remote.getCurrentWindow();
if (process.platform === 'win32') {
// show() breaks Aero Snap state.
electron.remote.getCurrentWindow().focus();
if (currentWindow.isVisible()) {
currentWindow.focus();
}
else {
currentWindow.show();
}
}
else {
electron.remote.getCurrentWindow().show();
currentWindow.show();
}
ipc.sendToHost('onNotificationClick');
}