mirror of
https://github.com/GoogleChrome/chrome-extensions-samples.git
synced 2026-03-26 13:19:49 +07:00
Add a new MV3 sample demonstrating the chrome.commands API. The sample registers custom keyboard shortcuts in the manifest, handles command events in the service worker with notifications and badge text feedback, and uses chrome.commands.getAll() in the popup to display all registered shortcuts. Closes #1126
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
- Clone this repository.
- Load this directory in Chrome as an unpacked extension.
- Use the keyboard shortcuts shown in the popup or customize them at
chrome://extensions/shortcuts.