chrome.commands keyboard shortcuts not working

前端 未结 10 1258
有刺的猬
有刺的猬 2020-12-03 07:57

I am trying to add some keyboard shortcuts to my Chrome extension, specifically to allow the user to use hotkeys to open up a browser action/popup. I\'ve read the d

相关标签:
10条回答
  • 2020-12-03 08:21

    On Chrome 29 you have to navigate to chrome://extensions/ and scroll down to the bottom of the page. On the right side there is a button Keyboard shortcuts.

    Modal dialog pops up with all extensions that have registered some commands in their manifest file. But the shortcuts itself are Not set so the user must set them manually.

    0 讨论(0)
  • 2020-12-03 08:21

    If you modified your code after loading your extension, you need to remove and reload it.

    0 讨论(0)
  • 2020-12-03 08:23

    Guys this is very obvious!

    • Ctrl+Shift+J
    • Ctrl+Shift+S
    • Ctrl+Shift+U

    All are built in browser functions!
    Which cannot be overridden!
    Just simply make your shortcut not a built in one.

    A list of Chrome browser shortcuts can be found here

    Example:

    • Ctrl+Shift+L

    Would work to trigger Browser_Action.

    0 讨论(0)
  • 2020-12-03 08:26

    Your (and my) Command+Shift+Y keystroke is likely being used by another OSX app (possibly stickies).

    This works on my Mac/Chrome combo (changed the Y to U):

    "browser_action": {
      "default_popup": "browser_action.html"
    },
    "commands": {
      "_execute_browser_action": {
        "suggested_key": {
          "default": "Ctrl+Shift+U",
          "windows": "Ctrl+Shift+U",
          "mac": "Command+Shift+U",
          "chromeos": "Ctrl+Shift+U",
          "linux": "Ctrl+Shift+U"
        }
      }
    }
    

    Does it work for you?

    0 讨论(0)
提交回复
热议问题