2019-10-10 13:47:50 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<title>Keyboard Shortcuts</title>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<div>
|
|
|
|
<h1>Keyboard Shortcuts</h1>
|
|
|
|
|
|
|
|
<h3>The <code>globalShortcut</code> and <code>Menu</code> modules can be used to define keyboard shortcuts.</h3>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
In Electron, keyboard shortcuts are called accelerators.
|
|
|
|
They can be assigned to actions in your application's Menu,
|
|
|
|
or they can be assigned globally so they'll be triggered even when
|
|
|
|
your app doesn't have keyboard focus.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
Open the full documentation for the
|
2019-10-16 15:17:09 +00:00
|
|
|
<a href="http://electron.atom.io/docs/api/menu">Menu</a>,
|
|
|
|
<a href="http://electron.atom.io/docs/api/accelerator">Accelerator</a>,
|
2019-10-10 13:47:50 +00:00
|
|
|
and
|
2019-10-16 15:17:09 +00:00
|
|
|
<a href="http://electron.atom.io/docs/api/global-shortcut">globalShortcut</a>
|
2019-10-10 13:47:50 +00:00
|
|
|
APIs in your browser.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
2019-10-16 15:17:09 +00:00
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<div>
|
2019-10-10 13:47:50 +00:00
|
|
|
<p>
|
2019-10-16 15:17:09 +00:00
|
|
|
To try this demo, press <kbd>CommandOrControl+Alt+K</kbd> on your
|
2019-10-10 13:47:50 +00:00
|
|
|
keyboard.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
Global shortcuts are detected even when the app doesn't have
|
|
|
|
keyboard focus, and they must be registered after the app's
|
|
|
|
`ready` event is emitted.
|
|
|
|
</p>
|
|
|
|
|
2019-10-16 15:17:09 +00:00
|
|
|
<div>
|
2019-10-10 13:47:50 +00:00
|
|
|
<h2>ProTip</h2>
|
|
|
|
<strong>Avoid overriding system-wide keyboard shortcuts.</strong>
|
|
|
|
<p>
|
|
|
|
When registering global shortcuts, it's important to be aware of
|
|
|
|
existing defaults in the target operating system, so as not to
|
|
|
|
override any existing behaviors. For an overview of each
|
|
|
|
operating system's keyboard shortcuts, view these documents:
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<ul>
|
2019-10-16 15:17:09 +00:00
|
|
|
<li><a
|
2019-10-10 13:47:50 +00:00
|
|
|
href="https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/Keyboard.html">macOS</a>
|
|
|
|
</li>
|
2019-10-16 15:17:09 +00:00
|
|
|
<li><a
|
2019-10-10 13:47:50 +00:00
|
|
|
href="http://windows.microsoft.com/en-us/windows-10/keyboard-shortcuts">Windows</a></li>
|
2019-10-16 15:17:09 +00:00
|
|
|
<li><a
|
2019-10-10 13:47:50 +00:00
|
|
|
href="https://developer.gnome.org/hig/stable/keyboard-input.html.en">Linux</a></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-10-16 15:17:09 +00:00
|
|
|
</div>
|
2019-10-10 13:47:50 +00:00
|
|
|
</body>
|
|
|
|
|
2019-10-16 15:17:09 +00:00
|
|
|
</html>
|