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.

Manifest keys: commands

Not allowed in: Content scripts, Devtools pages

_OnChangedChangeInfo
_UpdateDetail
Command
onChanged
onCommand
getAll
reset
update
onChanged: WebExtEvent<
    (changeInfo: browser.commands._OnChangedChangeInfo) => void,
>

Fired when a registered command's shortcut is changed.

onCommand: WebExtEvent<(command: string) => void>

Fired when a registered command is activated using a keyboard shortcut.

  • Returns all the registered extension commands for this extension and their shortcut (if active).

    Returns Promise<Command[]>

  • Reset a command's details to what is specified in the manifest.

    Parameters

    • name: string

      The name of the command.

    Returns Promise<void>

  • Update the details of an already defined command.

    Parameters

    Returns Promise<void>