cocoa - Notification when the system is idle or not on OS X -
i know there way scheme idle time iokit framework on os x, want know if there's notifications available.
i can create timer check if idle time more x, , that's fine. doesn't matter if observe idle mode few seconds later.
the problem observe when mac not idle anymore. want app show notification possible, not few seconds later.
is there way have notification that? (ichat seems have one)
this http://developer.apple.com/library/mac/#qa/qa1340/_index.html (from bill lizard comment)
- (void) receivesleepnote: (nsnotification*) note { nslog(@"receivesleepnote: %@", [note name]); } - (void) receivewakenote: (nsnotification*) note { nslog(@"receivewakenote: %@", [note name]); } - (void) filenotifications { //these notifications filed on nsworkspace's notification center, not default // notification center. not receive sleep/wake notifications if file //with default notification center. [[[nsworkspace sharedworkspace] notificationcenter] addobserver: self selector: @selector(receivesleepnote:) name: nsworkspacewillsleepnotification object: null]; [[[nsworkspace sharedworkspace] notificationcenter] addobserver: self selector: @selector(receivewakenote:) name: nsworkspacedidwakenotification object: null]; }
cocoa osx notifications python-idle
No comments:
Post a Comment