keytap
Cross-platform, observe-only global keyboard taps for Rust. macOS, Windows, Linux (X11 and Wayland).
use ;
let tap = new?;
for event in tap.iter
// Dropping `tap` stops the platform listener cleanly.
With the chord feature (default):
use ;
use Key;
let matcher = builder
// Momentary (default): End fires when any chord key is released.
.add
// Toggle: End fires on the NEXT complete press. Stays active
// between presses; other chords are suppressed while it's active.
.add_toggle
.build?;
while let Ok = matcher.recv
What it does
- Sees every keyboard press/release the OS sees, including when your app is not in the foreground.
- Distinguishes left vs right modifiers (
ShiftLeft≠ShiftRight,MetaRight≠MetaLeft, etc.). - Never swallows keys — observation only.
- Shuts down cleanly when the
Tapis dropped. - Works on Linux Wayland by reading evdev directly.
- Never calls the macOS APIs that crash on Sonoma+ under threaded callers.
What it doesn't do
- Simulate keys (use
enigoor call the OS directly). - Intercept / grab keys (would need root on Linux).
- Mouse events.
- Character interpretation / layout translation.
Status
v0.1: macOS backend is implemented and live-tested. Linux (evdev) and
Windows (WH_KEYBOARD_LL) backends are implemented and compile-verified
across targets, but not yet run on real hardware — first-run bug reports
welcome.
Architecture and platform internals are documented in DESIGN.md.
License
MIT OR Apache-2.0