From 4a2b2ab82dc94edc073efebc4d46c9ad0573c583 Mon Sep 17 00:00:00 2001 From: woojufon Date: Mon, 22 Nov 2021 15:04:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=20CommandOrControl+?= =?UTF-8?q?W=EF=BC=8C=E5=85=B3=E9=97=AD=E7=AA=97=E5=8F=A3=E4=BC=9A?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 自定义 CommandOrControl+W,关闭窗口会导致错误 --- src/main/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/index.js b/src/main/index.js index 670709f..c5b02b3 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -58,6 +58,15 @@ class initApp { } else { readyFunction() } + // 自定义 CommandOrControl+W,关闭窗口会导致错误 + app.on("browser-window-focus", function () { + globalShortcut.register("CommandOrControl+W", () => { + const win = main.getWindow(); + if(win.isVisible()){ + win.hide(); + } + }); + }); } onRunning() {