我正在经历chrome.commands.onCommand.addListener
帮助我定义特定命令并将其绑定到组合键的事件。
{
"name": "My extension",
...
"commands": {
"toggle-feature-foo": {
"suggested_key": {
"default": "Ctrl+Shift+Y",
"mac": "Command+Shift+Y"
},
"description": "Toggle feature foo"
},
"_execute_browser_action": {
"suggested_key": {
"windows": "Ctrl+Shift+Y",
"mac": "Command+Shift+Y",
"chromeos": "Ctrl+Shift+U",
"linux": "Ctrl+Shift+J"
}
},
"_execute_page_action": {
"suggested_key": {
"default": "Ctrl+E"
"windows": "Alt+P",
"mac": "Option+P",
}
}
},
...
}
我的问题是,如何绑定一个组合键来注册另一个组合键,而不是像教程所示的那样启动 browser_action.html。
例如:我想通过[鼠标中键+P]来注册Ctrl+P。