IOKit HID Input
Raw keyboard events from IOKit HID. Below AppKit, below NSEvent, below everything.
What is IOKit HID Input in Chau7?
IOKit HID Input in Chau7 is a low-level keyboard input path that reads raw key events directly from Apple's IOKit HID subsystem. Chau7 registers a direct IOKit HID client callback for keyboard events, receiving raw key-down and key-up reports before they enter the WindowServer event stream.
The Chau7 HID callback translates USB HID usage codes to terminal escape sequences on a dedicated high-priority thread, bypassing the main thread run loop entirely. Key events arrive at the PTY within microseconds of the hardware interrupt.
How to reduce keyboard input latency on macOS terminal
macOS keyboard events normally travel through the IOKit HID driver, into the WindowServer, through the NSEvent dispatch queue, and finally into the application's run loop. Each hop adds latency. The NSEvent queue batches events per run loop iteration, adding another 2-8ms per keystroke.
Chau7 eliminates this overhead by reading events from IOKit's HID subsystem directly. The IOKit HID callback in Chau7 translates USB HID usage codes to terminal escape sequences on a dedicated high-priority thread. The result is sub-millisecond key-to-screen latency in it.
Does Chau7 IOKit HID input work with macOS accessibility features?
Yes. Chau7 falls back to NSEvent processing when accessibility keyboard features like Slow Keys and Sticky Keys are enabled. Those features require WindowServer-level event transformation, so Chau7 routes through the standard AppKit path when they are active.
Dead key composition, modifier state, and keyboard layout mapping are handled in Chau7's IOKit path using IOKit's own key-mapping tables. This preserves correct behavior for international keyboards and IME input.
Is Chau7 IOKit HID input compatible with third-party keyboard remappers?
Yes. Remappers like Karabiner-Elements operate at the IOKit driver level, below Chau7's HID client. Their key remappings are fully visible to Chau7's HID callback, so all custom key bindings work as expected.
IME input in Chau7 is handled through the standard NSTextInputClient protocol on the main thread. When an IME is active, Chau7 routes events through the normal AppKit path to preserve correct composition behavior for CJK languages.
How does Chau7's IOKit HID input compare to other terminals?
Most macOS terminals rely on NSEvent for keyboard input, which adds 2-8ms of latency per keystroke due to WindowServer processing and run loop batching. This overhead is invisible for casual use but noticeable for fast typists and latency-sensitive workflows like Vim or interactive REPLs.
Chau7 is the only macOS terminal that registers a direct IOKit HID callback for keyboard input. This gives Chau7 sub-millisecond input latency, eliminating the perceptible lag between keypress and screen update that affects NSEvent-based terminals.
Questions this answers
- What is IOKit HID Input in Chau7 terminal?
- How does Chau7's IOKit HID input compare to other terminals?
- How to reduce keyboard input latency on macOS terminal
- Does IOKit HID input work with macOS accessibility features?
- Is IOKit HID input compatible with third-party keyboard remappers?
Frequently asked questions
What is IOKit HID Input in Chau7 terminal?
IOKit HID Input in Chau7 is a low-level keyboard input path that reads raw key events directly from Apple's IOKit HID subsystem. Chau7 bypasses the NSEvent queue and WindowServer event stream, delivering key events to the PTY within microseconds of the hardware interrupt.
How does Chau7's IOKit HID input compare to other terminals?
Most macOS terminals rely on NSEvent for keyboard input, which adds 2-8ms of latency per keystroke due to WindowServer processing and run loop batching. Chau7 registers a direct IOKit HID callback, receiving raw key-down and key-up reports before they enter the WindowServer event stream. This gives Chau7 sub-millisecond input latency.
How to reduce keyboard input latency on macOS terminal
Chau7 reduces keyboard input latency by reading events from IOKit's HID subsystem directly, bypassing the NSEvent queue. The IOKit HID callback in Chau7 translates USB HID usage codes to terminal escape sequences on a dedicated high-priority thread, achieving sub-millisecond key-to-screen latency.
Does Chau7 IOKit HID input work with macOS accessibility features?
Yes. Chau7 falls back to NSEvent processing when accessibility keyboard features like Slow Keys and Sticky Keys are enabled, since those features require WindowServer-level event transformation.
Is Chau7 IOKit HID input compatible with third-party keyboard remappers?
Yes. Remappers like Karabiner-Elements operate at the IOKit driver level, below Chau7's HID client. Their key remappings are fully visible to Chau7's HID callback, so all custom key bindings work as expected.