Skip to main content

Crate keytap

Crate keytap 

Source
Expand description

keytap — cross-platform, observe-only global keyboard taps.

See DESIGN.md in the repository root for the full architecture.

use keytap::{Tap, EventKind, Key};

let tap = Tap::new()?;
for event in tap.iter() {
    if let EventKind::KeyDown(Key::MetaRight) = event.kind {
        println!("Right-⌘ pressed");
    }
}

Modules§

chord
Chord matching on top of a raw crate::Tap.

Structs§

Event
A keyboard event observed by a Tap.
RawCode
A raw, platform-specific scancode. On macOS this is a kVK_* virtual keycode; on Windows a virtual-key code; on Linux an evdev KEY_* code.
RecvError
An error returned from the recv method.
Tap
A live global keyboard tap. Drop it to stop listening.
TapBuilder
Configurable Tap construction.
TapIter
Iterator over a Tap. Blocks on each next(). Ends when the tap is dropped.

Enums§

Error
Errors returned when creating a Tap or during its lifetime.
EventKind
Event variants.
Key
A physical key identity, layout-independent.
RecvTimeoutError
An error returned from the recv_timeout method.
TryRecvError
An error returned from the try_recv method.