browser.commands

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 extension.

Manifest

The following keys must be declared in the manifest to use this API.

"commands"

Concepts and usage

The Commands API allows extension developers to define specific commands, and bind them to a default key combination. Each command an extension accepts must be declared as properties of the "commands" object in the extension's manifest.

The property key is used as the command's name. Command objects can take two properties.

suggested_key

An optional property that declares default keyboard shortcuts for the command. If omitted, the command will be unbound. This property can either take a string or an object value.

  • A string value specifies the default keyboard shortcut that should be used across all platforms.

    • An object value allows the extension developer to customize the keyboard shortcut for each platform. When providing platform-specific shortcuts, valid object properties are default, chromeos, linux, mac, and windows.

    See Key combination requirements for additional details.

description
A string used to provide the user with a short description of the command's purpose. This string appears in extension keyboard shortcut management UI. Descriptions are required for standard commands, but are ignored for Action commands.

An extension can have many commands, but may specify at most four suggested keyboard shortcuts. The user can manually add more shortcuts from the chrome://extensions/shortcuts dialog.

Supported Keys

The following keys are usable command shortcuts. Key definitions are case sensitive. Attempting to load an extension with an incorrectly cased key will result in a manifest parse error at installation time.

Alpha keys
AZ