Skip to content

fix(ink): only a bare Alt double press starts the overlay - #105

Merged
atman-33 merged 2 commits into
mainfrom
fix/ink-alt-double-press
Aug 10, 2026
Merged

fix(ink): only a bare Alt double press starts the overlay#105
atman-33 merged 2 commits into
mainfrom
fix/ink-alt-double-press

Conversation

@atman-33

Copy link
Copy Markdown
Owner

Summary

  • The ink gesture (ink/state.rs) armed on every Alt release regardless of what that Alt had been doing, so an ordinary shortcut (Alt+Tab, Alt+F4) or a held Alt would arm it — the gesture's first press then activated and tore down the overlay, and the second press did nothing. Ported the defenses the clips popup (clips/gesture.rs) already has: other keys poison an attempt, only a bare short tap arms, a lost release recovers instead of sticking, and an unmatched release no longer cancels a pending arm.
  • rawkey.rs timestamps now come from GetMessageTime() (rebased onto GetTickCount64()) instead of delivery time, so a stalled message queue can't stretch the measured gap between presses.
  • Help screen now documents the bare-tap requirement and that the gesture cannot fire while an elevated window is in the foreground (Windows UIPI — not fixable in code).
  • Recorded the shared constraints in .claude/rules/global-keyboard-input.md for the next global-key feature.

Test plan

  • cargo test --release — 217 passed (13 new/updated in ink::state, one per failure mode)
  • cargo clippy --release --all-targets -- -D warnings — clean
  • cargo fmt
  • npm run build — typecheck + build clean
  • Manual verification (not done, needs a live desktop session): gesture right after Alt+Tab, right after a held-and-released Alt, and a plain double press

🤖 Generated with Claude Code

atman-33 and others added 2 commits August 10, 2026 22:05
The Alt state machine armed on every Alt release, whatever that Alt had
been doing. An ordinary shortcut (Alt+Tab, Alt+F4) or a held Alt left the
machine armed, so the *first* press of the gesture that followed activated
the overlay and the second press did nothing — the gesture looked dead
even though it had fired and been torn down in between.

Port the defences the clips tap machine already has: other key presses
poison an attempt, and only a press held for less than the double-click
threshold arms it. Also recover from a lost Alt release (session lock,
elevated window taking focus) instead of swallowing Alt as auto-repeat
forever, and stop an unmatched release — the other Alt key — from
cancelling a pending arm.

Timestamps now come from the message post time rather than from when the
listener got around to the message, so a stalled queue cannot stretch the
gap between the two presses past the threshold.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The ink gesture regressed into "sometimes does nothing" because the
recognizer armed on any Alt release. Write down the constraints both
recognizers now share, plus the UIPI limitation and the message-time rule,
so the next global-key feature does not rediscover them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@atman-33
atman-33 merged commit d93ad83 into main Aug 10, 2026
1 check passed
@atman-33
atman-33 deleted the fix/ink-alt-double-press branch August 10, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant