electron/docs/api/accelerator.md

56 lines
1.2 KiB
Markdown
Raw Normal View History

# Accelerator
2016-04-21 22:39:12 +00:00
> Define keyboard shortcuts.
Accelerators can contain multiple modifiers and key codes, combined by
the `+` character.
Examples:
* `CommandOrControl+A`
* `CommandOrControl+Shift+Z`
## Platform notice
On Linux and Windows, the `Command` key does not have any effect so
2016-06-18 13:26:26 +00:00
use `CommandOrControl` which represents `Command` on macOS and `Control` on
Linux and Windows to define some accelerators.
2016-06-18 13:26:26 +00:00
Use `Alt` instead of `Option`. The `Option` key only exists on macOS, whereas
2016-04-01 22:48:12 +00:00
the `Alt` key is available on all platforms.
The `Super` key is mapped to the `Windows` key on Windows and Linux and
2016-06-18 13:26:26 +00:00
`Cmd` on macOS.
## Available modifiers
* `Command` (or `Cmd` for short)
* `Control` (or `Ctrl` for short)
* `CommandOrControl` (or `CmdOrCtrl` for short)
* `Alt`
2016-03-06 06:12:04 +00:00
* `Option`
* `AltGr`
* `Shift`
* `Super`
## Available key codes
* `0` to `9`
* `A` to `Z`
* `F1` to `F24`
* Punctuations like `~`, `!`, `@`, `#`, `$`, etc.
* `Plus`
* `Space`
* `Tab`
* `Backspace`
* `Delete`
* `Insert`
* `Return` (or `Enter` as alias)
* `Up`, `Down`, `Left` and `Right`
* `Home` and `End`
* `PageUp` and `PageDown`
* `Escape` (or `Esc` for short)
* `VolumeUp`, `VolumeDown` and `VolumeMute`
* `MediaNextTrack`, `MediaPreviousTrack`, `MediaStop` and `MediaPlayPause`
2016-03-06 06:12:04 +00:00
* `PrintScreen`