fix(capsule): 三平台统一恢复 Done/Cancelled/Error toast

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。
This commit is contained in:
baiqing committed 2026-05-02 09:47:19 +08:00
1 parent 9dd9b0b066
commit 0f4d29fdec
1 file changed
+6 -4
@@ -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") {