tuil
ReferencePackages

@mwillbanks/tuil-hotkeys

Scoped terminal hotkeys, chords, and key sequences for tuil.

View rawEdit

Overview

Scoped terminal hotkeys, chords, and key sequences for tuil.

@mwillbanks/tuil-hotkeys is independently installable and also participates in the umbrella @mwillbanks/tuil runtime where applicable.

Installation

npm install @mwillbanks/tuil-hotkeys

How it operates

Hotkey bindings normalize terminal input, match chords and sequences, honor active scopes, resolve priorities, and dispose cleanly.

Documentation flow diagram. register; scope match; sequence match; dispatch; dispose; S0 leads to S1; S1 leads to S2; S2 leads to S3
Documentation flow diagram. register; scope match; sequence match; dispatch; dispose; S0 leads to S1; S1 leads to S2; S2 leads to S3

API

APISignatureDescription
Hotkeyfunction HotkeyPublic function Hotkey.
HotkeyBindinginterface HotkeyBindingPublic interface HotkeyBinding.
HotkeyConflictinterface HotkeyConflictPublic interface HotkeyConflict.
HotkeyDispatchContextinterface HotkeyDispatchContextPublic interface HotkeyDispatchContext.
HotkeyEventinterface HotkeyEventPublic interface HotkeyEvent.
HotkeyLayerfunction HotkeyLayerPublic function HotkeyLayer.
HotkeyManagerclass HotkeyManagerPublic class HotkeyManager.
HotkeyMetadatainterface HotkeyMetadataPublic interface HotkeyMetadata.
HotkeyProviderfunction HotkeyProviderPublic function HotkeyProvider.
HotkeyScopetype HotkeyScopePublic type HotkeyScope.
normalizeHotkeyNotationfunction normalizeHotkeyNotationPublic function normalizeHotkeyNotation.
normalizeTerminalKeyfunction normalizeTerminalKeyPublic function normalizeTerminalKey.
TerminalKeyinterface TerminalKeyPublic interface TerminalKey.
useHotkeyfunction useHotkeyPublic function useHotkey.
useHotkeyManagerfunction useHotkeyManagerPublic function useHotkeyManager.
useHotkeysfunction useHotkeysPublic function useHotkeys.

Events and lifecycle

Bindings invoke handlers directly. Dispatch failures are routed to the caller-supplied error handler.

All subscriptions and registrations return a disposer or belong to an owning runtime that disposes them in reverse order.

Example

hotkeys.register({ keys: "ctrl+s", scope: "application", handler: save });

On this page