Jump to: navigation, search

Howto:Reassign keyboard bindings

2,050 bytes added, 13:30, 8 April 2014
no edit summary
Thus the key is found at index 14.
If the key isn't listed in keyboard.xml, the last option is to enable some helpful output to see what the correct keycode is. Uncomment {{git file|gitorious|fg/fgdata|master|keyboard.xml|39|pre=line #34 of <nowiki> </nowiki> }} and run with the <tt>--console</tt> option, if on windows, and look in glutat the console to see each keycode for each key.hMake sure you can see the output as you press keys, or you won't know which is which! When I press and release {{key press|a}}, I get this output:<syntaxhighlight lang="nasal">{ key: 97, modifier: { meta: 0, shift: 0, alt: 0, super: 0, ctrl: 0, hyper: 0 }, pressed: 1 }{ key: 97, modifier: { meta: 0, shift: 0, alt: 0, super: 0, ctrl: 0, hyper: 0 }, pressed: 0 }</syntaxhighlight>This shows that key 97 was pressed (without any modifiers) and then released. This view can also help with combining modifiers, like mod-meta above. == Adding custom bindings ==The "easiest" option for many is to edit keyboard.xml in place, because it just works. If you do this, make sure to keep a backup of it, in case you need to revert back to the default setup, or simply download it from [ gitorious (v3.0)] or [ gitorious (master)]. Another option, that ends up cleaner, is using a pretty common config file. These are specified on the commandline with '''<tt>--config</tt>''', like this:<syntaxhighlight lang="bash">fgfs --config=/Users/philosopher/Documents/FlightGear/keyboard-config.xml</syntaxhighlight>These can be formatted in the same way as keyboard.xml, with the exception of requiring input and one onlinekeyboard tags, so it looks like this:<syntaxhighlight lang="xml"><?xml version="1.0"?><PropertyList><input><keyboard> <key n="....">...</key> <!-- etc. --></keyboard></input></PropertyList></syntaxhighlight>This makes sure it writes to the correct place in the tree, viz. /input/keyboard/. This allows you to more easily keep several different files for different types of setups, without having to rename them before starting FG, you only need to change the filename passed in the <tt>--config=</tt> option.

Navigation menu