Skip navigation.
 
mlRe: NSDistributedNotification names
FROM : Jens Alfke
DATE : Mon Mar 24 15:57:44 2008

Distributed notifications aren't the same thing as NSNotifications, 
even though Foundation tries to give them a similar API. Regular 
notifications aren't available to other processes; a notification has 
to be explicitly posted as distributed, and few are. Distributed 
notifications are mostly used internally by the OS, though a few are 
documented.

> - another application has been launched
> - another application is being switched to active (for now, i check 
> periodically the active application with NSWorkspace)


I remember reading about a distributed notification for apps 
switching, but I don't remember where. There may well be a 
notification for an app being launched, but I don't know what it is.

It's not hard to write a little tool that listens for all distributed 
notifications (pass 'nil' for the notification name) and echoes them 
to stdout. That's a good way to snoop for what, if anything, the 
system sends. (But any of these notifications that aren't documented 
are subject to change in future releases of the OS.)

> - another application opens new window or document window
> - another application changes the frontmost window
> - another application is performing an open/save action


There's no way to get notified of things like this happening outside 
your process. In general apps keep their window state private from 
each other (though it's possible to ask via AppleEvents.)

—Jens

Related mailsAuthorDate
mlNSDistributedNotification names Marco Cassinerio Mar 23, 22:07
mlRe: NSDistributedNotification names Sherm Pendley Mar 23, 22:17
mlRe: NSDistributedNotification names Marco Cassinerio Mar 23, 22:36
mlRe: NSDistributedNotification names Nick Zitzmann Mar 24, 01:38
mlRe: NSDistributedNotification names Marco Cassinerio Mar 24, 11:14
mlRe: NSDistributedNotification names Jens Alfke Mar 24, 15:57
mlRe: NSDistributedNotification names A.M. Mar 24, 16:12