自定义 CommandOrControl+W,关闭窗口会导致错误

自定义 CommandOrControl+W,关闭窗口会导致错误
This commit is contained in:
woojufon 2021-11-22 15:04:22 +08:00 committed by GitHub
parent b198288c7f
commit 4a2b2ab82d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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