Page 1 of 1

Add keyboard shortcuts to Actions

Posted: Wed Jul 10, 2013 9:17 am
by yulan6248
Just as I put in the subject, I'd like to have full control via keyboard.

I think it should pretty easy feature to implement.

Re: Add keyboard shortcuts to Actions

Posted: Wed Jul 10, 2013 10:47 am
by iforce2d
If you are talking about menu navigation shortcuts, this is already possible. In the layout.json file, you can put an ampersand in front of the letter you want to be the shortcut key for each menu entry. As an example:
menuShortcuts.png
menuShortcuts.png (37.78 KiB) Viewed 20218 times
With this setup, you can do A, B, B to add a body, A, B, S to add a body with square fixture etc. See the help topic under "Action menu" -> "Customizing the action menu" for details on setting up this menu.

Am I understanding you correctly?

The next update will allow you to bind key presses to scripts, if that is what you mean. Specifically, you will be able to select scripts to run when a number key is pressed. Here is a screenshot:
scriptHooksDialog.png
scriptHooksDialog.png (72.92 KiB) Viewed 20218 times

Re: Add keyboard shortcuts to Actions

Posted: Sat Jul 13, 2013 12:22 pm
by yulan6248
Hi, thanks for your reply. I was more thinking of the later approach you mentioned (binding a key to a script), but the current approach seems decent to me as well; however, after trying it out on my system (Arch Linux) the default keybindings don't seem to work -- after I press Spacebar, 'a' and then 'b' to get the body actions, the menu will stuck at the second level and pressing the shortcut key for the third level won't work unless I press right arrow to activate it. What I did in the end is to condense the menus into two levels only, and that worked out perfectly for me.