Search code examples
ckeyboardxlib

How can I get the KeyCode associated to a given KeySym?


I have seen that XGetKeyboardMapping() would let me do that, but the documentation is opaque and I haven’t been able to find any examples. Any idea?


Solution

  • You are looking for:

    KeyCode XKeysymToKeycode(display, keysym) Display *display; KeySym keysym;

    keycode1 = XKeysymToKeycode(display, XK_dead_acute);

    Also see this answer