fix: add 600ms activation cooldown after end_session for Toggle mode (#545)#571
Merged
Merged
Conversation
…pen-Less#545) 在 coordinator 层增加 timer-based busy gate:end_session / cancel_session 将 phase 设为 Idle 时记录冷却时间戳;handle_pressed 的 (Toggle, Idle) 分支在 begin_session 前检查该冷却,未过期则忽略本次按键。 冷却时长 600ms(覆盖胶囊 EXIT_ANIM_MS 360ms + 余量),既拦截 三连按的第 3 次误触,也不影响用户主动重新激活。 - coordinator.rs: 新增 POST_SESSION_COOLDOWN_MS 常量 + Inner 字段 - dictation.rs: handle_pressed 增加冷却检查 - dictation.rs: end_session / cancel_session 成功收尾时设置冷却
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
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
背景
Issue #545 报告 Toggle 模式下快速三连按时,第 3 次按键会在胶囊离场动画期间误激活新听写。
改动
在 coordinator 层增加 timer-based busy gate,冷却时长 600ms(覆盖胶囊
EXIT_ANIM_MS360ms + 余量):不受影响
验证
Closes #545
PR Type
Bug fix
Description
Add 600ms activation cooldown after end_session/cancel_session
Block toggle hotkey in Idle phase during cooldown
Prevent triple-press Third key from starting new dictation
Diagram Walkthrough
flowchart LR Press["Hotkey Pressed (Toggle, Idle)"] --> Check{Cooldown expired?} Check -- Yes --> Begin["begin_session"] Check -- No --> Ignore["Ignore (blocked)"] Begin --> End["end_session / cancel_session"] End --> SetCooldown["Set POST_SESSION_COOLDOWN_MS"] SetCooldown --> CapsuleIdle["schedule_capsule_idle"]File Walkthrough
coordinator.rs
Add cooldown constant and state fieldopenless-all/app/src-tauri/src/coordinator.rs
POST_SESSION_COOLDOWN_MSconstant (600ms)session_cooldown_untilfield toInnerstructdictation.rs
Implement cooldown check and set in session endpointsopenless-all/app/src-tauri/src/coordinator/dictation.rs
handle_pressedfor(Toggle, Idle)branchend_sessionafter setting phase to Idlecancel_sessionwhen phase set to Idle