Chrome扩展程序命令(键盘快捷键)不起作用 [英] Chrome extension commands (keyboard shortcuts) not working

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

问题描述

任何想法如何让Chrome扩展键盘快捷键在Mac上工作?我在我的manifest.json中有这个

 commands:{
trigger_me:{
recommended_key:{
default:Ctrl + E
},
description:触发器测试
}
}

当我查看键盘快捷键下的Chrome扩展程序标签时,我可以看到触发器测试条目,但实际的快捷键是没有设置。



如何通过manifest.json设置默认快捷方式?

解决方案正如清单键名所暗示的, suggested_key 对键绑定来说只是一个建议。只有在密钥尚未分配给另一个命令时,才会考虑该建议。在Mac中,Ctrl + E转换为Command + E,其中<将href =https://support.google.com/chrome/answer/165450?hl=zh-CN&ref_topic=25799 =noreferrer>分配给使用选择查找。



您可以查看共享指令的列表以查找未使用的组合。例如,Ctrl + Shift + K为我工作。

另一件需要考虑的事情是,建议的密钥仅在首次安装扩展时考虑。禁用和启用,更新或重新加载不会有任何影响。因此,如果您只是在清单中更改了建议的密钥并想测试它,则必须卸载该扩展并重新安装。


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?

解决方案

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.

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

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