commands

The commands API first appeared in Thunderbird 66. It’s more or less the same as the Firefox commands API.

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 file properties

  • [commands] (object)

Note

A manifest entry named commands is required to use commands.

Functions

update(detail)

Update the details of an already defined command.

  • detail (object) The new description for the command.
    • name (string) The name of the command.
    • [description] (string) The new description for the command.
    • [shortcut] (string) An empty string to clear the shortcut, or a string matching the format of the commands manifest.json key to set a new shortcut key. If the string does not match this format, the function throws an error.

reset(name)

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

  • name (string) The name of the command.

getAll()

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

Returns a Promise fulfilled with:

Events

onCommand(command)

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

  • command (string)

Types

Command

object:

  • [description] (string) The Extension Command description
  • [name] (string) The name of the Extension Command
  • [shortcut] (string) The shortcut active for this command, or blank if not active.