diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | clipnotify.c | 29 |
2 files changed, 31 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0fd72f1 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +all: + ${CC} clipnotify.c -o clipnotify -lX11 -lXfixes diff --git a/clipnotify.c b/clipnotify.c new file mode 100644 index 0000000..8adac43 --- /dev/null +++ b/clipnotify.c @@ -0,0 +1,29 @@ +#include <stdio.h> +#include <stdlib.h> +#include <X11/Xlib.h> +#include <X11/Xatom.h> +#include <X11/extensions/Xfixes.h> + +int main(void) { + Display *disp; + Window root; + Atom clip; + XEvent evt; + + disp = XOpenDisplay(NULL); + if (!disp) { + fprintf(stderr, "Can't open X display\n"); + exit(1); + } + + root = DefaultRootWindow(disp); + + clip = XInternAtom(disp, "CLIPBOARD", False); + + XFixesSelectSelectionInput(disp, root, XA_PRIMARY, XFixesSetSelectionOwnerNotifyMask); + XFixesSelectSelectionInput(disp, root, clip, XFixesSetSelectionOwnerNotifyMask); + + XNextEvent(disp, &evt); + + return 0; +} |