#include #include int main() { Display *dpy; if ((dpy = XOpenDisplay(NULL)) == NULL) { printf("cannot open x\n"); return 1; } KeySym k = XStringToKeysym("a"); int code = XKeysymToKeycode(dpy, k); XEvent ev; while (1) { XNextEvent(dpy, &ev); if (ev.type == MappingNotify) { printf("EV EV!\n"); } } }