#include #include int main(int argc, char const *argv[]) { Display *dpy; XkbDescPtr xkb; int major = XkbMajorVersion, minor = XkbMinorVersion; dpy = XkbOpenDisplay(NULL, NULL, NULL, &major, &minor, NULL); if (dpy == NULL) { fprintf(stderr, "%s\n", "no display"); return 1; } xkb = XkbGetKeyboard(dpy, XkbAllComponentsMask, XkbUseCoreKbd); if (xkb != NULL) { char *atom_name = XGetAtomName(dpy, xkb->names->keycodes); printf("keycodes %s\n", atom_name); XFree(atom_name); XkbFreeKeyboard(xkb, XkbAllComponentsMask, True); } else { fprintf(stderr, "%s\n", "no keyboard description"); } XCloseDisplay(dpy); return 0; }