Re: Detect System Idle?

  • Andrew,

    Maybe this will help you: http://ryanhomer.com/blog/2007/05/31/
    detecting-when-your-cocoa-application-is-idle/

    > On Apr 11, 2007, at 3:00 PM, Andrew James wrote:
    >
    >> Hi,
    >>
    >> Is there a method to hook into the system to detect when the
    >> system has been idle for a certain period of time, not just the
    >> application its self but the whole system.
    >>
    >> Like i want to run a method when the system has been idle for n
    >> minutes
    >
    > There is a "private" API called CGSSecondsSinceLastInputEvent that
    > returns the number of seconds since the last input has been
    > received. I use this in a small utility that I have developed and
    > it works under Tiger (10.4.{6,7,8,9}).
    >
    > Being a private API you should be aware of the fact that your
    > application could be incompatible with other OS X versions (past
    > and future).
    >
    > The prototype is: double CGSSecondsSinceLastInputEvent(long evType);
    > CGSSecondsSinceLastInputEvent(-1) would do the trick.
    >
    > Hope this helps.
    >
    > See you,
    > Fabio
previous month june 2007 next month
MTWTFSS
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  
Go to today