![]() |
| |||||||
can I get notification of system becoming idle? |
| | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
| Does anyone know if there is a way to have a program be notified if the system enters or leaves an idle state? I am aware of Carbon event loop idle timers, but they only apply to the current program, not the system as a whole. I am also aware of the idler.c program that would give me the actual idle time if I asked for it - not what I want. I want to know when the idle time exceeding some value triggers an idle state, and also when it has be reset. (I am not sure if this is what the "busy state" refers to.) I have been going over the IOKit documentation, but am finding it very terse and hard to penetrate. Thanks for any pointers, tips, or sample code, Don -- Donald S. Hall, Ph.D. Apps & More Software Design, Inc. http://www.appsandmore.com don at appsandmore dot com "Schedule your scripts with Script Timer" |
|
#2
| |||
| |||
| Donald Hall <spamback@127.0.0.1> writes: > Does anyone know if there is a way to have a program be notified if the > system enters or leaves an idle state? I am aware of Carbon event loop > idle timers, but they only apply to the current program, not the system > as a whole. I am also aware of the idler.c program that would give me > the actual idle time if I asked for it - not what I want. I want to know > when the idle time exceeding some value triggers an idle state, and also > when it has be reset. (I am not sure if this is what the "busy state" > refers to.) > > I have been going over the IOKit documentation, but am finding it very > terse and hard to penetrate. > > > Thanks for any pointers, tips, or sample code, You didn't mention if you're using Carbon, Cocoa, or something else. If you're using Cocoa, you could watch for NSWorkspaceWillSleepNotification and NSWorkspaceDidWakeNotification. sherm-- -- Cocoa programming in Perl: http://camelbones.sourceforge.net Hire me! My resume: http://www.dot-app.org |
|
#3
| |||
| |||
| In article <m2d5l3zjtz.fsf@Sherm-Pendleys-Computer.local>, Sherm Pendley <sherm@dot-app.org> wrote: > Donald Hall <spamback@127.0.0.1> writes: > > > Does anyone know if there is a way to have a program be notified if the > > system enters or leaves an idle state? I am aware of Carbon event loop > > idle timers, but they only apply to the current program, not the system > > as a whole. I am also aware of the idler.c program that would give me > > the actual idle time if I asked for it - not what I want. I want to know > > when the idle time exceeding some value triggers an idle state, and also > > when it has be reset. (I am not sure if this is what the "busy state" > > refers to.) > > > > I have been going over the IOKit documentation, but am finding it very > > terse and hard to penetrate. > > > > > > Thanks for any pointers, tips, or sample code, > > You didn't mention if you're using Carbon, Cocoa, or something else. If > you're using Cocoa, you could watch for NSWorkspaceWillSleepNotification > and NSWorkspaceDidWakeNotification. > > sherm-- Thanks for the reply, Sherm. I actually have sleep and wake covered - it's idle that I was trying to do. It doesn't appear that there is any publicly available way to be notified of the beginning or end of an idle period. Obviously, there is a way, as something starts the screen saver after the appropriate period of idleness. Don -- Donald S. Hall, Ph.D. Apps & More Software Design, Inc. http://www.appsandmore.com don at appsandmore dot com "Schedule your scripts with Script Timer" |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|