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() {