Skip to content

macOS: hold keystrokes back during a correction #8

Description

@vstrelnikof

Same feature as the Windows twin issue, macOS flavour. Today the key gate (hold your keystrokes while a correction types, replay them behind it) exists only on Linux/evdev; on macOS a keystroke can still land inside a correction and scramble it.

Mechanism: a CGEventTap callback can swallow an event by returning NULL, and our tap is already active. macOS-specific hazards:

  • Tap timeouts. If the callback blocks, macOS disables the tap (kCGEventTapDisabledByTimeout) — the swallow decision must be instant, with held events queued to the worker thread, and the tap re-enabled defensively if the OS ever cuts it.
  • Injected events are already stamped (0.6.2) so the gate can pass our own emissions through — the same self-deadlock guard the evdev gate needed.
  • Replay must preserve ordering relative to the correction's own backspaces/retype, and accept that a mid-correction chord may be unreproducible (documented loss on Linux; same call here).
  • Needs real-hardware validation — this cannot be trusted from CI (see the Apple Silicon validation issue for context on how little of macOS is exercised there).

Where to look: crates/poltertype-input/src/ — evdev KeyGate is the reference; macos.rs holds the tap. docs/PERMISSIONS.md states the user-facing contract per OS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions