Firefox add-on development: Register global dynamic custom keyboard shortcuts

Posted by dezwart on Stack Overflow See other posts from Stack Overflow or by dezwart
Published on 2010-05-21T03:53:05Z Indexed on 2010/05/21 4:00 UTC
Read the original article Hit count: 248

I have been tasked with developing a Firefox add-on that is capable of registering global keyboard shortcuts (ones that will work throughout all areas of Firefox) that will open up the side-bar and execute an XMLRPC request based on previously recorded input. The idea here is that there will be many potential XMLRPC requests that the user will want to execute via a keyboard shortcut.

Currently, the add-on is capable of handling pre-defined static keyboard shortcuts via the Firefox overlay. What I would like to achieve, is to allow the user to register their own dynamic custom keyboard shortcut.

There is an add-on that currently has some of this functionality, called Keyconfig. I'm not keen on having to ask users to install a second add-on to define their own shortcuts. It also seems that using the dynamic keyboard shortcut registration method in Keyconfig would require the user to close all Firefox windows before the dynamic shortcut is made available.

What I would like to know is:

  • Is an XPCOM component the best way to register dynamic keyboard shortcuts from within a Firefox add-on?
  • Is there a way to register the keyboard shortcut so that it is immediately available to all Firefox windows, without having to close the windows beforehand?

© Stack Overflow or respective owner

Related posts about firefox-addon

Related posts about keyboard-shortcuts