feat(capsule): 录音胶囊样式可选(流光 Siri / Openless 默认)+ 修复 beta 构建破坏 - #887
Conversation
设置 → 录音与输入新增「胶囊样式」下拉(保留显示开关): - UserPreferences.capsule_style('siri' 默认 / 'classic')随 capsule:state payload 下发,切换后下一次录音即生效 - Capsule.tsx 双样式分支:siri 保留 SiriGL 光效舞台;classic 恢复 1.3.14 经典毛玻璃药丸(音量条 + 取消/确认按钮 + thinking 扫光 + 翻译徽章), 取消/确认改走 lib/ipc/dictation.ts,退出动画时长按样式区分 - 预览支持 ?style=classic;i18n 五语言新增胶囊样式文案
beta HEAD 在快捷键录入交互重构(e12c8dcc)合并后遗留的构建破坏: SelectionPolishSection 仍传已删除的 alignRecordButton / modifierPresets, tsc 直接报错。改为新 API(value 可空 + onReset 恢复默认快捷键, 等价于旧「启用」按钮),恢复 beta 可构建状态。
PR Reviewer Guide 🔍(Review updated until commit 215eef3)Here are some key observations to aid the review process:
|
- 经典样式(Openless 默认)下胶囊窗口长期 set_ignore_cursor_events(true) (纯光效舞台时代遗留),✕/✓ 按钮实际不可点。现在主线程闭包按 「classic && visible && 非选区润色 && 录音/转写/润色中」关闭鼠标穿透, 终态 toast / 隐藏 / Siri / 选区润色保持穿透;值不变时不重复调用 set_ignore_cursor_events - emit_capsule 在音频回调线程 ~30Hz 被调,原先直接读 prefs(整份克隆 + 偏好锁被 set() 跨磁盘 I/O 持有)。改为 Inner 上 AtomicU8 样式缓存, 主线程闭包每帧从 prefs 同步(与 show_capsule 同源读取),音频线程零开销 - 恢复「录音胶囊」行的 desc 文案(beta 原有,重构时被误删) - Capsule.tsx 退出动画注释同步为按样式区分的常量名
|
Persistent review updated to latest commit 1231453 |
|
Persistent review updated to latest commit 215eef3 |
#887 introduced desktop-only capsule cursor-passthrough logic into the unconditionally-compiled capsule_focus module, breaking Android cargo check (E0599: no method set_ignore_cursor_events on tauri::WebviewWindow). Gate the block to desktop; variables it consumes (classic_style, selection_polish, visible) are still used on mobile outside the block.
) * fix(less-computer): restore OpenCode model execution * fix(capsule): gate set_ignore_cursor_events behind #[cfg(not(mobile))] #887 introduced desktop-only capsule cursor-passthrough logic into the unconditionally-compiled capsule_focus module, breaking Android cargo check (E0599: no method set_ignore_cursor_events on tauri::WebviewWindow). Gate the block to desktop; variables it consumes (classic_style, selection_polish, visible) are still used on mobile outside the block. --------- Co-authored-by: sim <sim@local> Co-authored-by: Chris233 <h-chris233@outlook.com>
User description
目标
设置 → 录音与输入在「录音胶囊」显示开关下新增「胶囊样式」下拉,用户可自行选择:
兼容性
capsuleStyle('siri' 默认 / 'classic'),旧配置缺失字段自动回落 'siri'(Rust/TS 双侧 serde default)capsule:statepayload 下发(capsuleStyle字段),设置里切换后下一次录音即生效,无新权限需求评审修复(commit 3)
set_ignore_cursor_events(true)(鼠标穿透),✕/✓ 按钮实际收不到点击。现在主线程闭包按「classic && visible && 非选区润色 && 录音/转写/润色中」关闭穿透(按钮可点;代价是窗口底部 460×180 区域在会话进行中拦截点击——与 1.3.x 经典胶囊同款取舍,终态 toast 立即恢复穿透),值不变时不重复调用系统 API。prefs.get()(整份克隆 + 偏好锁被set()跨磁盘 I/O 持有)。改为 Inner 上AtomicU8样式缓存,主线程闭包每帧从 prefs 同步(与 show_capsule 同源),音频线程只读原子。附加修复(独立 commit)
beta HEAD 存在构建破坏:
SelectionPolishSection仍传快捷键重构(e12c8dcc)已删除的alignRecordButton/modifierPresets,tsc 必失败。本 PR 顺带适配新 API(value 可空 + onReset 恢复默认快捷键,等价旧「启用」按钮),恢复 beta 可构建状态。测试
cargo test --manifest-path src-tauri/Cargo.toml:865 passed, 0 failed(注:overlay_elevenlabs_cancel_finishes_idle_without_error_capsule为 beta 既有 flaky——macOS 非阻塞 socket WouldBlock 时序竞态,未改代码的 base 同样间歇失败,与本文无关)npm run build(tsc + vite):通过npm test:15 个前端契约测试全部通过?style=classic(浏览器胶囊 dev 预览)证据路径
PR Type
Enhancement, Bug fix
Description
Add selectable capsule style (Siri default / Classic pill)
Fix beta build break in SelectionPolishSection
Enable Classic pill Cancel/Confirm click handling
Cache capsule style atomically, no audio-thread lock
Diagram Walkthrough
File Walkthrough
6 files
Add atomic style and passthrough state fieldsPropagate capsule style and toggle cursor passthroughAdd CapsuleStyle enum and payload fieldsImplement Classic pill and style-based renderingAdd CapsuleStyle type and payload fieldAdd capsule style dropdown to settings5 files
Add capsule style i18n stringsAdd capsule style i18n stringsAdd capsule style i18n stringsAdd capsule style i18n stringsAdd capsule style i18n strings1 files
Add capsuleStyle to mock preferences1 files
Update test fixture with capsuleStyle1 files
Fix ShortcutRecorder props for new API