Re: screen lock events?
Re: screen lock events?
- Subject: Re: screen lock events?
- From: Carl Harris <email@hidden>
- Date: Fri, 03 Jul 2009 04:38:07 -0400
Are there events that I can observe that indicate when the screen
lock has activated/deactivated? I have a background agent that
should really be disabled when the screen is locked...
Responding to my own post, in hopes that it may help others who find
themselves hunting for how to do detect the activation/deactivation of
the screen lock and/or screensaver...
The following notifications are posted to the default distributed
notification center for events related to the screen lock and screen
saver:
com.apple.screenIsLocked
com.apple.screenIsUnlocked
com.apple.screensaver.didstart
com.apple.screensaver.willstop
com.apple.screensaver.didstop
Getting these events is then a simple matter of registering to observe
them via NSDistributedNotificationCenter. I found them by adding an
observer for *all* distributed events, and then sorting through the
received notification names after activating/deactivating the screen
lock.
I haven't found declarations for these events in a header anywhere,
and I'm not certain that they're part of any published API, but the
events are observable, at least in Leopard.
--
Carl Harris
Virginia Tech
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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