diff --git a/lib/main.js b/lib/main.js index 5d0bee3..5d85ae0 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,9 +23,12 @@ exports.createMainWindow = function () { exports.MainWindow.hide(); }); - // mainWindow.on("close",function(event){ - // event.preventDefault(); - // mainWindow.hide(); - // }) + exports.MainWindow.isClose = false; + exports.MainWindow.on("close", function (event) { + if (!exports.MainWindow.isClose) { + event.preventDefault(); + exports.MainWindow.hide(); + } + }) } diff --git a/lib/tray.js b/lib/tray.js index d0736a7..183ad58 100644 --- a/lib/tray.js +++ b/lib/tray.js @@ -234,7 +234,7 @@ ipcMain.on('put-in-tray', (event) => { }, { label: "退出", click: function () { - + mainwin.MainWindow.isClose = true; app.quit() } })))