Browse Source

退出到托盘

tags/v1.0.0
3136352472 5 years ago
parent
commit
b629d2ac96
  1. 11
      lib/main.js
  2. 2
      lib/tray.js

11
lib/main.js

@ -23,9 +23,12 @@ exports.createMainWindow = function () {
exports.MainWindow.hide(); 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();
}
})
} }

2
lib/tray.js

@ -234,7 +234,7 @@ ipcMain.on('put-in-tray', (event) => {
}, { }, {
label: "退出", label: "退出",
click: function () { click: function () {
mainwin.MainWindow.isClose = true;
app.quit() app.quit()
} }
}))) })))

Loading…
Cancel
Save