Is it possible to override the Ctrl+D? I want to, for example console.log
or something, and not add the links to the bookmarks.
Alternative Solution: Type chrome:extensions into your browser's address bar. This will pull up the Chrome Extensions page.
Click on Keyboard Shortcuts in the top left menu ("Menu/Burger Button")
Assign Ctrl-D to a plugin that does not alter your Bookmarks.
This will solve the problem that an bookmark is created directly when you accidentally press Ctrl-D, instead the other Addon will pop up in that case.
It's not necessary to use chrome.commands
-- you can use a content script to trap the keydown
event, call preventDefault
and stopPropagation
on it, and handle it however you want. Example snippet that should work as part of a content script:
document.addEventListener('keydown', function(event) {
if (event.ctrlKey && String.fromCharCode(event.keyCode) === 'D') {
console.log("you pressed ctrl-D");
event.preventDefault();
event.stopPropagation();
}
}, true);
The only things you can't override this way are window-handling commands, like ctrl-N
and ctrl-<tab>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With