Skip to content

fix: prevent modifier shortcut freeze during rapid CJKV switching#93

Open
darknos wants to merge 1 commit intorunjuu:mainfrom
darknos:main
Open

fix: prevent modifier shortcut freeze during rapid CJKV switching#93
darknos wants to merge 1 commit intorunjuu:mainfrom
darknos:main

Conversation

@darknos
Copy link
Copy Markdown

@darknos darknos commented Mar 30, 2026

Synthetic CGEvents posted by InputSourceSwitcher during CJKV fix (Cmd key bounce) were feeding back into ShortcutTriggerManager, corrupting pressedModifiers state and polluting lastKeyDownTimestamps. This caused subsequent modifier shortcut triggers to be permanently suppressed when rapidly alternating between left/right modifier keys.

Three fixes:

  • Filter own-process events in CGEvent tap via PID check
  • During CJKV synthetic window: process flagsChanged normally to keep pressedModifiers in sync, but suppress trigger firing and combo invalidation from phantom modifiers
  • Evict stale lastKeyDownTimestamps entries to prevent unbounded growth

Synthetic CGEvents posted by InputSourceSwitcher during CJKV fix
(Cmd key bounce) were feeding back into ShortcutTriggerManager,
corrupting pressedModifiers state and polluting lastKeyDownTimestamps.
This caused subsequent modifier shortcut triggers to be permanently
suppressed when rapidly alternating between left/right modifier keys.

Three fixes:
- Filter own-process events in CGEvent tap via PID check
- During CJKV synthetic window: process flagsChanged normally to keep
  pressedModifiers in sync, but suppress trigger firing and combo
  invalidation from phantom modifiers
- Evict stale lastKeyDownTimestamps entries to prevent unbounded growth
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