Ansh
Ansh

Reputation: 175

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?

Upvotes: 4

Views: 2941

Answers (2)

posita
posita

Reputation: 912

Please note that if you assign a default, that means that users can never unset that shortcut. This is likely an issue with Chromium.

Upvotes: 0

Sergii Rudenko
Sergii Rudenko

Reputation: 2684

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.

Upvotes: 4

Related Questions