mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-12-22 10:26:23 +00:00
0410d6460c
This needs a small C program (in UTILITIES/x11idle.c) to work.
22 lines
632 B
C
22 lines
632 B
C
#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;
|
|
}
|