Skip to main content

Interface: IGlobalShortcutService

services.IGlobalShortcutService

Interface for managing global shortcuts.

Table of contents

Methods

Methods

getRegistered

getRegistered(): IGlobalShortcut[]

Retrieves all registered global shortcuts.

Returns

IGlobalShortcut[]

An array of IGlobalShortcut objects.

Defined in

src/services/globalShortcutService.ts:58


isRegistered

isRegistered(accelerator): boolean

Checks if a global shortcut is registered.

Parameters

NameTypeDescription
acceleratorstringThe accelerator string for the global shortcut to check.

Returns

boolean

A boolean indicating if the global shortcut is registered.

Defined in

src/services/globalShortcutService.ts:52


isValid

isValid(accelerator): boolean

Validates an accelerator string to see if it can be used as a global shortcut.

Parameters

NameTypeDescription
acceleratorstringThe accelerator string to validate.

Returns

boolean

A boolean indicating if the accelerator is valid for a global shortcut.

Defined in

src/services/globalShortcutService.ts:70


register

register(accelerator, callback, options?): Promise\<undefined | string>

Registers a global shortcut.

Parameters

NameTypeDescription
acceleratorstringThe accelerator string for the global shortcut. See https://www.electronjs.org/docs/latest/api/accelerator for more information.
callback() => voidThe function to execute when the global shortcut is activated.
options?IGlobalShortcutRegistrationOptionsOptional settings for the global shortcut registration.

Returns

Promise\<undefined | string>

A promise resolving to the registration ID if successful, otherwise undefined.

Defined in

src/services/globalShortcutService.ts:34


unregister

unregister(accelerator): Promise\<boolean>

Unregisters a global shortcut.

Parameters

NameTypeDescription
acceleratorstringThe accelerator string for the global shortcut to unregister.

Returns

Promise\<boolean>

A promise resolving to a boolean indicating success or failure.

Defined in

src/services/globalShortcutService.ts:45


unregisterAll

unregisterAll(): void

Unregisters all global shortcuts.

Returns

void

Defined in

src/services/globalShortcutService.ts:63