Last active
December 28, 2019 16:42
-
-
Save hoelzro/78a2464b80051ca93b437363b69e5f62 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <X11/Xlib.h> | |
| #include <X11/Xatom.h> | |
| #include <X11/Xmu/Atoms.h> | |
| #define die(fmt, args...)\ | |
| fprintf(stderr, fmt "\n", ##args);\ | |
| exit(1) | |
| int | |
| main(void) | |
| { | |
| Display *dsp; | |
| Window selection; | |
| dsp = XOpenDisplay(NULL); | |
| if(!dsp) { | |
| die("Couldn't connect to X"); | |
| } | |
| selection = XGetSelectionOwner(dsp, XA_PRIMARY); | |
| if(selection == None) { | |
| fprintf(stderr, "no selection owner\n"); | |
| } else { | |
| printf("0x%x\n", selection); | |
| } | |
| XCloseDisplay(dsp); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment