Skip to content

HotkeyRegistry

Defined in: src/core/hotkeys.ts:159

Process-wide registry of named, grouped, context-scoped hotkeys. Use getInstance or the useHotkey React hook.

new HotkeyRegistry(): HotkeyRegistry

HotkeyRegistry

get context(): string | null

Defined in: src/core/hotkeys.ts:183

The active app context, or null when none is set.

string | null


get version(): number

Defined in: src/core/hotkeys.ts:178

Monotonic change counter — a stable snapshot for useSyncExternalStore.

number

dispatch(ev, phase): boolean

Defined in: src/core/hotkeys.ts:278

Dispatch a key event against the active hotkeys. phase selects which bindings are eligible: "priority" (called before the focused widget) fires only modified/function keys; "fallback" (after the focus chain declined) fires the rest. Returns true and marks the event handled when a hotkey ran. The most recently registered match wins.

KeyEvent

"priority" | "fallback"

boolean


groups(opts?): HotkeyGroup[]

Defined in: src/core/hotkeys.ts:261

list, sectioned by group (groups in first-appearance order).

ListOptions = {}

HotkeyGroup[]


list(opts?): Hotkey[]

Defined in: src/core/hotkeys.ts:250

Hotkeys matching the options, in registration order.

ListOptions = {}

Hotkey[]


popContext(): void

Defined in: src/core/hotkeys.ts:200

Leave the innermost context entered with pushContext.

void


pushContext(context): void

Defined in: src/core/hotkeys.ts:194

Enter a nested context (e.g. a modal flow); pair with popContext.

string

void


register(opts): () => void

Defined in: src/core/hotkeys.ts:220

Register a hotkey; returns a disposer. Later registrations on the same key win at dispatch time (and shadow rather than replace — disposing the newer one restores the older).

HotkeyOptions

() => void


setContext(context): void

Defined in: src/core/hotkeys.ts:188

Replace the whole context stack with one context (or none).

string | null

void


subscribe(cb): () => void

Defined in: src/core/hotkeys.ts:208

Subscribe to registry changes; returns an unsubscribe function.

() => void

() => void


static getInstance(): HotkeyRegistry

Defined in: src/core/hotkeys.ts:162

The shared singleton.

HotkeyRegistry


static reset(): void

Defined in: src/core/hotkeys.ts:167

Drop all registrations and contexts (test isolation).

void