diff --git a/electron-builder.yml b/electron-builder.yml index 39fd9242..d109f5e1 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -87,3 +87,4 @@ releaseInfo: Gemini 安全设置更新 @magicdmer 智能体页面性能优化 @magicdmer 修复 WebDAV 不能自动备份问题 + ⚠️ 如果不能自动更新,请手动下载安装包 diff --git a/src/main/services/WindowService.ts b/src/main/services/WindowService.ts index 2da6ee16..720fb877 100644 --- a/src/main/services/WindowService.ts +++ b/src/main/services/WindowService.ts @@ -14,7 +14,6 @@ export class WindowService { private static instance: WindowService | null = null private mainWindow: BrowserWindow | null = null private miniWindow: BrowserWindow | null = null - private isQuitting: boolean = false private wasFullScreen: boolean = false private selectionMenuWindow: BrowserWindow | null = null private lastSelectedText: string = '' @@ -199,30 +198,25 @@ export class WindowService { } private setupWindowLifecycleEvents(mainWindow: BrowserWindow) { - // 监听应用退出事件 - app.on('before-quit', () => { - this.isQuitting = true - }) - mainWindow.on('close', (event) => { - const notInTray = !configManager.getTray() + // 如果已经触发退出,直接退出 + if (app.isQuitting) { + return app.quit() + } - // Windows and Linux + // 没有开启托盘,且是Windows或Linux系统,直接退出 + const notInTray = !configManager.getTray() if ((isWin || isLinux) && notInTray) { return app.quit() } - // Mac - if (!this.isQuitting) { - if (this.wasFullScreen) { - // 如果是全屏状态,直接退出 - this.isQuitting = true - app.quit() - } else { - event.preventDefault() - mainWindow.hide() - } + // 如果是全屏状态,直接退出 + if (this.wasFullScreen) { + return app.quit() } + + event.preventDefault() + mainWindow.hide() }) }