fix: Linux Wayland 改用应用级自定义标题栏,绕过 GTK CSD 点击无响应问题#531
Merged
Conversation
KDE/Wayland 下 GTK Client-Side Decorations 的 minimize/maximize/close 按钮无法响应鼠标事件(tao#1218, tauri#9394)。此前尝试的 WebKit 环境变量 + async nudge resize 均不能可靠修复,最终方案参考 cc-switch,完全放弃系统装饰: - decorations: false → 应用级 WindowChrome 绘制 36px 拖拽栏 + 三键窗口控制 - transparent: true → 配合 CSS 磨砂玻璃背景 - WEBKIT_DISABLE_COMPOSITING_MODE + DMABUF_RENDERER 兜底 WebKit 合成异常 - async nudge(set_focus + ±1px resize)保留为辅助修复,防止 show() 后 webview surface 输入区域未初始化 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
PR Reviewer Guide 🔍(Review updated until commit a4705fa)Here are some key observations to aid the review process:
|
- 最大化状态同步:mount 后监听 tauri://resize 事件,每次 resize 都重新查询 isMaximized(),确保双击拖拽栏/键盘快捷键触发最大化时图标不脱节 - 按钮点击后 300ms 再次查询 isMaximized(),防止窗口管理器拒绝 toggle 时 状态错误 - 启动 nudge drift check:只修正 ±1px 的 nudge 产物,不再覆盖用户/合成器 的实质性窗口大小变化 - 还原误删的中文注释,移除冗余 closeBtn 常量,<style> 移到 WindowChrome 层级避免每个 LinuxTitlebar 实例重复注入 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Persistent review updated to latest commit a4705fa |
Contributor
Author
|
经过我的测试,这两个问题不存在 |
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
Summary
decorations: false+transparent: true,用 React 组件绘制应用级标题栏@tauri-apps/api/window的getCurrentWindow()控制窗口WEBKIT_DISABLE_COMPOSITING_MODE/DMABUF_RENDERER环境变量和 async nudge 作为辅助修复Changes
tauri.linux.conf.jsondecorations: false+transparent: trueWindowChrome.tsxLinuxTitlebar组件(动态 import Tauri API + 内联 SVG 图标)main.rslib.rsTest plan
🤖 Generated with Claude Code
PR Type
Bug fix, Enhancement
Description
Add Linux custom titlebar controls
Disable GTK decorations on Wayland
Set WebKit Linux compatibility env vars
Nudge WebView after initial show
Diagram Walkthrough
File Walkthrough
lib.rs
Add Linux post-show window nudgeopenless-all/app/src-tauri/src/lib.rs
main.show()main.rs
Set Linux WebKit compatibility variablesopenless-all/app/src-tauri/src/main.rs
WEBKIT_DISABLE_DMABUF_RENDERER=1on LinuxWEBKIT_DISABLE_COMPOSITING_MODE=1on Linuxtauri.linux.conf.json
Switch Linux window to frameless modeopenless-all/app/src-tauri/tauri.linux.conf.json
WindowChrome.tsx
Add Linux custom window titlebaropenless-all/app/src/components/WindowChrome.tsx
tauri://resize