<h2 id="manifest">Manifest</h2>
<p>
-You must set manifest_version to (at least) 2 to use this API.
+You must have a <code>"manifest_version"</code> of at least <code>2</code> to use this API.
</p>
+{{?is_apps +partials.warning_dev /}}
+
<h2 id="usage">Usage</h2>
<p>The commands API allows you to define specific commands, and bind them to a
default key combination. Each command your extension accepts must be listed in
the manifest as an attribute of the 'commands' manifest key. An extension can
have many commands but only 4 suggested keys can be specified. The user can
-manually add more shortcuts from the chrome://extensions page.</p>
+manually add more shortcuts from the chrome://extensions/configureCommands
+dialog.</p>
<p>Supported keys: A-Z, 0-9, Comma, Period, Home, End, PageUp, PageDown, Insert,
-Delete, Tab, Arrow keys (Up, Down, Left, Right) and the Media Keys
+Delete, Arrow keys (Up, Down, Left, Right) and the Media Keys
(MediaNextTrack, MediaPlayPause, MediaPrevTrack, MediaStop).</p>
<p>Note: All key combinations must include either Ctrl* or Alt. Combinations
that involve Ctrl+Alt are not permitted in order to avoid conflicts with the
AltGr key. Shift can be used in addition to Alt or Ctrl, but is not required.
-Modifiers (such as Ctrl) can not be used in combination with the Media Keys.<p>
+Modifiers (such as Ctrl) can not be used in combination with the Media Keys.
+Tab key was removed from list of supported keys in Chrome version 33 and above
+for accessibility reasons.<p>
<p>* Also note that on Mac 'Ctrl' is automatically converted to 'Command'. If
you want 'Ctrl' instead, please specify 'MacCtrl'.</p>
+<p>* Additionally, on Chrome OS, you can specify 'Search' as a modifier.</p>
+
<p>Certain Chrome shortcuts (e.g. window management) always take priority over
Extension Command shortcuts and can not be overwritten.</p>
},
"_execute_page_action": {
"suggested_key": {
- "default": "Ctrl+E",
- "windows": "Alt+P",
- "mac": "Option+P"
+ "default": "Ctrl+Shift+E",
+ "windows": "Alt+Shift+P",
+ "mac": "Alt+Shift+P"
}
}
}</b>,
popup opening, consider listening for an 'onDomReady' event inside your popup's
code.
</p>
+
+<h2 id="usage">Scope</h2>
+<p>By default, Commands are scoped to the Chrome browser, which means that while
+the browser does not have focus, the shortcut will be inactive. On desktop
+Chrome, Commands can instead have global scope, as of version 35, and will then
+also work while Chrome does *not* have focus. NOTE: The exception here is
+ChromeOS, where global commands are not allowed at the moment.</p>
+
+<p>The user is free to designate any shortcut as global using the UI in
+chrome://extensions \ Keyboard Shortcuts, but the extension developer is limited
+to specifying only Ctrl+Shift+[0..9] as global shortcuts. This is to minimize
+the risk of overriding shortcuts in other applications since if, for example,
+Alt+P were to be allowed as global, the printing shortcut might not work in
+other applications.</p>
+
+<p>Example:</p>
+
+<pre data-filename="manifest.json">
+{
+ "name": "My extension",
+ ...
+ "commands": {
+ "toggle-feature-foo": {
+ "suggested_key": {
+ "default": "Ctrl+Shift+5"
+ },
+ "description": "Toggle feature foo",
+ <b>"global": true</b>
+ }
+ },
+ ...
+}</pre>