• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Detect System Idle?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detect System Idle?


  • Subject: Re: Detect System Idle?
  • From: Ryan Homer <email@hidden>
  • Date: Mon, 4 Jun 2007 09:03:25 -0400

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
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: NSButtonCell inside custom NSCell not responding to mouse events
  • Next by Date: How to determine if any intermediate directory in path is link?
  • Previous by thread: Re: NSButtonCell inside custom NSCell not responding to mouse events
  • Next by thread: How to determine if any intermediate directory in path is link?
  • Index(es):
    • Date
    • Thread