Repository navigation
feat(tray): add option to minimize to system tray on window close - #7
Open
heartacker wants to merge 1 commit into
Open
heartacker wants to merge 1 commit into
heartacker wants to merge 1 commit into
Conversation
- 新增 ApplicationSettings.MinimizeToTrayOnClose 配置项(默认开启),用于控制关闭主窗口时是否最小化到通知栏 - MainWindow 重写 OnClosing,依据设置与关闭原因(排除应用退出/系统关机)拦截关闭并隐藏窗口到托盘,新增 PrepareForExit 允许显式退出真正关闭窗口 - App 托盘菜单文案接入 LocalizationService 并随语言切换动态刷新;"退出"菜单与 ShutdownRequested 时先调用 PrepareForExit 再关闭;新增 HasActiveTrayIcon 判断托盘可用状态 - ShowMainWindow 及窗口激活逻辑优化:窗口隐藏时先 Show 再激活,恢复正常显示 - ApplicationSettingsPage/ApplicationSettingsWindow 设置页新增"窗口"分组及"关闭主窗口时最小化到通知栏"复选框(仅 Windows 显示) - ApplicationSettingsViewModel 新增 MinimizeToTrayOnClose 可观察属性,变更即持久化,并补充 IsMinimizeToTrayOnCloseSupported 平台判断 - LocalizationService 新增中英文文案:ApplicationSettings.Window、ApplicationSettings.MinimizeToTrayOnClose、Tray.ShowWindow、Tray.Exit - OnLoaded 中的启动逻辑(RDP 冒烟、命令行启动处理、会话管理器显示、自动更新检查)改为仅首次加载执行,避免重复触发;CommandLineHandoffServer 释放移至 Closed 事件 - 补充单元测试:MinimizeToTrayOnClose 默认值与持久化行为、ShouldMinimizeToTrayOnClose 针对不同关闭原因与守卫条件的判定逻辑
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add an application setting to minimize CxShell to the system tray instead of exiting when closing the main window.
Included Commits
feat(tray): 新增关闭主窗口时最小化到通知栏设置