Skip to content

Latest commit

 

History

History
42 lines (26 loc) · 1.04 KB

File metadata and controls

42 lines (26 loc) · 1.04 KB
id parseHotkey
title parseHotkey

Function: parseHotkey()

function parseHotkey(hotkey, platform): ParsedHotkey;

Defined in: parse.ts:31

Parses a hotkey string into its component parts.

Parameters

hotkey

The hotkey string to parse (e.g., 'Mod+Shift+S')

Hotkey | string & object

platform

The target platform for resolving 'Mod' (defaults to auto-detection)

"mac" | "windows" | "linux"

Returns

ParsedHotkey

A ParsedHotkey object with the key and modifier flags

Example

parseHotkey('Mod+S') // On Mac: { key: 'S', ctrl: false, shift: false, alt: false, meta: true, modifiers: ['Meta'] }
parseHotkey('Mod+S') // On Windows: { key: 'S', ctrl: true, shift: false, alt: false, meta: false, modifiers: ['Control'] }
parseHotkey('Control+Shift+A') // { key: 'A', ctrl: true, shift: true, alt: false, meta: false, modifiers: ['Control', 'Shift'] }