Skip to content

Latest commit

 

History

History
100 lines (63 loc) · 2.34 KB

File metadata and controls

100 lines (63 loc) · 2.34 KB
id RawHotkey
title RawHotkey

Interface: RawHotkey

Defined in: hotkey.ts:341

A raw hotkey object for programmatic registration.

Like ParsedHotkey but without modifiers (derived from booleans) and with optional modifier booleans (default to false when omitted). Use with HotkeyManager.register() and useHotkey() when you prefer object form over a string.

The mod modifier is platform-adaptive: Command on macOS, Control on Windows/Linux. Pass platform when converting to ParsedHotkey (e.g., via options.platform).

Example

useHotkey({ key: 'S', mod: true }, handler)             // Mod+S (cross-platform)
useHotkey({ key: 'S', ctrl: true }, handler)            // Control+S
useHotkey({ key: 'Escape' }, handler)                   // Escape (no modifiers)
useHotkey({ key: 'A', shift: true, meta: true }, handler) // Shift+Meta+A
useHotkey({ key: 'S', mod: true, shift: true }, handler)  // Mod+Shift+S

Properties

alt?

optional alt: boolean;

Defined in: hotkey.ts:351

Whether the Alt key is required. Defaults to false.


ctrl?

optional ctrl: boolean;

Defined in: hotkey.ts:347

Whether the Control key is required. Defaults to false.


key

key: Key | string & object;

Defined in: hotkey.ts:343

The non-modifier key (e.g., 'S', 'Escape', 'F1').


meta?

optional meta: boolean;

Defined in: hotkey.ts:353

Whether the Meta (Command) key is required. Defaults to false.


mod?

optional mod: boolean;

Defined in: hotkey.ts:345

Platform-adaptive modifier: Command on macOS, Control on Windows/Linux. Defaults to false.


shift?

optional shift: boolean;

Defined in: hotkey.ts:349

Whether the Shift key is required. Defaults to false.