Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <fcntl.h>
- #include <errno.h>
- #include <termios.h>
- #include <unistd.h>
- #include <xdo.h>
- #include <X11/Xlib.h>
- #include <X11/keysym.h>
- int main()
- {
- sleep(1); //wait 1 second
- printf("creating xdo...\n");
- xdo_t* myXdo = xdo_new(NULL);
- printf("xdo created...\n");
- printf("getting display...\n");
- // Obtain the X11 display.
- Display *display = XOpenDisplay(0);
- if(display == NULL)
- {
- printf("could not open display, exiting...\n");
- return -1;
- }
- printf("getting root window...\n");
- // Window focus
- int revert;
- Window winFocus;
- while(1)
- {
- XGetInputFocus(display, &winFocus, &revert);
- xdo_keysequence_up(myXdo, winFocus, "A", 100);
- xdo_keysequence_down(myXdo, winFocus, "A", 100);
- usleep(1000 * 1000);
- }
- printf("exiting...\n");
- XCloseDisplay(display);
- xdo_free(myXdo);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement