src/events/KeyboardEventsSpecs.md
Line coverage:
KeyboardEventsTestable.swift65% · refreshed 2026-05-27 by/coverage-explore
Global hotkey handling has to make sense of a stream of key-down / key-up / modifier events that the
OS doesn't always deliver cleanly. KeyboardEventsTestable is the state machine that interprets those
sequences — deciding when to summon the switcher, cycle, act on a window, or dismiss — and stays robust
when events are missing or arrive out of order. The suite feeds it canned event sequences and asserts
the resulting actions.
doNothingOnRelease doesn't focus; the search-on-release path does
not focus the window on release (it enters search instead).Mirrors KeyboardEventsTests.swift 1:1.
doNothingOnRelease style: releasing the modifier doesn't focus.NSEvent.ModifierFlags.cleaned() (defined in ATShortcut.swift, exercised here)AppKit's local event monitors occasionally emit modifier flags with extra bits (function-key bit, raw 0x120-style garbage). cleaned() is the intersection that strips them before the matcher sees them. Tested here as the closest existing home until an ATShortcutTests.swift lands.
[.command, .shift, .option, .control, .capsLock] survives cleaning..function and stray bits like 0x120 are dropped.