Would like to invoke my App while idle.

Hey guys,
I need my application get invoked while my linux box is idle, as in invoking screen saver ?. 
What is the logic to figure out the system idle.  Any clue much appreciated!!!.
Thanks.

You can make use of X11's screensaver extension to get a system's idle time:
(taken from the code for sinac)
#include <X11/extensions/scrnsaver.h>
static XScreenSaverInfo* xss_info = NULL;
int
seconds_idle(Display *d)
if (! xss_info )
xss_info = XScreenSaverAllocInfo();
XScreenSaverQueryInfo(d, DefaultRootWindow(d), xss_info);
return xss_info->idle / 1000;
Of course, that only gives you the duration of the idle time. To do something after a specified timeout of x seconds, you could make use of a loop that checks the time spent idle, then sleeps for (x - seconds_idle(d)) seconds. On the next iteration of the loop, if the system has been idle long enough, whatever action you want to do can be triggered.
I don't know what you're coding this in, though.

Similar Messages

Maybe you are looking for

  • Renaming a SBS 2011 Domain

    hi all, basically i have been asked to help rename the majority of our infrastructure to coincide with a recent business name change. We only run with 1 server unit that has a license of windows sbs 2011 standard edition installed, so that means we h

  • Urgent help in coding of creating New Business partner?

    Hi Friends, I need urgent help on this.Please give me the solution. This is the coding which i written for creating new BP. FUNCTION ZCTS_NEW_CONTACT. ""Local interface: *"  IMPORTING *"     VALUE(BUSINESSPARTNER) LIKE  BAPIBUS1006_HEAD-BPARTNER *"  

  • Frutiger for more languages

    Is there a version of Frutiger that can be used in different languages? The current version does not support the special characters used in, for instance, Polish or Romanian. Is there perhaps a place where I could find a list of the languages support

  • Display and Layer Corruption

    Installed the new 2014 CC Apps yesterday (very exciting!!) and started doing some real work in Photoshop CC 2014 today...at some point i tried to darken a white layer with "Brighten and Contrast" but saw my white layer get filled with mostly black an

  • Problem with License determination

    Hi, I have just setup license determination strategy as per the config guide. But, in the cockpit -> Legal COntrol Exports -> Maintain License determination strategy, Isee only 2 tabs(small views) 1.Legal regulation and 2. License Types Where are oth