1 #include <X11/extensions/scrnsaver.h>
5 * http://coderrr.wordpress.com/2008/04/20/getting-idle-time-in-unix/
7 * compile with 'gcc -l Xss x11idle.c -o x11idle' and copy x11idle into your
11 XScreenSaverInfo
*info
= XScreenSaverAllocInfo();
12 Display
*display
= XOpenDisplay(0);
14 //check that X11 is running or else you get a segafult/coredump
15 if (display
!= NULL
) {
16 XScreenSaverQueryInfo(display
, DefaultRootWindow(display
), info
);
18 XScreenSaverQueryInfo(display
, DefaultRootWindow(display
), info
);
19 printf("%u\n", info
->idle
);