Skip to content

ElectronGlobalShortcut.register method

ElectronGlobalShortcut › register

Unofficial

Registers a global shortcut of accelerator. The callback is called when the registered shortcut is pressed by the user.

When the accelerator is already taken by other applications, this call will silently fail.

Signature:

register(accelerator: string, callback: () => void): boolean

Parameters:

Parameter Type Description
accelerator string The accelerator to register.
callback () => void Called when the registered shortcut is pressed.

Returns: booleanWhether or not the shortcut was registered successfully.