Update HTML options names in the manual and ox-html.el.
[org-mode.git] / contrib / scripts / x11idle.c
blob22cefe1e6b262ec008f9036cf4ef85e9438a75a1
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 //open the display specified by the DISPLAY environment variable
13 Display *display = XOpenDisplay(0);
15 //display could be null if there is no X server running
16 if (info == NULL || display == NULL) {
17 return -1;
20 //X11 is running, try to retrieve info
21 if (XScreenSaverQueryInfo(display, DefaultRootWindow(display), info) == 0) {
22 return -1;
25 //info was retrieved successfully, print idle time
26 printf("%lu\n", info->idle);
27 return 0;