From 493e4cd1f0cf831540454426d65b0509a8f32d75 Mon Sep 17 00:00:00 2001 From: Chris Down Date: Mon, 5 Feb 2018 23:37:53 +0000 Subject: Add initial version of clipnotify --- clipnotify.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 clipnotify.c (limited to 'clipnotify.c') 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 +#include +#include +#include +#include + +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; +} -- cgit 1.4.1