Skip to content

Instantly share code, notes, and snippets.

@wwalker
Created November 12, 2019 02:14
Show Gist options
  • Save wwalker/661930a9029ff1d8de1294d57ce3f180 to your computer and use it in GitHub Desktop.
Save wwalker/661930a9029ff1d8de1294d57ce3f180 to your computer and use it in GitHub Desktop.
#include "grab-keyboard.h"
int main(int argc, char **argv)
{
Display *dpy;
int x=0;
XEvent ev;
if((dpy = XOpenDisplay(NULL)) == NULL) {
perror(argv[0]);
exit(1);
}
XGrabKeyboard(dpy, 0x3c00022,
False, GrabModeAsync, GrabModeAsync, CurrentTime);
for (x=0;x<=10; x++) {
XNextEvent(dpy, &ev);
printf("%d\n", XSendEvent(dpy, 0x3c00022, False, NoEventMask, &ev));
}
XUngrabKeyboard(dpy, CurrentTime);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment