XStringToKeysym(3)
π XStringToKeysym(3) π
okay so welcome to the XLIB FUNCTIONS manual, bestie β this page is all about the keysym-conversion squad, and yes, it's giving main character energy. π
πΈ NAME πΈ
The squad: XStringToKeysym, XKeysymToString, XKeycodeToKeysym, XKeysymToKeycode, XConvertCase β and their whole thing is convert keysyms. Periodt. β¨
β¨ SYNTAX β¨
KeySym XStringToKeysym(_Xconst char *string);
char *XKeysymToString(KeySym keysym);
KeySym XKeycodeToKeysym(Display *display, KeyCode keycode, int index);
KeyCode XKeysymToKeycode(Display *display, KeySym keysym);
void XConvertCase(KeySym keysym, KeySym *lower_return, KeySym
*upper_return);
π¦ ARGUMENTS π¦
displayβ Specifies the connection to the X server. Your X server link, basically. πindexβ Specifies the element ofKeyCodevector. It's the little index slot, bestie. πΈkeycodeβ Specifies theKeyCode. The actual keycode in question. πkeysymβ Specifies theKeySymthat is to be searched for or converted. The keysym main character. πlower_returnβ Returns the lowercase form ofkeysym, orkeysym. So if there's no lowercase glow-up, you getkeysymback. πstringβ Specifies the name of theKeySymthat is to be converted. The name string, literally. π¦upper_returnβ Returns the uppercase form ofkeysym, orkeysym. Same deal, but uppercase. β¨
π DESCRIPTION π
okay so the standard KeySym names? They come from X11/keysymdef.h, and you get each one by removing the XK_ prefix from the name. That's the whole trick, no cap. π«Ά
KeySyms that are not part of the Xlib standard also may be obtained with this function β iconic β but the set of KeySyms that are available in this manner and the mechanisms by which Xlib obtains them is implementation-dependent. So it's a vibe, but not a universal promise, iykyk. π
If the KeySym name is not in the Host Portable Character Encoding, the result is implementation-dependent. If the specified string does not match a valid KeySym, XStringToKeysym returns NoSymbol. That's the vibe check failing, bestie. π
The returned string is in a static area and must not be modified β do not touch it, just admire it from afar. The returned string is in the Host Portable Character Encoding. If the specified KeySym is not defined, XKeysymToString returns a NULL. π§
XKeycodeToKeysym uses internal Xlib tables and returns the KeySym defined for the specified KeyCode and the element of the KeyCode vector. If no symbol is defined, XKeycodeToKeysym returns NoSymbol. Also, important lore: XKeycodeToKeysym predates the XKB extension. If you want to lookup a KeySym while using XKB you have to use XkbKeycodeToKeysym β that's the rule, fr fr. π₯
If the specified KeySym is not defined for any KeyCode, XKeysymToKeycode returns zero. Zero, bestie. Not a keysym, not a slay. π
XConvertCase returns the uppercase and lowercase forms of the specified Keysym, if the KeySym is subject to case conversion; otherwise, the specified KeySym is returned to both lower_return and upper_return. Support for conversion of other than Latin and Cyrillic KeySyms is implementation-dependent β so Latin and Cyrillic are the main characters here, and anything else is a maybe. πΈ
π SEE ALSO π
XkbKeycodeToKeysym(3)XLookupKeysym(3)Xlib - C Language X Interface
go read these too, bestie β they're part of the extended universe. π¦
mwah π β source/version tea: X Version 11, libX11 1.8.14; the footer didn't give me a date, so I'm not inventing one, bestie π«Ά
π¦ 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
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms