commands.json (6473B)
1 [ 2 { 3 "namespace": "manifest", 4 "types": [ 5 { 6 "id": "KeyName", 7 "type": "string", 8 "format": "manifestShortcutKey" 9 }, 10 { 11 "$extend": "WebExtensionManifest", 12 "properties": { 13 "commands": { 14 "type": "object", 15 "optional": true, 16 "additionalProperties": { 17 "type": "object", 18 "additionalProperties": { "$ref": "UnrecognizedProperty" }, 19 "properties": { 20 "suggested_key": { 21 "type": "object", 22 "optional": true, 23 "properties": { 24 "default": { 25 "$ref": "KeyName", 26 "optional": true 27 }, 28 "mac": { 29 "$ref": "KeyName", 30 "optional": true 31 }, 32 "linux": { 33 "$ref": "KeyName", 34 "optional": true 35 }, 36 "windows": { 37 "$ref": "KeyName", 38 "optional": true 39 }, 40 "chromeos": { 41 "type": "string", 42 "optional": true 43 }, 44 "android": { 45 "type": "string", 46 "optional": true 47 }, 48 "ios": { 49 "type": "string", 50 "optional": true 51 }, 52 "additionalProperties": { 53 "type": "string", 54 "deprecated": "Unknown platform name", 55 "optional": true 56 } 57 } 58 }, 59 "description": { 60 "type": "string", 61 "preprocess": "localize", 62 "optional": true 63 } 64 } 65 } 66 } 67 } 68 } 69 ] 70 }, 71 { 72 "namespace": "commands", 73 "description": "Use the commands API to add keyboard shortcuts that trigger actions in your extension, for example, an action to open the browser action or send a command to the xtension.", 74 "permissions": ["manifest:commands"], 75 "types": [ 76 { 77 "id": "Command", 78 "type": "object", 79 "properties": { 80 "name": { 81 "type": "string", 82 "optional": true, 83 "description": "The name of the Extension Command" 84 }, 85 "description": { 86 "type": "string", 87 "optional": true, 88 "description": "The Extension Command description" 89 }, 90 "shortcut": { 91 "type": "string", 92 "optional": true, 93 "description": "The shortcut active for this command, or blank if not active." 94 } 95 } 96 } 97 ], 98 "events": [ 99 { 100 "name": "onCommand", 101 "description": "Fired when a registered command is activated using a keyboard shortcut.", 102 "type": "function", 103 "parameters": [ 104 { 105 "name": "command", 106 "type": "string" 107 }, 108 { 109 "name": "tab", 110 "$ref": "tabs.Tab", 111 "optional": true, 112 "description": "Details of the $(ref:tabs.Tab) where the command was activated." 113 } 114 ] 115 }, 116 { 117 "name": "onChanged", 118 "description": "Fired when a registered command's shortcut is changed.", 119 "type": "function", 120 "parameters": [ 121 { 122 "type": "object", 123 "name": "changeInfo", 124 "properties": { 125 "name": { 126 "type": "string", 127 "description": "The name of the shortcut." 128 }, 129 "newShortcut": { 130 "type": "string", 131 "description": "The new shortcut active for this command, or blank if not active." 132 }, 133 "oldShortcut": { 134 "type": "string", 135 "description": "The old shortcut which is no longer active for this command, or blank if the shortcut was previously inactive." 136 } 137 } 138 } 139 ] 140 } 141 ], 142 "functions": [ 143 { 144 "name": "update", 145 "type": "function", 146 "async": true, 147 "description": "Update the details of an already defined command.", 148 "parameters": [ 149 { 150 "type": "object", 151 "name": "detail", 152 "description": "The new description for the command.", 153 "properties": { 154 "name": { 155 "type": "string", 156 "description": "The name of the command." 157 }, 158 "description": { 159 "type": "string", 160 "optional": true, 161 "description": "The new description for the command." 162 }, 163 "shortcut": { 164 "type": "string", 165 "format": "manifestShortcutKeyOrEmpty", 166 "optional": true 167 } 168 } 169 } 170 ] 171 }, 172 { 173 "name": "reset", 174 "type": "function", 175 "async": true, 176 "description": "Reset a command's details to what is specified in the manifest.", 177 "parameters": [ 178 { 179 "type": "string", 180 "name": "name", 181 "description": "The name of the command." 182 } 183 ] 184 }, 185 { 186 "name": "getAll", 187 "type": "function", 188 "async": "callback", 189 "description": "Returns all the registered extension commands for this extension and their shortcut (if active).", 190 "parameters": [ 191 { 192 "type": "function", 193 "name": "callback", 194 "optional": true, 195 "parameters": [ 196 { 197 "name": "commands", 198 "type": "array", 199 "items": { 200 "$ref": "Command" 201 } 202 } 203 ], 204 "description": "Called to return the registered commands." 205 } 206 ] 207 }, 208 { 209 "name": "openShortcutSettings", 210 "type": "function", 211 "async": true, 212 "description": "Open extension shortcuts configuration page.", 213 "parameters": [] 214 } 215 ] 216 } 217 ]