Re: NSWorkspaceDidLaunchApplicationNotification
Re: NSWorkspaceDidLaunchApplicationNotification
- Subject: Re: NSWorkspaceDidLaunchApplicationNotification
- From: Douglas Davidson <email@hidden>
- Date: Wed, 14 Nov 2001 08:55:54 -0800
On Tuesday, November 13, 2001, at 02:45 PM, Finlay Dobbie wrote:
In a Foundation tool, I have:
[[[NSWorkspace sharedWorkspace] notificationCenter]
addObserver:controller selector:@selector(foo:)
name:NSWorkspaceDidLaunchApplicationNotification object:nil];
[[NSRunLoop currentRunLoop] run];
Where controller is an object that is properly initialised and has the
method:
- (void)foo:(NSNotification *)notification {
NSLog(@"Application launched: %@", [[notification userInfo]
objectForKey:@"NSApplicationName"]);
}
It runs but foo: never gets called and I don't get any output. Anybody
have any idea why? I am linking against AppKit etc etc...
NSWorkspace currently gets its application launch and quit notices from
the window server as part of the event stream, so you have to have a
connection to the window server for this to work. That means
initializing NSApplication, at the very least; I'm not sure how far you
have to go toward being an application for this to work.
Douglas Davidson