Add Keyboard Shortcut for Firefox Extension

I am developing a Firefox extension. I added a new item to the Tools menu to open the extension, but I would like to add a key combination to open my extension (something like "control + alt + x").

+6
source share
2 answers

I found it myself

<keyset id="mainKeyset"> <key id="key_convert" key="x" modifiers="accel alt" oncommand="OpenMyAddOn()"/> </keyset> 
+7
source

If you need to add a shortcut to your own Firefox menu to perform the addon action, you need to edit extension\content\firebug\firefox\browserMenu.js and add accesskey :

  // Firefox page context menu $menupopupOverlay(doc, $(doc, "contentAreaContextMenu"), [ $menuseparator(doc), $menuitem(doc,{ id: "menu_ext", .... accesskey: "s" }) ]); 
0
source

Source: https://habr.com/ru/post/904272/


All Articles