Default Ui Keys Reference

Default Ui Keys Reference

Quick Notes:

  1. The built-in default bindings are always loaded. If you wish to override them, use the unbindall and unbind commands to delete them at the beginning of your ‘uikeys.txt’.
  2. More then one action can be bound to a specific keyset. The actions for any given keyset are tried in the order that they were bound. The first currently available command that matches an action is used.
  3. As a slight modification to the above note, keysets that use the ‘Any’ modifier are tried after those that do not use it.
  4. A keyset using the Shift modifier should be bound with its unshifted key (ex: bind “Shift+.” instead of “Shift+>” )

Commands that can be used in this file:

unbindall

  • removes all bindings, and adds “bind enter chat” (one of the other unbind commands can get rid of that one)
  • good for deleting the default bindings

keysym <name> <keycode>

  • add a custom key symbol (the default key symbols can not be overridden)
  • name must start with a letter, and only contain letters, numbers, and ‘_’
  • the <keycode> can be a currently recognized keysym (ex: “keysym menu 0x13F” or “keysym radar r”)

fakemeta <keysym>

  • assign an auxiliary key for the Meta modifier (“space” is a good choice)
  • use “fakemeta none” to disable this feature

bind <keyset> <action>

  • appends the action to the keyset’s list of actions
  • the action can be just a command, or a command with arguments

unbind <keyset> <action>

  • removes the action from the keyset’s list of actions
  • both the action and the keyset must match

unbindkeyset <keyset>

  • removes all bindings that use the keyset

unbindaction <action>

  • removes all bindings that use the action (command that is, a misnomer)
  • NOTE: These commands can also be run from the chat line in-game using the slash command syntax (/bind, /unbind, etc…)

Keyset Format:

A keyset is a combination of keys, the main key and its modifiers.

Here are some examples:

bind            a  fake_action
bind       Ctrl+a  fake_action
bind          C+a  fake_action
bind Ctrl+Shift+a  fake_action
bind          *+a  fake_action

The format then goes like this:

[\<Modifier\>+]...[\<Modifier\>+]\<keysym\>

The modifiers (and their abbreviations), are:

Any   (*)
Alt   (A)
Ctrl  (C)
Meta  (M)
Shift (S)

The special ‘Any’ modifier makes it so that the keyset matches regardless of the current state of the real modifiers.

The known keysyms (key symbols), are listed at the end of this file. If you want to use a key that is unknown to Spring, then you may use the hexadecimal notation. Here are two equivalent bindings:

bind Ctrl+0x20  firestate 0   hold fire
bind Ctrl+space firestate 0   hold fire

Keychains (new in 98.0):

A keychain is a timed combination of keysets, i.e. “press A, then B”.

Here are some examples:

bind            a,b  fake_action
bind Ctrl+a, Ctrl+b  fake_action

The format then goes like this:

\<keyset\>, \<keyset\>, ...

Extra Run-Time Commands

/keyload : loads the uikeys.txt bindings (does not clear current bindings) /keyreload : loads the uikeys.txt bindings (clears current bindings first) /keysave : save current bindings to ‘uikeys.tmp’ (NOTE: ’tmp’ vs. ’txt’) /keysyms : prints the known keysyms to standard out /keycodes : prints the known keycodes to standard out /keyprint : prints the current bindings to standard out /keydebug : prints debugging information to standard out (for each keystroke)

Default Bindings: see rts/Game/UI/KeyBindings.cpp

Key SymbolKey Code
!0x021
"0x022
#0x023
$0x024
%0x025
&0x026
'0x027
(0x028
)0x029
*0x02A
+0x02B
,0x02C
-0x02D
.0x02E
/0x02F
00x030
10x031
20x032
30x033
40x034
50x035
60x036
70x037
80x038
90x039
:0x03A
;0x03B
<0x03C
=0x03D
>0x03E
?0x03F
@0x040
[0x05B
\0x05C
]0x05D
^0x05E
_0x05F
`0x060
a0x061
alt0x134
b0x062
backspace0x008
c0x063
clear0x00C
ctrl0x132
d0x064
delete0x07F
down0x112
e0x065
end0x117
enter0x00D
esc0x01B
escape0x01B
f0x066
f10x11A
f100x123
f110x124
f120x125
f130x126
f140x127
f150x128
f20x11B
f30x11C
f40x11D
f50x11E
f60x11F
f70x120
f80x121
f90x122
g0x067
h0x068
home0x116
i0x069
insert0x115
j0x06A
joy00x12C
joy10x12D
joy20x12E
joy30x12F
joy40x130
joy50x131
joy60x132
joy70x133
joydown0x141
joyleft0x142
joyright0x143
joyup0x140
joyw0x193
joyx0x190
joyy0x191
joyz0x192
k0x06B
l0x06C
left0x114
m0x06D
meta0x136
n0x06E
numpad*0x10C
numpad+0x10E
numpad-0x10D
numpad.0x10A
numpad/0x10B
numpad00x100
numpad10x101
numpad20x102
numpad30x103
numpad40x104
numpad50x105
numpad60x106
numpad70x107
numpad80x108
numpad90x109
numpad=0x110
numpad_enter0x10F
o0x06F
p0x070
pagedown0x119
pageup0x118
pause0x013
printscreen0x13C
q0x071
r0x072
return0x00D
right0x113
s0x073
shift0x130
space0x020
t0x074
tab0x009
u0x075
up0x111
v0x076
w0x077
x0x078
y0x079
z0x07A
{0x07B
|0x07C
}0x07D
~0x07E