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

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

* prettier code

* change
master
memorydream 3 years ago committed by GitHub
parent 9d18ad51f6
commit c25a3065e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

Loading…
Cancel
Save