libxkbcommon 1.14.0-beta1
Library implementing the XKB specification for parsing keyboard descriptions and handling keyboard state
Loading...
Searching...
No Matches
Keysym encoding
Collaboration diagram for Keysym encoding:

Description of the keysyms encoding and the categories of keysyms.

See also
Appendix A “Keysym Encoding” of the X Window System Protocol.
Appendix C “New keysyms” of the XKB Protocol Specification.

Encoding

@important Keysyms are 32-bit integers whoose 3 most significant bits are always set to zero. Thus valid keysyms are in the range 0 – 0x1fffffff = XKB_KEYSYM_MAX.

Note
Throughout this documentation, keysyms values are viewed as four bytes, numbered from most significant to least significant:
Byte 1
The most significant 8 bits: 3 zero bits and the most-significant 5 bits of the 29-bit effective value.
Byte 2
The next most-significant 8 bits
Byte 3
The next most-significant 8 bits
Byte 4
The least-significant 8 bits

Categories

There are 6 categories:

Overview

Category Subcategory Byte 1 Byte 2 Byte 3 Byte 4 First keysym Last keysym
Special keysyms 0 0 0 0 `NoSymbol`
Latin-1 keysyms ASCII non-control characters 0 0 0 0x20 – 0x7e `space` `asciitilde`
Latin-1 Supplement 0xa0 – 0xff `nobreakspace` `ydiaeresis`
Legacy keysyms Latin-2 0 0 0x01 0x00 – 0xff `Aogonek` `abovedot`
Latin-3 0x02 `Hstroke` `scircumflex`
Latin-4 0x03 `kra` `umacron`
Kana 0x04 `overline` `semivoicedsound`
Arabic 0x05 `Arabic_comma` `Arabic_sukun`
Cyrillic 0x06 `Serbian_dje` `Cyrillic_HARDSIGN`
Greek 0x07 `Greek_ALPHAaccent` `Greek_omega`
Technical 0x08 `leftradical` `downarrow`
Special 0x09 `blank` `vertbar`
Publishing 0x0a `emspace` `cursor`
APL 0x0b `leftcaret` `righttack`
Hebrew 0x0c `hebrew_doublelowline` `hebrew_taf`
Thai 0x0d `Thai_kokai` `Thai_lekkao`
Korean 0x0e `Hangul_Kiyeog` `Korean_Won`
Latin-5 0x0f
Latin-6 0x10
Latin-7 0x11
Latin-8

0x12

Latin-9 0x13 `OE` `Ydiaeresis`
Currency 0x20 `EuroSign`
Function keysyms IBM 3270 terminals 0 0 0xfd 0x00 – 0xff `3270_Duplicate` `3270_Enter`
Keyboard (XKB) Extension 0xfe `ISO_Lock` `Pointer_Drag5`
Keyboard 0xff `BackSpace` `Delete`
Special keysyms 0 0xff 0xff 0xff `VoidSymbol`
Unicode keysyms 0x01 0x00 – 0x10 0x00 – 0xff 0x00 – 0xff 0x01000100 0x0110ffff
Vendor keysyms DEC, HP, misc. 0x10 0x00 0x00 – 0xff 0x00 – 0xff 0x10000000 0x1000ffff
0x10 0x01 – 0x03 0x10010000 0x1003ffff
OSF 0x10 0x04 0x10040000 0x1004ffff
Sun 0x10 0x05 0x10050000 0x1005ffff
0x10 0x06 – 0x07 0x10060000 0x1007ffff
XFree86 0x10 0x08 0x10080000 0x1008ffff
0x10 – 0x1f 0x09 – 0xff 0x10090000 0x1fffffff

Special keysyms

There are 2 special values: `NoSymbol` and `VoidSymbol`. They are used to indicate the absence of symbols.

Byte 1 Byte 2 Byte 3 Byte 4 Hex. value Name
0 0 0 0 0x00000000 `NoSymbol`
0 255 255 255 0x00ffffff `VoidSymbol`
See also
Appendix A “Special keysyms” of the X Window System Protocol.

Latin-1 keysyms

The Latin-1 keysyms occupy the range 0x0020 – 0x007E and 0x00a0 – 0x00ff and represent the ISO 10646 / Unicode characters U+0020 – U+007E and U+00A0 – U+00FF, respectively.

See also
ISO/IEC 8859-1 character encoding
Appendix A “Latin-1 keysyms” of the X Window System Protocol.

Legacy keysyms

Legacy keysyms date from the time before ISO 10646 / Unicode was available. They represent characters from a number of different older 8-bit coded character sets and have zero values for bytes 1 and 2. Byte 3 indicates a coded character set and byte 4 is the 8-bit value of the particular character within that set.

Byte 3
Value Character set Comment
1 Latin-2
2 Latin-3
3 Latin-4
4 Kana
5 Arabic
6 Cyrillic
7 Greek
8 Technical Based on DEC Technical‌: add 0x880 to the original code point
9 Special Based on DEC Special Graphics‌: add 0x980 to the original code point
10 Publishing
11 APL
12 Hebrew
13 Thai
14 Korean
15 Latin-5
16 Latin-6
17 Latin-7
18 Latin-8
19 Latin-9
32 Currency

Each character set contains gaps where codes have been removed that were duplicates with codes in previous character sets (that is, character sets with lesser byte 3 value).

Todo:
Legacy keysyms
See also
Latin-1 keysyms
Appendix A “Legacy keysyms” of the X Window System Protocol.

Function keysyms

Function keysyms represent keycap symbols that do not directly represent elements of a coded character set. Instead, they typically identify a software function, mode, or operation (e.g., cursor up, caps lock, insert) that can be activated using a dedicated key. Function keysyms have zero values for bytes 1 and 2. Byte 3 distinguishes between several 8-bit sets within which byte 4 identifies the individual function key.

Byte 1 Byte 2 Byte 3 Byte 4
Value Value Value Function set Value
0 0 253IBM 3270 terminals (individual function key)
254Keyboard (XKB) Extension
255Keyboard
Todo:
Function keysyms
See also
Appendix A “Function keysyms” of the X Window System Protocol.
Appendix C “New keysyms” of the XKB Protocol Specification.

Unicode keysyms

The Unicode keysyms occupy the range 0x01000100 – 0x0110FFFF and represent the ISO 10646 / Unicode characters U+0100 – U+10FFFF, respectively. The numeric value of a Unicode keysym is the Unicode code point of the corresponding character plus 0x01000000. In the interest of backwards compatibility, clients should be able to process both the Unicode keysym and the legacy keysym for those characters where both exist.

Note
Dead keys, which place an accent on the next character entered, shall be encoded as function keysyms, and not as the Unicode keysym corresponding to an equivalent combining character.
Where a keycap indicates a specific function with a graphical symbol that is also available in Unicode (e.g., an upwards arrow for the cursor up function), the appropriate function keysym should be used, and not the Unicode keysym corresponding to the depicted symbol.
See also
Appendix A “Unicode keysyms” of the X Window System Protocol.
Unicode technical website.

Vendor keysyms

Vendor keysyms are vendor-specific extentions in the range 0x10000000 – 0x1fffffff. Among these, the range 0x11000000 – 0x1100ffff is designated for keypad keysyms.

See also
Appendix A “Vendor keysyms” of the X Window System Protocol.