Back to Chrome Extensions Samples

chrome.commands

api-samples/commands/README.md

latest874 B
Original Source

chrome.commands

This sample demonstrates the chrome.commands API by defining custom keyboard shortcuts and responding to command events.

Overview

The extension registers two custom keyboard shortcuts in the manifest and listens for them using chrome.commands.onCommand. One command shows a notification, the other toggles a feature on and off with badge text feedback. The popup uses chrome.commands.getAll() to display all registered shortcuts and their current key bindings.

Running this extension

  1. Clone this repository.
  2. Load this directory in Chrome as an unpacked extension.
  3. Use the keyboard shortcuts shown in the popup or customize them at chrome://extensions/shortcuts.