I want to monitor screensaver and lockscreen events on an OSX box. As a first pass, I\'m fine with them just printing to the console.
Following the advice of another\'s
It appears the strategy you're trying to use for this won't work, because the com.apple.screensaver.* notifications are no longer supported.
In the replies to this equivalent question, it is mentioned that: 'for Snow Leopard the screenIsLocked and screenIsUnlocked notifications aren't available anymore.'
You can register for screen sleeps, which of course is not the same but may be an acceptable alternative for you, by listening to the NSWorkspaceScreensDidSleepNotification notification, or to the computer going to sleep by listening to the NSWorkspaceWillSleepNotification. Sample code can be found on this forum.
Sidenote: if you use nil for the name, you will receive lots of events:
[center addObserver:self
selector:@selector(receive:)
name:nil
object:nil
];
If you do that, you will see that you're doing everything basically right, because you will receive all kind of events - but no screensaver ones.