fix(window): 恢复 macOS 原生交通灯#197
Merged
Merged
Conversation
…ndows Keep custom chrome on non-mac platforms while restoring native traffic lights on macOS. Also remove the extra outer mac shell radius/border to avoid double-rounded corners. Constraint: macOS must show native traffic lights for issue Open-Less#183 Constraint: Windows/Linux should keep custom titlebar behavior Rejected: set decorations=true in tauri.conf globally | enables native chrome on Linux Confidence: high Scope-risk: narrow Directive: Platform-specific window decoration behavior should be controlled at runtime, not by global config Tested: npm run build (openless-all/app) Not-tested: manual visual verification on real macOS/Linux/Windows runtimes
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
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.
User description
摘要
Fixes #183。
本 PR 修复 macOS 下窗口左上角原生红黄绿交通灯消失,以及窗口出现双重圆角的问题。
此前应用使用自定义窗口壳时,macOS 没有显示系统原生 traffic lights,导致窗口关闭 / 最小化 / 最大化按钮缺失或反馈不符合系统习惯。同时 macOS 外层 shell 仍保留额外圆角和边框,叠加原生窗口效果后会出现双重圆角观感。
本次改动在 macOS 运行时单独开启 native decorations,以恢复系统原生交通灯;Windows / Linux 仍保持现有自定义标题栏行为,不通过全局
tauri.conf打开 decorations,避免影响非 macOS 平台窗口样式。修复 / 新增 / 改进
macOS 主窗口运行时启用 native decorations:
不在
tauri.conf中全局开启 decorations:调整
WindowChrome的 macOS 外层样式:0none增加 native decorations 开启失败时的 warning 日志:
[main] enable native decorations failed: ...兼容
不包含:
对现有用户 / 本地环境 / 构建流程的影响:
测试计划
命令:
npm run build结果:通过
证据路径:
openless-all/app本地构建输出macOS 真机窗口视觉验证
Windows 真机窗口视觉验证
Linux 真机窗口视觉验证
说明:当前 commit 未做真实 macOS / Windows / Linux 运行时视觉回归验证。
主要改动文件
openless-all/app/src-tauri/src/lib.rsopenless-all/app/src/components/WindowChrome.tsx备注
本 PR 采用平台运行时分支处理窗口 decorations:只在 macOS 恢复 native traffic lights,不把该行为扩散到 Windows / Linux。这样可以同时修复 macOS 原生按钮缺失问题,并保留非 macOS 平台的自定义标题栏体验。
PR Type
Bug fix
Description
在 macOS 运行时为主窗口启用原生装饰,恢复系统交通灯按钮
移除 macOS 下自定义窗口壳的圆角和边框,消除双重圆角
添加
set_decorations失败时的警告日志保持 Windows/Linux 的自定义标题栏行为不变
Diagram Walkthrough
File Walkthrough
lib.rs
macOS 运行时启用原生窗口装饰openless-all/app/src-tauri/src/lib.rs
set_decorations(true)以启用系统原生交通灯set_decorations失败的warn日志,输出错误详情WindowChrome.tsx
移除 macOS 自定义窗口壳的圆角和边框openless-all/app/src/components/WindowChrome.tsx
shellRadius从 20 改为 0'none',移除原有 0.5px 深色边框