menu

KeyboardState

import { KeyboardState } from "destack:input/binding";

Keyboard state snapshot.

language/library/src/input/binding/keyboard.ds:58:81
1export struct KeyboardState {2    timestampNs: uint64;3    sequence: uint64;4    deviceId: string;5    hostModifiers: uint32;6    modifiers: ModifierState;7    pressedCodes: string[];8    pressedKeys: string[];9    pressedHostCodes: uint32[];10    pressedScanCodes: uint32[];11    layout: KeyboardLayout;12    isComposing: boolean;13}

Members

timestampNs: uint64

Monotonic update timestamp in nanoseconds.

sequence: uint64

Monotonic sequence number generated by the host stream.

deviceId: string

Stable source device identifier.

hostModifiers: uint32

Host modifier bitset.

modifiers: ModifierState

Keyboard modifier and lock state.

pressedCodes: string[]

Normalized physical codes currently pressed.

pressedKeys: string[]

Normalized logical keys currently pressed.

pressedHostCodes: uint32[]

Host key codes currently pressed.

pressedScanCodes: uint32[]

Host hardware scan codes currently pressed when available.

layout: KeyboardLayout

Active layout when available.

isComposing: boolean

Whether the keyboard is currently within one active composition session.