Change the shortcut for the reject button

Hi :slight_smile:

Is it possible to change the shortcut for the reject button? So for instance the shortcut is not β€œx” but the number β€œ3”?

P.s. Thanks for a great tool! :slight_smile:

Thanks! It turned out to be a bit trickier than I thought to allow changing the keyboard shortcuts at runtime, so I haven't implemented that yet. But in the meantime, you could probably use a workaround similar to this one:

You can use this handy tool to find the codes for different keys. The code for the x key would be 88.

Within the event listener block, you should then be able to add something like this to submit a "reject" answer if the 3 key is pressed:

if (event.keyCode === 51) {  // key code for "3"

(Just keep in mind that the number keys are also used in the choice interface to allow selecting the different options. So if you're using that interface, you might get a clash here.)

Hi Ines,

I wonder where to put the javascript code for the event listener. I need to change the shortcut for the button accept to enter.

Thank you for the answer :'D

hi @ctoto93,

Thanks for your question. One way to include javascript code is to put it in the "config" key in the return object of a custom recipe.

For example:

Alternatively, if you want to have the javascript code to run globally (i.e., on all recipes), you can also put it in the prodigy.json config file.

But if you're simply interested in changing the keyboard shortcut for the accept, you can also do this on the config file without javascript. This is newer functionality that was created since this original post.

Let me know if you have any further questions!

Hi, @ryanwesslen

Glad that it is provided out of the box. Thank you for your answer :'D