chrome.commands键盘快捷键不适用于我 [英] chrome.commands keyboard shortcuts not working for me

查看:109
本文介绍了chrome.commands键盘快捷键不适用于我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的 Chrome扩展程序添加一些键盘快捷键,特别是允许用户使用热键打开浏览器动作/弹出窗口。我已阅读文档,并将以下代码行添加到 manifest.json 文件中:

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 documentation, and added the following lines of code to the manifest.json file:

"commands": {
  "_execute_browser_action": {
    "suggested_key": {
      "windows": "Ctrl+Shift+Y",
      "mac": "Command+Shift+Y",
      "chromeos": "Ctrl+Shift+U",
      "linux": "Ctrl+Shift+J"
    }
  }
}

添加后,我将我的扩展重新加载到了 chrome:// extensions ,然后在我的 Mac 上尝试 Command + Shift + Y ,并且没有任何事情发生。大约2个小时后,我尝试在 manifest.json 中设置不同的热键组合,但都没有工作。我从开发版的 Chrome 切换到稳定版本,但无济于事。当我前往 chrome:// extensions 并点击右下方的键盘快捷键按钮时,我可以手动设置热键组合,然后运行。但我不希望用户必须做这些手动工作。

After adding this, I reloaded my extension in chrome://extensions and proceeded to try out Command+Shift+Y on my Mac and nothing happened. For about 2 hours, I tried setting different hotkey combinations in manifest.json, but none worked. I switched from the dev version of Chrome to the stable version but to no avail. When I went to chrome://extensions and clicked on the 'Keyboard Shortcuts' button at the bottom right, I was able to manually set a hotkey combination and then it worked. But I don't want the user to have to do that manual work.

我错过了一些真正明显的东西吗?

Am I missing something really obvious?

推荐答案

不知何故,当我将快捷方式设置为仅包含 Ctrl / Cmd / Alt / Shift 。因此, Alt + S 无法正常工作,但 Alt + Shift + S

Somehow the keyboard shortcuts started working after I set the shortcuts to contain just one of Ctrl / Cmd / Alt / Shift. So, Alt+S worked but Alt+Shift+S did not work.

这篇关于chrome.commands键盘快捷键不适用于我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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