13

Any idea how I can get Chrome extension keyboard shortcuts working on a Mac? I have this in my manifest.json

"commands": {
  "trigger_me": {
    "suggested_key": {
      "default": "Ctrl+E"
    },
    "description": "Trigger test"
  }
}

When I look in the Chrome Extensions tab under Keyboard shortcuts I can see the 'Trigger test' entry but the actual shortcut is not set.

How can I set a default shortcut via manifest.json?

1 Answer 1

51

As the manifest key name implies, suggested_key is only a suggestion for key binding. That suggestion will be taken into consideration only if the key is not already assigned to another command. In a Mac, "Ctrl+E" translates to "Command+E", which is assigned to "Uses selection for find".

You can review the list of commonly assigned shorcuts to find some combination that is unused. For instance, "Ctrl+Shift+K" worked for me.

Another thing to have in mind is that suggested keys are only considered when an extension is first installed. Disabling and enabling, updating, or reloading won't have any effect. So if you just changed the suggested key in your manifest and want to test it, you have to uninstall the extension and install it again.

5
  • 22
    +1 How did you find out about the re-installing requirement. That was a nasty one :)
    – gkalpak
    Commented Dec 22, 2013 at 10:41
  • As of 2014 reinstalling shouldn't be required. As per this: code.google.com/p/chromium/issues/detail?id=336420 Commented Jun 1, 2015 at 7:07
  • 1
    If you have for example DEV and PROD version of a extension, meaning both have same shortcut defined, then only first installed will work even if other is IS disabled.
    – Gapipro
    Commented Jan 18, 2016 at 13:07
  • 2
    Another caveat: when I change the name of my command, Reload is not sufficient for the change to take effect. I need to uninstall and re-install the extension in order for the suggested key action to have any effect.
    – mark
    Commented Dec 23, 2017 at 3:14
  • 1
    Wow - +1 to having to remove/reload the extension. I wasted an hour on this and could not figure out why the keystrokes worked if I set them via chrome://extensions/shortcuts
    – empire29
    Commented Oct 30, 2020 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.