mirror of
https://github.com/electron/electron.git
synced 2026-01-08 23:18:06 -05:00
feat: allow registering multiple shortcuts (#15542)
This PR allows for multiple global shortcuts to be registered such that triggering any of them calls the same callback.
This commit is contained in:
@@ -54,6 +54,17 @@ When the accelerator is already taken by other applications, this call will
|
||||
silently fail. This behavior is intended by operating systems, since they don't
|
||||
want applications to fight for global shortcuts.
|
||||
|
||||
### `globalShortcut.registerAll(accelerators, callback)`
|
||||
|
||||
* `accelerators` String[] - an array of [Accelerator](accelerator.md)s.
|
||||
* `callback` Function
|
||||
|
||||
Registers a global shortcut of all `accelerator` items in `accelerators`. The `callback` is called when any of the registered shortcuts are pressed by the user.
|
||||
|
||||
When a given accelerator is already taken by other applications, this call will
|
||||
silently fail. This behavior is intended by operating systems, since they don't
|
||||
want applications to fight for global shortcuts.
|
||||
|
||||
### `globalShortcut.isRegistered(accelerator)`
|
||||
|
||||
* `accelerator` [Accelerator](accelerator.md)
|
||||
|
||||
Reference in New Issue
Block a user