Close button hides the app instead of minimizing#21
Merged
Merged
Conversation
…humbnail lingers, the Dock icon brings it back, and jobs keep running.
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.
背景
#18 把关窗改成了最小化到 Dock,任务不再被误杀,但留下两个观感问题:Dock 里挂着一个最小化的窗口缩略图;且部分场景下用户预期的是"窗口消失、点 Dock 图标回来"的标准 mac 行为。另外品牌化 viewer 有一个图标问题:真实客户端的 Info.plist 带 CFBundleIconName,macOS 会优先从编译的 Assets.car 取 Flet 原版图标,导致换上的 icns 不生效。
改动与实现
hide_viewer_app()):通过 NSRunningApplication 对 app 做 ⌘H 式隐藏——窗口消失、无缩略图、Dock 图标保留,点 Dock 由 macOS 自动 unhide,任务全程照跑。按品牌化/原版两个 bundle id 枚举所有实例逐一隐藏(开发重启后可能有残留副本,只挑第一个可能选错);不可用(非 macOS、找不到 viewer、AppKit 异常)一律返回 False,GUI 回退到原来的最小化BRAND_REVISION = 2进缓存目录名,强制已有副本重建并绕开 macOS 图标缓存flet[desktop]显式声明——裸flet时 flet-desktop 不进锁文件,严格uv sync会把 viewer 当孤儿卸掉;新增 macOS 限定的pyobjc-framework-cocoa验证
uv run pytest -q:144 passed / 6 skipped,新增图标键处理断言与hide_viewer_app安全降级测试(不存在的 bundle id → False,不抛异常)