向 Firefox 扩展添加键盘快捷键
我正在开发一个 Firefox 扩展。我在“工具”菜单中添加了一个新项目来打开我的扩展程序,但我想添加一个键盘快捷键来打开我的扩展程序(例如“control + alt + x”)。
I'm developing a Firefox Extension. I added a new item to the "Tools" Menu to open my extension, but I would like to add a keyboard shortcut to open my extension (something like 'control + alt + x').
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如今,
commands
键是执行此操作的好方法;例如,要切换主扩展弹出窗口(称为browser_action
),请在manifest.json
中使用以下内容:这还会在 Add- 中公开一个条目昂斯经理->管理扩展快捷键设置区域,用户可以在其中重新映射键盘快捷键。
在文档页面上阅读更多内容:
https://developer.mozilla.org /en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/commands
The
commands
key is a good way to do this these days; for instance to toggle the main extension pop up (known as thebrowser_action
), use the following inmanifest.json
:This also exposes an entry in the Add-ons Manager -> Manage Extension Shortcuts settings area where the user can re-map the keyboard shortcut.
Read more on the documentation page:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/commands
我自己找到了
I've found it by myself
如果您需要在 Firefox 自带的菜单中添加快捷键来执行插件操作,那么您需要编辑
扩展名\content\firebug\firefox\browserMenu.js
并添加accesskey:
If you need to add shortcut key to Firefox own menu to execute addon action, then you need to edit
extension\content\firebug\firefox\browserMenu.js
and add accesskey: