Calling a function of any sort every few milliseconds just to see if
it was called "on-time" will waste CPU cycles... just the sort of
thing that would get your widget deleted from my Mac, and would
potentially frustrate the average user.
What if EVERY widget did this?
All of a sudden the Mac becomes a lot more windows like with faceless
things running in the background taking up CPU cycles with no clear
indication what it is. In this situation "DashboardClient" becomes
only slightly better than "run.dll" or "svchost.exe"...
If the interval was a little larger (say 30 seconds) and you observe
that it's been more than 31 seconds, then perhaps you could assume the
user had slept and reawakened the computer in that time window.
Perhaps an even more reasonable approach would be to have your widget
tail the system log to look for the most recent wake event:
tail /var/log/system.log | grep 'System Wake'
returns something like this:
Jul 1 08:44:10 errol kernel[0]: System Wake
However, this approach would require admin privileges...
Can you give a little more information about why you need to know if
the computer is going to sleep or waking up?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/dashboard-dev/email@hidden