OLD | NEW |
1 <h2 id="manifest">Manifest</h2> | 1 <h2 id="manifest">Manifest</h2> |
2 <p> | 2 <p> |
3 You must have a <code>"manifest_version"</code> of at least <code>2</code> to us
e this API. | 3 You must have a <code>"manifest_version"</code> of at least <code>2</code> to us
e this API. |
4 </p> | 4 </p> |
5 | 5 |
6 {{?is_apps +partials.warning_dev /}} | 6 {{?is_apps +partials.warning_dev /}} |
7 | 7 |
8 <h2 id="usage">Usage</h2> | 8 <h2 id="usage">Usage</h2> |
9 <p>The commands API allows you to define specific commands, and bind them to a | 9 <p>The commands API allows you to define specific commands, and bind them to a |
10 default key combination. Each command your extension accepts must be listed in | 10 default key combination. Each command your extension accepts must be listed in |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 generate events that you can handle. If you need to take action based on your | 78 generate events that you can handle. If you need to take action based on your |
79 popup opening, consider listening for an 'onDomReady' event inside your popup's | 79 popup opening, consider listening for an 'onDomReady' event inside your popup's |
80 code. | 80 code. |
81 </p> | 81 </p> |
82 | 82 |
83 <h2 id="usage">Scope</h2> | 83 <h2 id="usage">Scope</h2> |
84 <p>By default, Commands are scoped to the Chrome browser, which means that while | 84 <p>By default, Commands are scoped to the Chrome browser, which means that while |
85 the browser does not have focus, the shortcut will be inactive. On desktop | 85 the browser does not have focus, the shortcut will be inactive. On desktop |
86 Chrome, Commands can instead have global scope, as of version 35, and will then | 86 Chrome, Commands can instead have global scope, as of version 35, and will then |
87 also work while Chrome does *not* have focus. NOTE: The exception here is | 87 also work while Chrome does *not* have focus. NOTE: The exception here is |
88 ChromeOS, where global commands are not allowed at the moment.</p> | 88 Chrome OS, where global commands are not allowed at the moment.</p> |
89 | 89 |
90 <p>The user is free to designate any shortcut as global using the UI in | 90 <p>The user is free to designate any shortcut as global using the UI in |
91 chrome://extensions \ Keyboard Shortcuts, but the extension developer is limited | 91 chrome://extensions \ Keyboard Shortcuts, but the extension developer is limited |
92 to specifying only Ctrl+Shift+[0..9] as global shortcuts. This is to minimize | 92 to specifying only Ctrl+Shift+[0..9] as global shortcuts. This is to minimize |
93 the risk of overriding shortcuts in other applications since if, for example, | 93 the risk of overriding shortcuts in other applications since if, for example, |
94 Alt+P were to be allowed as global, the printing shortcut might not work in | 94 Alt+P were to be allowed as global, the printing shortcut might not work in |
95 other applications.</p> | 95 other applications.</p> |
96 | 96 |
97 <p>Example:</p> | 97 <p>Example:</p> |
98 | 98 |
99 <pre data-filename="manifest.json"> | 99 <pre data-filename="manifest.json"> |
100 { | 100 { |
101 "name": "My extension", | 101 "name": "My extension", |
102 ... | 102 ... |
103 "commands": { | 103 "commands": { |
104 "toggle-feature-foo": { | 104 "toggle-feature-foo": { |
105 "suggested_key": { | 105 "suggested_key": { |
106 "default": "Ctrl+Shift+5" | 106 "default": "Ctrl+Shift+5" |
107 }, | 107 }, |
108 "description": "Toggle feature foo", | 108 "description": "Toggle feature foo", |
109 <b>"global": true</b> | 109 <b>"global": true</b> |
110 } | 110 } |
111 }, | 111 }, |
112 ... | 112 ... |
113 }</pre> | 113 }</pre> |
OLD | NEW |