Function: comboFromEvent()
comboFromEvent(
event,platform?):KeyCombo|undefined
Defined in: src/lib/utils/shortcuts/index.ts:516
The key combination of a key press, matching keyboards with different layouts:
- Keys are matched by the character they type, so letters follow the key's label (e.g.
aon a French keyboard). - Digits and symbols ignore Shift and AltGr/Option, which are often needed to type them (e.g.
<and[on a German keyboard). - When a key types a character that isn't basic Latin (another alphabet, or Option on macOS), or is a dead key, the
physical key is used instead (e.g.
aforф, andalt gfor Option+G typing©). =counts as+, socmd +works with or without Shift.
cmd is Command on Apple devices and Ctrl elsewhere; ctrl is Control on Apple devices. Undefined while composing
text (e.g. with an input method), for modifier keys alone, and for the Windows key elsewhere.
Parameters
event
platform?
string
Returns
KeyCombo | undefined
Example
comboFromEvent({ key: "Z", metaKey: true, ctrlKey: false, shiftKey: true, altKey: false }, "MacIntel");
// { key: "z", cmd: true, shift: true }