Re: launchd detecting when an application is running
Re: launchd detecting when an application is running
- Subject: Re: launchd detecting when an application is running
- From: Jerry Krinock <email@hidden>
- Date: Thu, 4 Jun 2009 08:51:36 -0700
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 (email@hidden)
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:
This email sent to email@hidden