Add etc/ORG-NEWS
[org-mode.git] / UTILITIES / x11idle.c
blob33d0035ebaaa7685c2a947bfffbc0f24061758a4
1 #include <X11/extensions/scrnsaver.h>
2 #include <stdio.h>
4 /* Based on code from
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
8 * path
9 */
10 main() {
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);
20 return 0;