fix: 在windows和linux中,当启动第二个窗口时,呼出已经启动的窗口 (#992)

* fix: 在windows和linux中,当启动第二个窗口时,呼出已经启动的窗口

* prettier code

* change
This commit is contained in:
memorydream 2021-10-22 16:51:04 +08:00 committed by qier222
parent 22aa51a1e6
commit 822505e31c
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D

View file

@ -86,7 +86,7 @@ class Background {
}); });
this.neteaseMusicAPI = null; this.neteaseMusicAPI = null;
this.expressApp = null; this.expressApp = null;
this.willQuitApp = isMac ? false : true; this.willQuitApp = !isMac;
this.init(); this.init();
} }
@ -387,6 +387,18 @@ class Background {
// unregister all global shortcuts // unregister all global shortcuts
globalShortcut.unregisterAll(); globalShortcut.unregisterAll();
}); });
if (!isMac) {
app.on('second-instance', (e, cl, wd) => {
if (this.window) {
this.window.show();
if (this.window.isMinimized()) {
this.window.restore();
}
this.window.focus();
}
});
}
} }
} }