Skip to content

fix(windows): capsule/qa 透明窗口 Acrylic 兜底 - #487

Merged
appergb merged 2 commits into
betafrom
fix/windows-acrylic-capsule-qa
May 18, 2026
Merged

fix(windows): capsule/qa 透明窗口 Acrylic 兜底#487
appergb merged 2 commits into
betafrom
fix/windows-acrylic-capsule-qa

Conversation

@appergb

@appergbappergb commented May 18, 2026

Copy link
Copy Markdown
Collaborator

问题

Windows Beta 1.3.4-4 上录音胶囊 (capsule) 和 QA 浮窗 (qa) 几乎完全透明,桌面壁纸直接透出,内容看不清。macOS 正常。

根因

tauri.conf.json 中 main / capsule / qa 三个窗口都设了 transparent: true,但 src-tauri/src/lib.rs 只对 main 窗口调用了 apply_mica。Webview2 的 backdrop-filter 只能模糊页面内部 DOM,无法模糊 OS 桌面(与 macOS WKWebView + NSVisualEffectView 行为有本质差异)。Capsule.tsx 的 rgba(255,255,255,0.85) + backdrop-filter: blur(28px) 在 Windows 上等于纯 0.85 alpha 透到桌面壁纸。

修复

lib.rs 的 capsule 和 qa 窗口初始化块里,Windows 下追加 Acrylic:

#[cfg(target_os = "windows")]{use window_vibrancy::apply_acrylic;ifletErr(e) = apply_acrylic(&capsule,Some((30,32,38,140))){
log::warn!("[capsule] acrylic failed: {e}");}}

选 Acrylic 而非 Mica 因为 Acrylic 支持 Win10,Mica 仅 Win11 22H2+。颜色 (30, 32, 38, 140) 偏冷深灰,alpha 140 在建议范围中段。失败仅 log::warn 不 panic。

macOS 路径完全不动。

关于 CSS 兜底

最初的版本附带了 @supports not (backdrop-filter)prefers-reduced-transparency 两条全局 CSS fallback。本地代码审查指出 html, body 选择器过宽,在 macOS reduce-transparency 模式下会波及 main 窗口的 Vibrancy。

再分析后两条规则其实都是"几乎不会触发"的防御代码:现代 Webview2 / WKWebView / Chromium 都原生支持 backdrop-filter;macOS 系统 reduce-transparency 已经在 OS 层中和了 Vibrancy 不需要 CSS 再补一刀。已在第二个 commit 中删除,PR 现在只保留 Rust 侧 Acrylic 这一处变更,scope 更干净。

已知遗留

  • Capsule.tsx:261 仍是 rgba(255,255,255,0.85) inline。预期 Acrylic 兜底足够;若实测仍不清需要单独 PR 调 alpha
  • main 窗口仍用 Mica。Win10 用户主面板会偏透;若问题确认存在,后续 PR 给 main 也加 Acrylic 作为 Mica fallback
  • Acrylic 在 Win10 v1903+ 拖动有卡顿。胶囊小尺寸固定位置,理论影响很小

本地审查结论

  • code-reviewer: REQUEST_CHANGES → APPROVE (CSS 移除后)
  • Rust API 签名 / 插入位置 / 错误处理 / 平台隔离 全部通过
  • cargo check 无新增 warning
  • github-actions pr_agent_job: "No major issues detected"

Test plan

  • Windows 11 实机:capsule 录音时背景磨砂可见
  • Windows 11 实机:QA 浮窗背景可读
  • Windows 10 实机:Acrylic 是否生效(关键测试,因为 Mica 不支持)
  • macOS 回归测试:capsule / qa 视觉无变化
  • 拖动 / 多屏切换:无明显卡顿

🤖 Generated with Claude Code

根因: tauri.conf.json 三个窗口都 transparent: true,但 lib.rs 只对 main
窗口调用 apply_mica。capsule / qa 在 Windows 上是裸 transparent,
Webview2 的 backdrop-filter 只能模糊页面内部 DOM 不能模糊 OS 桌面,
导致用户看到的胶囊 / QA 浮窗几乎完全透出桌面壁纸。
macOS 上 NSVisualEffectView (HudWindow vibrancy) 直接由系统合成器
混合桌面,所以 macOS 不需要额外处理。
修复:
1. lib.rs 在 setup 时对 capsule / qa webview 调用 apply_acrylic(
color=(30,32,38,140)) — 选 Acrylic 而非 Mica 因为 Acrylic 支持
Win10,更适合小浮窗。失败仅 log::warn 不 panic。
2. global.css 末尾追加 @supports not (backdrop-filter) 和
@media (prefers-reduced-transparency: reduce) 兜底,给 html/body
设实色背景。组件层 inline style 无法被覆盖,这只是二级防护。
Note: Capsule.tsx 和 FloatingShell.tsx 的 inline alpha 保留不动;
Acrylic 兜底通常足够。如果 Win10 实测仍偏透(Mica 不支持 Win10),
后续 PR 可考虑给 main 也加 Acrylic 作为 Mica fallback。
@github-actions

github-actionsBot commented May 18, 2026

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

(Review updated until commit d357d68)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

Local code review flagged that `html, body { background: ... }` applies
to ALL windows including `main`, which would clobber the macOS
NSVisualEffectView vibrancy in `prefers-reduced-transparency: reduce`
mode.
Re-analysis confirms both rules are speculative:
- @supports never fires on modern Webview2 / WKWebView / Chromium
(all support backdrop-filter)
- prefers-reduced-transparency triggers OS-level vibrancy neutralization
on macOS already, but the CSS rule would still wrongly land on main
Acrylic in lib.rs is the canonical fix for the user-reported P0
(capsule/qa 透明遮罩看不清). The CSS layer is dropped to keep the PR
scoped to a single concern and avoid the cross-window collateral.
Refs review of #487
@github-actions

Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit d357d68

@appergbappergb changed the title fix(windows): capsule/qa 透明窗口 Acrylic 兜底 + CSS 可读性兜底fix(windows): capsule/qa 透明窗口 Acrylic 兜底May 18, 2026
@appergb

Copy link
Copy Markdown
CollaboratorAuthor

@claude 请审核此 PR。如有问题请逐条列出(CRITICAL / HIGH / MEDIUM);如全部通过请明确说 LGTM。

@claude

claudeBot commented May 18, 2026

Copy link
Copy Markdown

Claude finished @appergb's task in 1m 59s —— View job


PR 审核报告

PR #487 — fix(windows): capsule/qa 透明窗口 Acrylic 兜底

  • 读取仓库指引 (CLAUDE.md)
  • 读取变更文件 (lib.rs, global.css, Cargo.toml)
  • 检查 git diff (origin/beta...HEAD)
  • 完成审核

结论:LGTM(附 2 条 MEDIUM 说明)

未发现 CRITICAL 或 HIGH 级别问题。核心 Rust 改动正确,平台隔离干净,错误处理符合规范。以下两条 MEDIUM 供参考,均不阻塞合并。


MEDIUM — M1:QA 窗口由前端 agent 动态创建时 Acrylic 不生效

文件:lib.rs:152–171

ifletSome(qa) = app.get_webview_window("qa"){// Acrylic 在这里应用}else{
log::info!("[qa] qa 窗口未在 tauri.conf.json 中声明,前端 agent 会补上");}

setup hook 只在启动时执行一次。如果 qa 窗口由前端 agent 在启动后动态创建(而非预先声明在 tauri.conf.json),这里的 apply_acrylic 不会被调用,QA 浮窗在 Windows 上仍会透到桌面。

PR 描述里已明确"前端 agent 负责声明 label="qa" 的窗口",且已知遗留部分未提及此场景,说明作者有意接受此限制。如果 qa 目前已确保在 tauri.conf.json 中静态声明,此条无需处理。 若后续切换为动态创建,需在创建事件 (WindowEvent::Created 或 Tauri 2.x 的 on_webview_event) 中补调 apply_acrylic

Fix this →


MEDIUM — M2:global.css 变更仅含末尾空行

文件:openless-all/app/src/styles/global.css 末行

diff 显示 + 一个空行(无内容)。这是纯格式变更,功能无影响,但与 PR 标题不符,建议后续清理或确认是格式化工具生成的。


其余检查项 — 全部通过 ✓

检查点结论
window-vibrancy 依赖已声明Cargo.toml:104window-vibrancy = "0.7"cfg(any(windows, macos)) 下,正确
#[cfg(target_os = "windows")] 平台隔离capsule 和 qa 两处均正确包裹,macOS 路径不受影响
API 签名apply_acrylic(&window, Some((r,g,b,a)))window-vibrancy 0.7 签名吻合
错误处理Err(e)log::warn!,不 panic,不阻塞窗口 hide/show 流程
调用时机apply_acrylichide() 之前执行;DWM 属性在窗口可见状态变更后仍保留,与 apply_mica 的现有模式一致
Acrylic 颜色 (30,32,38,140)alpha 140/255 ≈ 55%,在 Win10 Acrylic 建议区间内;深冷灰与胶囊白底叠合可读性合理
Acrylic vs Mica 选型Acrylic 支持 Win10 v1803+,Mica 仅 Win11 22H2+;选型正确
main 窗口不受影响仍走 apply_mica,未动
macOS 回归风险为零,两个 #[cfg(windows)] 块在 macOS 编译单元中完全剔除

综合:无阻塞性问题,可合并。 M1 是已知配置约束,M2 是无害的空行。两条均建议但不强制在本 PR 修复。

@appergb
appergb merged commit 6e55e30 into betaMay 18, 2026
4 checks passed
@appergb
appergb deleted the fix/windows-acrylic-capsule-qa branch May 18, 2026 10:57
appergb pushed a commit that referenced this pull request May 18, 2026
包含 PR #487 / #488 / #489 三个修复,供 Windows 实机验证:
- #489 快捷键二次按键失效(toggle/stop 失灵,只能 ESC)
→ coordinator.rs hotkey_bridge_loop 改 block_on 顺序 await
- #487 capsule/qa 透明遮罩看不清
→ lib.rs Windows 下追加 apply_acrylic 兜底
- #488 autostart catch fall-through 复活主窗口(#468 残留)
→ App.tsx catch 加 return + 改善 warn 诊断
appergb pushed a commit that referenced this pull request May 18, 2026
…v 安装
v1.3.4-4 / -5 的 Linux 构建在 "Build fcitx5 plugin" 步骤连挂两次,
错误一致:"E: Unable to locate package fcitx5-dev"。同一 job 前面的
"Install Linux bundle deps" 步骤明明已经 apt-get update + 装好了一堆
universe 包,到 fcitx5 这步突然找不到 —— 表象与 GitHub Actions
ubuntu-22.04 runner 镜像弃用过渡期里 apt 元数据漂移的现象一致。
release-tauri.yml "Build fcitx5 plugin" 步骤增加三层防御:
1) sudo add-apt-repository -y universe(已启用则 no-op)
2) 本步骤内重新 sudo apt-get update,独立于上游 step 缓存
3) 安装失败时打印 apt-cache policy / search / os-release / sources.list.d
便于以后排查
同 commit 同时 bump 五处版本到 1.3.4-6 重发,让 PR #487/#488/#489
三个 Windows P0 修复带上 Linux 包一起进 Beta 通道。
@HKLHaoBinHKLHaoBin mentioned this pull request May 18, 2026
9 tasks
appergb pushed a commit that referenced this pull request May 19, 2026
* chore(ci): nudge Actions to index release workflow on fork
Co-authored-by: Cursor <cursoragent@cursor.com>
* chore(ci): nudge Actions to index release workflow on fork
Co-authored-by: Cursor <cursoragent@cursor.com>
* chore(ci): nudge Actions to index release workflow on fork
Co-authored-by: Cursor <cursoragent@cursor.com>
* chore(ci): nudge Actions to index release workflow on fork
Co-authored-by: Cursor <cursoragent@cursor.com>
* chore: add CapsWriter to .gitignore for local voice inference reference
* fix(windows): revert capsule/qa Acrylic to remove dark host rect
Reverts the apply_acrylic blocks from #487. Full-window Acrylic
tinted the 220×84 capsule hitbox, causing a visible dark rectangle
around the pill on light backgrounds.
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
appergb pushed a commit that referenced this pull request May 19, 2026
…crylic 回退
回退 #487 引入的 Windows capsule/QA 浮窗 apply_acrylic 调用 (PR #496),
解决浅色背景下 220×84 胶囊出现深色矩形的视觉 bug。
本次只动版本号,不携带其他逻辑改动。
appergb pushed a commit that referenced this pull request May 22, 2026
首个 1.3.4 正式版,汇总 1.3.4-1 → 1.3.4-12 Beta 周期全部改动(自 v1.3.2-tauri)。
主要内容:
- Windows:静默启动前端兜底、hotkey toggle 二次按键修复、IME 切回、
capsule/QA 透明窗口 Acrylic 兜底、流式 SendInput 节流、IME 提交超时缩短
(#466#468#469#470#487#489#491 等)
- Linux:fcitx5 包名拆分 / 安装前缀修复、主窗口控件修复(#517)
- ASR:智谱批量 ASR 分片与 endpoint 修复、新增更大的 Foundry Whisper 模型
(#507#508#511)
- UI:多语言文案精简、SavedToast 统一定位、设置/风格/市场界面与图标重构、
划词追问框与语音胶囊磨砂玻璃质感、更新/登录/网络检测/市场加载修复
本次只动版本号,逻辑改动已在上述 Beta 周期 PR 落盘。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@appergb