XkbSetNames(3)
π XkbSetNames π
okay so bestie, this is the XkbSetNames(3) page from the XKB FUNCTIONS manual, and it is literally about changing the symbolic names in the server. itβs giving keyboard lore, no cap. π¦
πΈ NAME πΈ
XkbSetNames β change the symbolic names in the server. thatβs the whole name vibe, periodt. π
β¨ SYNOPSIS β¨
Bool XkbSetNames (Display *dpy, unsigned int which, unsigned int
first_type, unsigned int num_types, XkbDescPtr xkb);
π ARGUMENTS π
dpyβ connection to the X server. yes bestie, the whole connection. πwhichβ mask of names or map components to be changed.first_typeβ first type whose name is to be changed.num_typesβ number of types for which names are to be changed.xkbβ keyboard description from which names are to be taken. itβs the source of truth, okay? π
π DESCRIPTION π
To change the symbolic names in the server, first modify a local copy of the keyboard description, then either use XkbSetNames or β to save network traffic β use an XkbNameChangesRec structure (the page mashes it into XkbNameChangesRecstructure, iconic formatting chaos, iykyk) and call XkbChangeNames to download the changes to the server. XkbSetNames and XkbChangeNames can generate BadAlloc, BadAtom, BadLength, BadMatch, and BadImplementation errors. π
Use XkbSetNames to change many names at the same time. For each bit set in which, XkbSetNames takes the corresponding value (or values in the case of arrays) from the keyboard description xkb and sends it to the server. π
The first_type and num_types arguments are used only if XkbKeyTypeNamesMask or XkbKTLevelNamesMask is set in which and specify a subset of the types for which the corresponding names are to be changed. If either or both of these mask bits are set but the specified types are illegal, XkbSetNames returns False and does not update any of the names specified in which. The specified types are illegal if xkb does not include a map component or if first_type and num_types specify types that are not defined in the keyboard description. π«Ά
π§ STRUCTURES π§
The XkbNameChangesRec allows applications to identify small modifications to the symbolic names and effectively reduces the amount of traffic sent to the server:
typedef struct _XkbNameChanges {
unsigned int changed; /* name components that have changed */
unsigned char first_type; /* first key type with a new name */
unsigned char num_types; /* number of types with new names */
unsigned char first_lvl; /* first key type with new level names */
unsigned char num_lvls; /* number of key types with new level names */
unsigned char num_aliases; /* if key aliases changed, total number of key aliases */
unsigned char num_rg; /* if radio groups changed, total number of radio groups */
unsigned char first_key; /* first key with a new name */
unsigned char num_keys; /* number of keys with new names */
unsigned short changed_vmods; /* mask of virtual modifiers for which names have changed */
unsigned long changed_indicators; /* mask of indicators for which names were changed */
unsigned char changed_groups; /* mask of groups for which names were changed */
} XkbNameChangesRec, *XkbNameChangesPtr
The changed field specifies the name components that have changed and is the bitwise inclusive OR of the valid names mask bits defined in Table 1. The rest of the fields in the structure specify the ranges that have changed for the various kinds of symbolic names, as shown in Table 2. π«
Xkb provides several functions that work with symbolic names. Each of these functions uses a mask to specify individual fields of the structures described above. These masks and their relationships to the fields in a keyboard description are shown in Table 1. β¨
π¦ Table 1 Symbolic Names Masks π¦
mask bit / value / keyboard component / field:
XkbKeycodesNameMaskβ value(1<<0); keyboard componentXkb->names; fieldkeycodes.XkbGeometryNameMaskβ value(1<<1); keyboard componentXkb->names; fieldgeometry.XkbSymbolsNameMaskβ value(1<<2); keyboard componentXkb->names; fieldsymbols.XkbPhysSymbolsNameMaskβ value(1<<3); keyboard componentXkb->names; fieldphys_symbols.XkbTypesNameMaskβ value(1<<4); keyboard componentXkb->names; fieldtype.XkbCompatNameMaskβ value(1<<5); keyboard componentXkb->names; fieldcompat.XkbKeyTypeNamesMaskβ value(1<<6); keyboard componentXkb->map; fieldtype[*].name.XkbKTLevelNamesMaskβ value(1<<7); keyboard componentXkb->map; fieldtype[*].lvl_names[*].XkbIndicatorNamesMaskβ value(1<<8); keyboard componentXkb->names; fieldindicators[*].XkbKeyNamesMaskβ value(1<<9); keyboard componentXkb->names; fieldkeys[*],num_keys.XkbKeyAliasesMaskβ value(1<<10); keyboard componentXkb->names; fieldkey_aliases[*],num_key_aliases.XkbVirtualModNamesMaskβ value(1<<11); keyboard componentXkb->names; fieldvmods[*].XkbGroupNamesMaskβ value(1<<12); keyboard componentXkb->names; fieldgroups[*].XkbRGNamesMaskβ value(1<<13); keyboard componentXkb->names; fieldradio_groups[*],num_rg.XkbComponentNamesMaskβ value(0x3f); keyboard componentXkb->names; fieldkeycodes,geometry,symbols,physical symbols,types, andcompatibility map.XkbAllNamesMaskβ value(0x3fff); keyboard componentXkb->names; fieldall name components.
π Table 2 XkbNameChanges Fields π
mask / fields / component / field:
XkbKeyTypeNamesMaskβ fieldsfirst_type,num_types; componentXkb->map; fieldtype[*].name.XkbKTLevelNamesMaskβ fieldsfirst_lvl,num_lvls; componentXkb->map; fieldtype[*].lvl_names[*].XkbKeyAliasesMaskβ fieldsnum_aliases; componentXkb->names; fieldkey_aliases[*].XkbRGNamesMaskβ fieldsnum_rg; componentXkb->names; fieldradio_groups[*].XkbKeyNamesMaskβ fieldsfirst_key,num_keys; componentXkb->names; fieldkeys[*].XkbVirtualModNamesMaskβ fieldschanged_vmods; componentXkb->names; fieldvmods[*].XkbIndicatorNamesMaskβ fieldschanged_indicators; componentXkb->names; fieldindicators[*].XkbGroupNamesMaskβ fieldschanged_groups; componentXkb->names; fieldgroups[*].
π DIAGNOSTICS π
BadAllocβ Unable to allocate storage. πBadAtomβ A name is neither a validAtomorNone.BadImplementationβ Invalid reply from server. πBadLengthβ The length of a request is shorter or longer than that required to minimally contain the arguments.BadMatchβ A compatible version of Xkb was not available in the server or an argument has correct type and range, but is otherwise invalid.
π SEE ALSO π
XkbChangeNames(3) β thatβs the one, bestie. go read it after this. π«Ά
okay thatβs the whole page! footer source/version energy: X Version 11, libX11 1.8.14, and the XkbSetNames(3) tag. the supplied footer does not show a date, so we are not inventing one β no fake date, periodt. ππ
π¦ where this page comes from
- alpine 3.24: libx11-doc 1.8.14-r0 Β· X11
- arch rolling: libx11 1.8.14-1 Β· MIT AND X11
- nixos 26.05: libx11 1.8.14
- nixpkgs unstable: libx11 1.8.14
- Copyright (c) 1999, Oracle and/or its affiliates
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms