perf: 主窗口可以单独关闭到后台

This commit is contained in:
kuaifan 2022-11-10 14:34:52 +08:00
parent ae32b3c525
commit ed57411bbb

View File

@ -68,7 +68,7 @@ function createMainWindow() {
if (process.platform === 'win32') { if (process.platform === 'win32') {
mainWindow.hide() mainWindow.hide()
} else if (process.platform === 'darwin') { } else if (process.platform === 'darwin') {
app.hide() mainWindow.hide()
} else { } else {
app.quit() app.quit()
} }
@ -195,7 +195,11 @@ if (!getTheLock) {
} }
app.on('activate', () => { app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createMainWindow() if (BrowserWindow.getAllWindows().length === 0) {
createMainWindow()
} else if (!mainWindow.isVisible()) {
mainWindow.show()
}
}) })
app.on('window-all-closed', () => { app.on('window-all-closed', () => {