how to launch a shortcut

Talk about add-ons and extension development.
Post Reply
allaf
Posts: 3
Joined: August 14th, 2016, 4:42 am

how to launch a shortcut

Post by allaf »

hi,

Is there a way i can trigger a keyboard shortcut in my extension ?
I would like to do that because i want to call an action form an other extension and i have no idea how to call it directly.


thanks
lithopsian
Posts: 3664
Joined: September 15th, 2010, 9:03 am

Re: how to launch a shortcut

Post by lithopsian »

Do you want to trigger a particular command, or actually mimic a keypress and let Firefox decide which command it is currently configured to execute?
allaf
Posts: 3
Joined: August 14th, 2016, 4:42 am

Re: how to launch a shortcut

Post by allaf »

The latter.
Ideally i would like to launch a particular command but it is part of an external extension i have no control over.
lithopsian
Posts: 3664
Joined: September 15th, 2010, 9:03 am

Re: how to launch a shortcut

Post by lithopsian »

You could hunt down the key element that you're interested in, parse out the command attribute, and fire that command.

The most general way if you absolutely don't know anything about the key command except which key it is, is to init the key event yourself. Everything should behave exactly as if the user pressed the key.
allaf
Posts: 3
Joined: August 14th, 2016, 4:42 am

Re: how to launch a shortcut

Post by allaf »

thanks.
Post Reply