I am working on extension, i want my chrome extension to toggle (show / hide) via command like say (mac: "CMD+SHIFT+9" or default: "Ctrl+Shift+9"); Though i have defined command in my manifest file:
{
.........
"commands": {
"toggle-window": {
"suggested_key": {
"default": "Ctrl+Shift+9",
"mac": "Command+Shift+9"
},
"description": "Toggle feature foo",
"global": true
},
........
}
Now, What can i do in my backgroundScript.js to do that?
my backgroundScript.js is:
chrome.commands.onCommand.addListener(function(command) {
if(command === "toggle-window") {
console.log('Command:', command);
/* Logic to show/hide will go here..*/
}
});
How do i do do that? Thanks!
Sample Extension demo that have this "show/hide" feature implemented:
https://chrome.google.com/webstore/detail/meldium-browser-extension/fdocegmnehjgfhfjelhmaobjccoiklle