Skip to main content

Module tri_state

Module tri_state 

Expand description

Tri-state keys (start / continue / interrupt; e.g. Alt-Tab swapper). Tri-state keys: start / continue / interrupt.

A tri-state key owns a session across later presses of the same key. The first press starts (typically virtual-hold a modifier and tap a key), later presses of the same key continue (tap again while the hold stays), and any other resolved key interrupts (releases the hold).

The physical key is a crate::key::NewPressedKey::NoOp; HID output is injected with crate::input::Event::VirtualKeyPress / crate::input::Event::VirtualKeyRelease. Hold is pressed before tap so the first report is the chord, not a naked tap.

Classic use is Alt-Tab (a “swapper”): start holds Left Alt and taps Tab, continue taps Tab, interrupt releases Left Alt.

Structs§

Context
Tri-state context: at most one session is armed.
Key
A tri-state key: virtual-hold hold across taps of tap.
KeyState
Key state used by System. (No per-key state; behaviour is on Context.)
PendingKeyState
Pending key state type for tri-state keys. (No pending state.)
Ref
Reference for a tri-state key (index into System key data).
System
The key::System implementation for tri-state keys.

Enums§

Event
Tri-state events.