Home

Keysyms

Keysyms, short for key symbols, are 32-bit identifiers used by the X Window System to represent the symbolic value of a key in keyboard input events. They sit between the hardware KeyCode (the physical key) and characters or actions, and are produced by the keyboard mapping managed by XKB. Applications read KeySyms from events or translate them to Unicode or other representations, often by comparing them with predefined constants such as XK_A, XK_Return, or XK_Left.

Keysyms cover both printable characters and a wide range of special keys. Printable ASCII characters typically

Keysyms are defined in the X11 families of headers (notably keysymdef.h) and are part of the X11

map
directly
to
their
Unicode
code
points
(for
example
the
KeySym
for
'A'
corresponds
to
0x0041).
Special
keys,
including
function
keys,
arrows,
and
modifiers,
have
values
in
the
0xFF00
to
0xFFFF
range
(for
example
XK_Return,
XK_Left,
XK_F1).
A
single
physical
key
may
yield
multiple
KeySyms
depending
on
the
keyboard
state
and
layout
(levels
and
modifiers).
protocol
and
XKB
mapping
process.
The
relationship
to
Unicode
is
provided
by
the
XKB
server
and
libraries,
but
not
every
KeySym
has
a
direct
Unicode
equivalent.
In
practice,
software
libraries
such
as
Xlib
and
XCB
use
KeySyms
to
interpret
input,
while
toolkits
may
provide
higher-level
abstractions
for
text
input
and
command
shortcuts.
While
newer
input
systems
exist
in
other
environments,
Keysyms
remain
a
core
concept
for
X11-based
applications
and
interoperability.