允许Chrome扩展程序使用的键盘快捷键 [英] Allowed Keyboard Shortcuts for Chrome Extensions

查看:491
本文介绍了允许Chrome扩展程序使用的键盘快捷键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建Chrome浏览器扩展程序时,您可以通过实施 chrome.commands API。是否有允许的组合键的文件列表?尽管事实上我知道他们没有被我的目标系统所使用,但Chrome似乎拒绝了我提供的所有组合。



我知道键盘快捷键列在此处,但未显示此快捷键列表仍然不起作用。

解决方案

文档是在这方面相当准确。我将引用文档,但请注意它可能会有所变化。这个答案是基于2015-02-09的文档。
$ b


支持的键:AZ,0-9,逗号,句点,首页, (上,下,左,右)和媒体键(MediaNextTrack,MediaPlayPause,MediaPrevTrack,MediaStop)。



<注意:所有组合键必须包含Ctrl *或Alt。不允许包含Ctrl + Alt的组合,以避免与AltGr键冲突。 Shift可以用于Alt或Ctrl之外,但不是必需的。修饰符(如Ctrl)不能与媒体键结合使用。




  • 另请注意,在Mac的Ctrl中,有一个键是从Chrome 33或更高版本中的支持键列表中删除的。自动转换为'Command'。如果你想'Ctrl'代替,请指定'MacCtrl'。

包含 Ctrl Alt ,但不能,可选地包含 Shift ,然后是其中一个支持的键 / p>

另外,


某些Chrome快捷键(例如窗口管理)始终优先于扩展命令快捷方式,不能被覆盖。


这涵盖了Chrome专注于侦听的命令。对于系统级命令,它仅限于 Ctrl + Shift
+ (数字)



Chrome操作系统还有其他特定规则,请阅读相同的文档。




另外请注意,更改已安装扩展的建议密钥可能不会触发其分配。尝试重新安装扩展,而不是在测试时重新加载。

最后,正如Whymarrh所建议的,您可以在 chrome:// extensions中看到键绑定/ configureCommands


When you creating a Chrome browser extension, you may suggest keyboard shortcuts by implementing the chrome.commands API. Is there a documented list of allowed key combinations? Chrome seems to reject virtually every combination I offer despite the fact that I know they are not used by any of the systems I'm targeting.

I'm aware of the keyboard shortcuts listed here, but shortcuts not appearing on this list still do not work.

解决方案

The documentation is quite precise in that respect. I will quote the documentation, but be aware it's subject to change. This answer is based on documentation as of 2015-02-09

Supported keys: A-Z, 0-9, Comma, Period, Home, End, PageUp, PageDown, Space, Insert, Delete, Arrow keys (Up, Down, Left, Right) and the Media Keys (MediaNextTrack, MediaPlayPause, MediaPrevTrack, MediaStop).

Note: All key combinations must include either Ctrl* or Alt. Combinations that involve Ctrl+Alt are not permitted in order to avoid conflicts with the AltGr key. Shift can be used in addition to Alt or Ctrl, but is not required. Modifiers (such as Ctrl) can not be used in combination with the Media Keys. Tab key was removed from list of supported keys in Chrome version 33 and above for accessibility reasons.

  • Also note that on Mac 'Ctrl' is automatically converted to 'Command'. If you want 'Ctrl' instead, please specify 'MacCtrl'.

So, a combination MUST contain Ctrl or Alt but not both, optionally contain Shift and then one of the "supported keys".

Additionally,

Certain Chrome shortcuts (e.g. window management) always take priority over Extension Command shortcuts and can not be overwritten.

This covers commands that Chrome listens to while focused. For system-level commands, it is restricted to Ctrl+Shift +(number)

There are additional rules specifically for Chrome OS, read the same documentation for those.


Also, note that changing suggested keys for an already-installed extension may not trigger their assignment. Try to reinstall the extension instead of reloading it when testing.

Finally, as Whymarrh suggested, you can see the keybindings at chrome://extensions/configureCommands

这篇关于允许Chrome扩展程序使用的键盘快捷键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆