Detect when splash screen activates with Cocoa

Is there a way to trigger an action when the Mac OS X splash screen activates or when it goes into sleep mode (preferably with cocoa)?

+5
source share
2 answers

You can register for various distributed notifications - at 10.6, I see com.apple.screenIsLocked / screenIsUnlocked and com.apple.screensaver.didstart / willstop / didstop. (Older versions of Mac OS X may not have all of these notifications.) You can watch for notifications as they occur with Notification Watcher .

Also see this answer .

+7

:

NSDistributedNotificationCenter.defaultCenter().addObserver(
        self,
        selector: "screenIsLocked:",
        name: "com.apple.screenIsLocked",
        object: nil)

, , , , - - , , .

, nil , .

PS: , , , , , . , NSDistributedNotificationCenter, NSNotificationCenter NSWorkspace .

+2

All Articles