XkbTranslateKeyCode(3)

πŸŽ€ NAME πŸŽ€

XkbTranslateKeyCode(3) β€” from the XKB FUNCTIONS manual β€” is literally the function that translates a keycode to a key symbol and modifiers. Bestie, it’s giving keyboard translator era and I’m obsessed. πŸ’–

✨ SYNOPSIS ✨

Bool XkbTranslateKeyCode (XkbDescPtr xkb, KeyCode key, unsigned int
       mods, unsigned int *mods_rtrn, KeySym *keysym_rtrn);

🧚 ARGUMENTS 🧚

  • xkb β€” the keyboard description to use for translation. Like the map, the lore, the whole keyboard vibe. πŸ—ΊοΈ
  • key β€” the keycode to translate. The raw key ID stepping into the function. πŸ”‘
  • mods β€” modifiers to apply when translating the key. The modifier energy you’re feeding in. ✨
  • mods_rtrn β€” backfilled with consumed modifiers. Yes, it’s the output slot, not a typo. πŸ’…
  • keysym_rtrn β€” keysym resulting from translation. The final symbol reveal. 🎁

πŸ’œ DESCRIPTION πŸ’œ

Okay so mods_rtrn is backfilled with the modifiers consumed by the translation process. No cap, that’s its whole job. 🫢

mods is a bitwise inclusive OR of the legal modifier masks: ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask. That’s the whole lineup, bestie β€” not one missing. 🌈

The AlwaysConsumeShiftAndLock library control (see below πŸ‘‡), if enabled, causes XkbTranslateKeyCode to consume shift and lock. Iconic behavior. πŸŽ€

XkbTranslateKeyCode returns True if the translation resulted in a keysym, and False if it resulted in NoSymbol. That’s the vibe check: symbol = True, no symbol = False. βœ…πŸ’€

The AlwaysConsumeShiftAndLock control, if enabled, forces XLookupString to consume the Shift and Lock modifiers when processing all keys, even if the definition for the key type does not specify these modifiers. The AlwaysConsumeShiftAndLock control is unset by default. 🚨

🌸 SEE ALSO 🌸


That’s the whole page, periodt. πŸ’… This one’s from X Version 11, libX11 1.8.14, and the manual page is literally XkbTranslateKeyCode(3). Mwah πŸ’‹

πŸ“¦ where this page comes from