Link Accelerator docs to globalShortcut module
Usage of Accelerators (i.e. `globalShortcut.register`) is now documented in the Accelerator docs themselves.
This commit is contained in:
parent
eed8f201e2
commit
aeb774730b
1 changed files with 18 additions and 2 deletions
|
@ -2,14 +2,30 @@
|
|||
|
||||
> Define keyboard shortcuts.
|
||||
|
||||
Accelerators can contain multiple modifiers and key codes, combined by
|
||||
the `+` character.
|
||||
Accelerators are Strings that can contain multiple modifiers and key codes,
|
||||
combined by the `+` character, and are used to define keyboard shortcuts
|
||||
throughout your application.
|
||||
|
||||
Examples:
|
||||
|
||||
* `CommandOrControl+A`
|
||||
* `CommandOrControl+Shift+Z`
|
||||
|
||||
Shortcuts are registered with the [`globalShortcut`](global-shortcut.md) module
|
||||
using the [`register`](global-shortcut.md#globalshortcutregisteraccelerator-callback)
|
||||
method, i.e.
|
||||
|
||||
```javascript
|
||||
const {app, globalShortcut} = require('electron')
|
||||
|
||||
app.on('ready', () => {
|
||||
// Register a 'CommandOrControl+Y' shortcut listener.
|
||||
globalShortcut.register('CommandOrControl+Y', () => {
|
||||
// Do stuff when Y and either Command/Control is pressed.
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
## Platform notice
|
||||
|
||||
On Linux and Windows, the `Command` key does not have any effect so
|
||||
|
|
Loading…
Reference in a new issue