ink-cartridge
    Preparing search index...

    Interface GlobalSequenceEntry

    A single global sequence key definition.

    Global sequence keys fire regardless of the screen stack, with higher priority than GlobalKeyEntry. They match multi-key sequences (e.g. ['g', 'g'], ['ctrl+w', 'q']) instead of single key presses.

    Unlike global keys, global sequences do NOT support times.

    interface GlobalSequenceEntry {
        affectLayer?: boolean;
        category?: unknown[] | "*";
        cover?: boolean;
        exclusive?: boolean;
        executeWhenNoOverlay?: boolean;
        keys: string[];
        mode?: string;
        operate: string | (() => void);
        timeout?: number;
        when?: string | (() => boolean);
    }
    Index
    affectLayer?: boolean

    Whether this global sequence fires before the layer broadcast.

    • false (default): layer broadcast → global sequence → … → screen stack
    • true: global sequence → layer broadcast → … → screen stack
    category?: unknown[] | "*"

    Whitelist of screen components that may use this global sequence.

    • "*" or omitted: all screens
    • []: no screens (effectively disabled)
    • [Menu, Game]: only when the stack top is exactly Menu or Game
    cover?: boolean

    Whether screen components are allowed to override this global sequence via boundSequence. Only sequence bindings can override — ordinary boundKeyboard bindings are never checked against global sequences.

    true
    
    exclusive?: boolean

    Controls behaviour when a key is pressed that does NOT match the next key expected by the pending sequence.

    • false (default): the mismatched key cancels the pending sequence and falls through to lower-priority handlers.
    • true: the mismatched key is silently consumed — the sequence keeps waiting until the timeout expires or the correct key arrives.
    executeWhenNoOverlay?: boolean

    When true, an overlay-phase entry (affectLayer: true) fires even while no layer is open. With the default false, the entry is skipped when no layers exist. Only relevant when affectLayer is true.

    keys: string[]

    Ordered key names that make up the sequence (e.g. ['g', 'g'], ['ctrl+w', 'q']). Must have length ≥ 2.

    mode?: string

    Restrict this global sequence to a specific mode.

    When set, the processor skips this entry unless currentMode matches. Checked before when, affectLayer, category, and cover evaluation. When omitted, the sequence is active in all modes (including no-mode).

    // Only active in normal mode
    globalSequence([{ keys: ['g', 'g'], operate: scrollToTop, mode: 'normal' }]);
    operate: string | (() => void)

    Callback to invoke when the full sequence is matched.

    Can also be a string referencing a registered SequenceOperationEntry by its sequenceActionId. When a string is provided, the action's action callback is used. The action must be registered via KeyboardEngine.defineSequenceAction or KeyboardEngine.addSequenceAction before calling globalSequence.

    timeout?: number

    Maximum time in milliseconds between key presses within the sequence. The timer starts when the first key is pressed and resets on each matching key. If it expires before the full sequence is entered, the pending state is cancelled.

    500
    
    when?: string | (() => boolean)

    Optional condition callback. When provided, the global sequence only starts and continues when this returns true.