Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mac screensaver start event

Is there an event fired when screensaver starts? Like for keychain locking:

OSStatus keychain_locked(SecKeychainEvent keychainEvent, SecKeychainCallbackInfo *info, void *context){...}
like image 815
tig Avatar asked Sep 14 '09 03:09

tig


People also ask

How do I trigger my screensaver on a Mac?

On your Mac, choose Apple menu > System Preferences, click Desktop & Screen Saver , then click Screen Saver. Click the “Show screen saver after” pop-up menu, then choose how long you want your Mac to wait before starting the screen saver when it's idle.

What is the default screensaver on Mac?

1 Answer. Show activity on this post. The defaults screensavers are in /System/Library/Screen Savers .

Why isn't my screensaver working on my Mac?

Check for Updates. The screensaver problem is clearly caused by a software bug. Wait until Apple releases a hotfix and upgrade your system to the latest version as soon as possible. Go to System Preferences, click on Software Update, and hit the Update Now button.


Video Answer


1 Answers

Finally found it — the solution is to use NSDistributedNotificationCenter and observe folowing events

  • com.apple.screensaver.didstart
  • com.apple.screensaver.willstop
  • com.apple.screensaver.didstop
  • com.apple.screenIsLocked
  • com.apple.screenIsUnlocked

Like

[[NSDistributedNotificationCenter defaultCenter]
   addObserver:self
   selector:@selector(screensaverStarted:)
   name:@"com.apple.screensaver.didstart"
   object:nil];
like image 155
tig Avatar answered Sep 22 '22 15:09

tig