Skip to main content

Register global shortcuts.

Type aliases#

ShortcutHandler#

Ƭ ShortcutHandler: (shortcut: string) => void

Type declaration:#

▸ (shortcut: string): void

Parameters:#

NameType
shortcutstring

Returns: void

Defined in: globalShortcut.ts:13

Functions#

isRegistered#

isRegistered(shortcut: string): Promise<boolean>

Determines whether the given shortcut is registered by this application or not.

Parameters:#

NameTypeDescription
shortcutstringArray of shortcut definitions, modifiers and key separated by "+" e.g. CmdOrControl+Q

Returns: Promise<boolean>

A promise resolving to the state.

Defined in: globalShortcut.ts:63


register#

register(shortcut: string, handler: ShortcutHandler): Promise<void>

Register a global shortcut.

Parameters:#

NameTypeDescription
shortcutstringShortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q
handlerShortcutHandlerShortcut handler callback - takes the triggered shortcut as argument

Returns: Promise<void>

Defined in: globalShortcut.ts:22


registerAll#

registerAll(shortcuts: string[], handler: ShortcutHandler): Promise<void>

Register a collection of global shortcuts.

Parameters:#

NameTypeDescription
shortcutsstring[]Array of shortcut definitions, modifiers and key separated by "+" e.g. CmdOrControl+Q
handlerShortcutHandlerShortcut handler callback - takes the triggered shortcut as argument

Returns: Promise<void>

Defined in: globalShortcut.ts:43


unregister#

unregister(shortcut: string): Promise<void>

Unregister a global shortcut.

Parameters:#

NameTypeDescription
shortcutstringshortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q

Returns: Promise<void>

Defined in: globalShortcut.ts:79


unregisterAll#

unregisterAll(): Promise<void>

Unregisters all shortcuts registered by the application.

Returns: Promise<void>

Defined in: globalShortcut.ts:94