emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
blob 33d0035ebaaa7685c2a947bfffbc0f24061758a4 632 bytes (raw)
name: UTILITIES/x11idle.c 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
 
#include <X11/extensions/scrnsaver.h>
#include <stdio.h>

/* Based on code from
 * http://coderrr.wordpress.com/2008/04/20/getting-idle-time-in-unix/
 *
 * compile with 'gcc -l Xss x11idle.c -o x11idle' and copy x11idle into your
 * path
 */
main() {
    XScreenSaverInfo *info = XScreenSaverAllocInfo();
    Display *display = XOpenDisplay(0);

    //check that X11 is running or else you get a segafult/coredump
    if (display != NULL) {
	XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
    }
    XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
    printf("%u\n", info->idle);
    return 0;
}

debug log:

solving 33d0035 ...
found 33d0035 in https://git.savannah.gnu.org/cgit/emacs/org-mode.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).