I'm developing a Firefox Extension. I added a new item to the "Tools" Menu to open my extension, but I would like to add a keyboard shortcut to open my extension (something like 'control + alt + x').
Open the More Tools menu. Select Extensions. In the upper left corner, click on the hamburger icon and select Keyboard Shortcuts. Find the desired extension and press a combination of “Ctrl” or “Ctrl + Shift” and any other available key.
Video: Make custom Firefox shortcuts and gesturesStep 2: Click on the orange Firefox button, then Options. Step 3: Click on the last tab called Shortcuts. Step 4: Double-click on the shortcut you want to customize, then type in the key combination you prefer to use.
Click on Customize Toolbar. Firefox will open a new page with a list of items that you can drag into the toolbar. Look for Add-ons and themes. Click on Add-ons and themes and drag it into your toolbar.
I've found it by myself
<keyset id="mainKeyset"> <key id="key_convert" key="x" modifiers="accel alt" oncommand="OpenMyAddOn()"/> </keyset>
The commands
key is a good way to do this these days; for instance to toggle the main extension pop up (known as the browser_action
), use the following in manifest.json
:
"commands": {
"_execute_browser_action": {
"suggested_key": {
"default": "Ctrl+Shift+Y"
}
}
}
This also exposes an entry in the Add-ons Manager -> Manage Extension Shortcuts settings area where the user can re-map the keyboard shortcut.
Read more on the documentation page: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/commands
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