I have a firefox extension which can be activated by a shortcut key. I want users to be able to change the key combo dynamically.
My XUL looks like this
<keyset id="ksMain">
<key id="keyDoMyThing" modifiers="control,shift" key="e" command="cmdDoMyThing"/>
</keyset>
cmdDoMyThing is a reference to an element in a commandset. When I press ctrl+shift+e, the command fires.
I tried both modifying the existing element and creating a new element using JavaScript, but while I can get the old key combo to stop working, I can't get the new one to happen. Here's an example of the code I'm using
keyelem = document.createElement('key');
keyelem.setAttribute('id', 'keyDoMyThing');
keyelem.setAttribute('command', 'cmdDoMyThing');
keyelem.setAttribute('key', key);
keyelem.setAttribute('modifiers', modstr);
keyset.appendChild(keyelem);
I can use the debugger to verify that modstr is set to the proper string and key is set to the key I want to use.
How can I make this happen the way I would like?