feat(窗口管理): 添加系统托盘功能并优化窗口关闭行为

- 新增 TrayService 实现系统托盘功能
- 主窗口关闭时默认隐藏而非退出
- 添加 window_zoom 配置项支持窗口缩放
- 引入 TrayServiceToken 作为依赖注入标识
- 通过 isQuitting 状态控制应用退出行为
This commit is contained in:
Linkon
2026-01-18 22:06:28 +08:00
parent e9f994b511
commit f57597ca57
7 changed files with 83 additions and 2 deletions
+8
View File
@@ -76,6 +76,14 @@ export class WindowManager extends Service {
win.webContents.setZoomFactor(zoom)
this.windows.set(input.key, win)
win.on('close', (event) => {
if (!this.mainCtx.isQuitting && input.key === 'main') {
event.preventDefault()
win.hide()
}
})
win.on('closed', () => {
this.windows.delete(input.key)
})