Reputation: 17984
I have set up a hotkey in my manifest.json file, and a bogus listener in my background.js
If i hit the hotkey combination, it works.
Now, i'm missing how to actually do what i want it to do: launch the extension's browser_action : open the popup.html (which is a search your bookmarks input field).
I've been looking for a method like chrome.trigger('browserAction');
Perhaps i'm missing something really obvious...
my background.js
chrome.commands.onCommand.addListener(function(command) {
alert('Command:'+ command);
});
manifest.json (extract)
"commands": {
"browser_action": {
"suggested_key": {
"default": "Ctrl+Shift+U",
"mac": "Alt+Shift+U"
},
"description": "Opens the extension"
}
},
"browser_action": {
"default_title": "YURLS",
"default_icon": "icon16.png",
"default_popup": "popup.html"
},
Upvotes: 1
Views: 86
Reputation: 17984
ah. Simply changing the command name to the magic word _execute_browser_action
in the manifest.json file did the trick.
"commands": {
"_execute_browser_action": {
"suggested_key": {
"default": "Ctrl+Shift+U",
"mac": "Alt+Shift+U"
},
"description": "Opens Yurl"
}
}
Upvotes: 1