Search code examples
jsongoogle-chromegoogle-chrome-extensionmanifest

Adding keyboard shortcuts to execute Chrome extension


I have created a chrome extension which I'd like to cause execution using a keyboard shortcut.

Snippet:

"suggested_key": {
  "default": "Ctrl+Shift+F"

I've tried different combinations such as "Ctrl+Shift+A", "Ctrl+Shift+D", "Alt+X" and "Space+B"

None of these seems to work. Am I spelling out Alt or Space wrong?


Solution

  • The suggested key from your manifest file works only if there is no other action bound to the same keyboard shortcut.

    From documentation:

    The user is free to designate any shortcut as global using the UI in chrome://extensions \ Keyboard Shortcuts, but the extension developer is limited to specifying only Ctrl+Shift+[0..9] as global shortcuts. This is to minimize the risk of overriding shortcuts in other applications since if, for example, Alt+P were to be allowed as global, the printing shortcut might not work in other applications.

    So, Ctrl+Shift+F it's a setting in a View menu of the Chrome. You need to override it manually or find another shortcut.

    Also, you need to re-install your extension to activating a new shortcut from the manifest.