I've found another solution, but there is a problem while i try to compile the source code.
This is the code:
Code:
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/scrnsaver.h>
#include <gdk/gdkx.h>
int main(void){
static XScreenSaverInfo *mit_info = NULL;
int event_base, error_base;
if (XScreenSaverQueryExtension(GDK_DISPLAY(), &event_base, &error_base)) {
mit_info = XScreenSaverAllocInfo();
XScreenSaverQueryInfo(GDK_DISPLAY(), GDK_ROOT_WINDOW(), mit_info);
printf("Idle Time: %i\n", mit_info->idle);
} else {
printf("No Display available");
}
return 0;
}
And this is my compilercall:
Code:
gcc -I/usr/X11R6/include -I/${GTK-DIR}/1.2.10/include/gtk-1.2 -I${GLIB-DIR}/1.2.10/include/glib-1.2 -I${GLIB-DIR}/lib/glib/include -L${GTK-DIR}/1.2.10/i686-pc-linux-gnuoldld/lib -L/usr/X11R6/lib -L/usr/X11R6/lib/X11 -lXss -lX11 -lgdk idle.c
Now the compiler throws the following error:
Code:
/tmp/ccYXOUio.o(.text+0x33): In function `main':
: undefined reference to `XScreenSaverQueryExtension'
/tmp/ccYXOUio.o(.text+0x3c): In function `main':
: undefined reference to `XScreenSaverAllocInfo'
/tmp/ccYXOUio.o(.text+0x60): In function `main':
: undefined reference to `XScreenSaverQueryInfo'
collect2: ld returned 1 exit status
Anybody got an idea why this happens?