From c25a3065e199559b808c06069f7f6ebd5234e96a Mon Sep 17 00:00:00 2001 From: memorydream <34763046+memorydream@users.noreply.github.com> Date: Fri, 22 Oct 2021 16:51:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9C=A8windows=E5=92=8Clinux=E4=B8=AD?= =?UTF-8?q?=EF=BC=8C=E5=BD=93=E5=90=AF=E5=8A=A8=E7=AC=AC=E4=BA=8C=E4=B8=AA?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E6=97=B6=EF=BC=8C=E5=91=BC=E5=87=BA=E5=B7=B2?= =?UTF-8?q?=E7=BB=8F=E5=90=AF=E5=8A=A8=E7=9A=84=E7=AA=97=E5=8F=A3=20(#992)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 在windows和linux中,当启动第二个窗口时,呼出已经启动的窗口 * prettier code * change --- src/background.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/background.js b/src/background.js index 5f2946d..5efde71 100644 --- a/src/background.js +++ b/src/background.js @@ -86,7 +86,7 @@ class Background { }); this.neteaseMusicAPI = null; this.expressApp = null; - this.willQuitApp = isMac ? false : true; + this.willQuitApp = !isMac; this.init(); } @@ -387,6 +387,18 @@ class Background { // unregister all global shortcuts 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(); + } + }); + } } }