From 0f4d29fdec9d05dbc8de22bcfbe1a60bbe0fe07b Mon Sep 17 00:00:00 2001 From: baiqing Date: Sat, 2 May 2026 09:47:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(capsule):=20=E4=B8=89=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=81=A2=E5=A4=8D=20Done/Cancelled/Error=20t?= =?UTF-8?q?oast?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #140 在 Windows 上把 emit_capsule 的 visible 判定从 !Idle 缩窄到 仅 Recording/Transcribing/Polishing,副作用是 macOS / Linux 用户也失去了 "已粘贴 N 字" / "已取消" / 错误文案这一组完成 toast。 本 commit 把 visible 切回原本的 `!matches!(state, CapsuleState::Idle)`, 覆盖三平台。Windows 上 linger 的真实问题(dead zone / 截图选中 / 拖动卡顿) 由 PR #140 引入的 hide_capsule_window_if_present() Win32 hard-hide 路径 在 visible=false 分支处理——不依赖改 visible 语义。 closes the visible-narrowing follow-up referenced in PR #140 review comment。 --- openless-all/app/src-tauri/src/coordinator.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/openless-all/app/src-tauri/src/coordinator.rs b/openless-all/app/src-tauri/src/coordinator.rs index f804884c..51bb0c42 100644 --- a/openless-all/app/src-tauri/src/coordinator.rs +++ b/openless-all/app/src-tauri/src/coordinator.rs @@ -2536,10 +2536,12 @@ fn emit_capsule( let show_capsule = inner.prefs.get().show_capsule; if let Some(window) = app.get_webview_window("capsule") { - let visible = matches!( - state, - CapsuleState::Recording | CapsuleState::Transcribing | CapsuleState::Polishing - ); + // 三平台统一:Done / Cancelled / Error 状态保留 ~1.5s toast + // (schedule_capsule_idle 之后会回 Idle 隐藏)。 + // Windows 上 linger 的真实问题(截图选中 / 死区 / 拖拽卡顿)由 #140 加的 + // `hide_capsule_window_if_present()` Win32 hard-hide 在 visible=false 分支 + // 处理,不依赖把 Done/Cancelled/Error 打成 invisible。详见 PR #140 评论。 + let visible = !matches!(state, CapsuleState::Idle); maybe_position_capsule_bottom_center(inner, &window, payload.translation); if show_capsule && visible { if cfg!(target_os = "windows") {