Adding keyboard shortcuts to execute Chrome extension

℡╲_俬逩灬. 提交于 2021-02-05 06:48:46

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/48293594/adding-keyboard-shortcuts-to-execute-chrome-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!