Actually, this is even simpler.
On Thu, Aug 27, 2009 at 1:13 AM, Aurélien Aptel<[email protected]> wrote:
> On Thu, Aug 27, 2009 at 1:46 AM, <[email protected]> wrote:
>> Thanks for the application suggestions. how can I get the current cursor
>> location from the CLI?
>
> See attached file.
>
/* Compile: cc -lX11 xcursor xcursor.c */
#include <stdio.h>
#include <X11/Xlib.h>
int
main(int argc, char *argv[])
{
Display *dpy;
Window junk1;
unsigned int junk3;
int x, y;
int junk2;
int r;
dpy = XOpenDisplay(0);
if (XQueryPointer(dpy, DefaultRootWindow(dpy), &junk1, &junk1,
&x, &y, &junk2, &junk2, &junk3) != 0) {
printf("%d %d\n", x, y);
r = 0;
} else
r = 1;
XCloseDisplay(dpy);
return r;
}