orschiro
orschiro

Reputation: 21735

Enable default keyboard shortcut for a Chrome extension

Is it possible to set a default keyboard shortcut for an extension by default?

What changes are required in manifest.json to have that default keyboard shortcut set by default when a given extension is installed?

enter image description here

Upvotes: 1

Views: 1372

Answers (2)

posita
posita

Reputation: 912

Please note that if you assign a default, that means that users who install the extension can never unset that shortcut. This is likely an issue with Chromium.

Upvotes: 0

Sudarshan
Sudarshan

Reputation: 18534

The commands API allows you to define specific commands1, and bind them to a default key combination2. Each command your extension accepts must be listed in the manifest as an attribute of the 'commands' manifest key.

1: Commands Format

Properties of Command

    name ( optional string )
        The name of the Extension Command EX: 'execute_browser_action' or '_execute_page_action' or some other custom name
    description ( optional string )
        The Extension Command description 
    shortcut ( optional string )
        The shortcut active for this command, or blank if not active. 

2:Combinations Possible

Combinations that involve Ctrl+Alt are not permitted in order to avoid conflicts with the AltGr key. Also note that on Mac Ctrl is automatically converted to Command. If you want Ctrl instead, please specify MacCtrl

SO Reference for Additional Information:

Google Chrome: maximum of 4 chrome.commands allowed?

Reference:

Hope this helps :)

Upvotes: 2

Related Questions