OLD | NEW |
1 <h2 id="manifest">Manifest</h2> | 1 <h2 id="manifest">Manifest</h2> |
2 <p> | 2 <p> |
3 You must set manifest_version to (at least) 2 to use this API. | 3 You must set manifest_version to (at least) 2 to use this API. |
4 </p> | 4 </p> |
5 | 5 |
6 <h2 id="usage">Usage</h2> | 6 <h2 id="usage">Usage</h2> |
7 <p>The commands API allows you to define specific commands, and bind them to a | 7 <p>The commands API allows you to define specific commands, and bind them to a |
8 default key combination. Each command your extension accepts must be listed in | 8 default key combination. Each command your extension accepts must be listed in |
9 the manifest as an attribute of the 'commands' manifest key. An extension can | 9 the manifest as an attribute of the 'commands' manifest key. An extension can |
10 have many commands but only 4 suggested keys can be specified. The user can | 10 have many commands but only 4 suggested keys can be specified. The user can |
11 manually add more shortcuts from the chrome://extensions page.</p> | 11 manually add more shortcuts from the chrome://extensions page.</p> |
12 | 12 |
13 <p>Supported keys: A-Z, 0-9, Comma, Period, Home, End, PageUp, PageDown, Insert, | 13 <p>Supported keys: A-Z, 0-9, Comma, Period, Home, End, PageUp, PageDown, Insert, |
14 Delete, Tab and the arrow keys (Up, Down, Left, Right).</p> | 14 Delete, Tab, Arrow keys (Up, Down, Left, Right) and the Media Keys |
| 15 (MediaNextTrack, MediaPlayPause, MediaPrevTrack, MediaStop).</p> |
15 | 16 |
16 <p>Note: All key combinations must include either Ctrl* or Alt. Combinations | 17 <p>Note: All key combinations must include either Ctrl* or Alt. Combinations |
17 that involve Ctrl+Alt are not permitted in order to avoid conflicts with the | 18 that involve Ctrl+Alt are not permitted in order to avoid conflicts with the |
18 AltGr key. Shift can be used in addition to Alt or Ctrl, but is not required.<p> | 19 AltGr key. Shift can be used in addition to Alt or Ctrl, but is not required. |
| 20 Modifiers (such as Ctrl) can not be used in combination with the Media Keys.<p> |
19 | 21 |
20 <p>* Also note that on Mac 'Ctrl' is automatically converted to 'Command'. If | 22 <p>* Also note that on Mac 'Ctrl' is automatically converted to 'Command'. If |
21 you want 'Ctrl' instead, please specify 'MacCtrl'.</p> | 23 you want 'Ctrl' instead, please specify 'MacCtrl'.</p> |
22 | 24 |
23 <p>Certain Chrome shortcuts (e.g. window management) always take priority over | 25 <p>Certain Chrome shortcuts (e.g. window management) always take priority over |
24 Extension Command shortcuts and can not be overwritten.</p> | 26 Extension Command shortcuts and can not be overwritten.</p> |
25 | 27 |
26 <pre>{ | 28 <pre>{ |
27 "name": "My extension", | 29 "name": "My extension", |
28 ... | 30 ... |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 console.log('Command:', command); | 64 console.log('Command:', command); |
63 }); | 65 }); |
64 </pre> | 66 </pre> |
65 | 67 |
66 <p>The '_execute_browser_action' and '_execute_page_action' commands are | 68 <p>The '_execute_browser_action' and '_execute_page_action' commands are |
67 reserved for the action of opening your extension's popups. They won't normally | 69 reserved for the action of opening your extension's popups. They won't normally |
68 generate events that you can handle. If you need to take action based on your | 70 generate events that you can handle. If you need to take action based on your |
69 popup opening, consider listening for an 'onDomReady' event inside your popup's | 71 popup opening, consider listening for an 'onDomReady' event inside your popup's |
70 code. | 72 code. |
71 </p> | 73 </p> |
OLD | NEW |