On 2009 Jun 04, at 08:40, Todd Heberlein wrote:

I have written an application that I would like to launch whenever a certain app is launched. I have used LaunchAgents in the past to detect events such as USB insertion and volume mounting to perform certain actions. I was wondering if there was a launchd.plist key that allowed for launchd to detect an application startup.

One approach is to have an agent monitor the audit trail to look for the application starting. The agent can then do something that can cause your app to launch, but now you are introducing a third program into the mix.

Yup. I have an app which needs to know when other apps (not mine) quit. So, I wrote a silly little agent, kept alive by launchd, that registers for NSWorkspaceDidTerminateApplicationNotification, starts a run loop, then sits and waits. Haven't field-tested yet, but seems to work. It's confusing, though!

What do you mean by "audit trail"?

It would be nice if launchd had this capability, but as Kyle said, that is by design not one of the things that it does.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to