Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configurable keyboard shortcut without using content scripts

Chrome Extension: I am looking for a way to assign global keyboard shortcuts that can be invoked even when the current tab has no content (and hence no content script). Some examples of such tabs: 'new tab' tabs, chrome://extensions tabs, 'page not loaded' tabs, etc Use cases for such a requirement are operations like close tab, go to next/prev tab, etc.

The chrome.commands api allows one to do this. However, there seems to be no way for the user to configure these keyboard shortcuts, which is something I'd really want my extension to allow.

Is there any way to get configurable keyboard shortcuts that don't need a content script?

like image 946
Himanshu P Avatar asked Apr 29 '13 14:04

Himanshu P


1 Answers

The shortcut for chrome.commands cannot be changed by the extension, but it is configurable by the user. This interface is built-in and offered by Chrome itself.

Visit the extensions page, scroll down and click on the Configure commands link. A box will be shown, where the user can set the preferred shortcut:

The code for the "Remap shortcut" extension is posted in this answer.

like image 139
Rob W Avatar answered Dec 06 '22 03:12

Rob W