Reputation: 510
I am trying to show a chrome extension popup from a trigger to shortcut keys like(ctrl+shift+U).
Manifest Json:
"commands": {
"generate_link": {
"suggested_key": {
"default": "Ctrl+K",
"mac": "Command+K"
},
"description": "Builds link copy to extension."
},
"show-interface": {
"suggested_key": {
"default": "Ctrl+Shift+K",
"mac": "Command+Shift+K"
},
"description": "Show builder interface2."
}
Background script:
chrome.commands.onCommand.addListener(function(command) {
chrome.tabs.update({}, function(tab) {
if (command == 'generate_link')
{
//need to show extension window with some info about the current tab
getLink(tablink)
}
else if (command == 'show-interface')
alert('show-interface');
});
});
Is there any function that could trigger the same task that happens when we click on browser_action icon.
This could be simple but new to chrome extensions and terminology, didn't find any good references for this kind of problem.
Upvotes: 2
Views: 564
Reputation: 510
Actually found it, this in command section is used to trigger the chrome extension open from shortcut.
"_execute_browser_action": {
"suggested_key": {
"default": "Ctrl+Shift+K",
"mac": "Command+Shift+K"
}
It was a misunderstanding of terminologies. Thanks.
Upvotes: 1
Reputation: 5672
Try adding "global": true
. Here's a reference for chrome commands: https://developer.chrome.com/extensions/commands
Upvotes: 1