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: Tom Hohensee <email@hidden>
- Date: Thu, 04 Jun 2009 16:41:31 -0500
Thanks for the replies.
I am actually quite familiar with launchd but was thinking that maybe
I had missed something. I vaguely remember reading a blog where
someone had used launchd to detect the app launching event but for the
life of me I cannot find it. It probably had something to do with
detecting file changes of the launching app. Unfortunately, the app I
want to monitor is a commercial app which is not mine and I am not
aware of any temp files it creates or files it alters. For the time
being I have written a small background app using NSWorkspace to
detect the event, but I find it a waste of resources especially since
the program it starts is only used for a brief period of time. I
probably will not incorporate it into the final release.
Also, thanks to Kyle for pointing out the launchd IPC reading on the
launchd man page. I have must have scanned that page several times
but never really paid much attention to that statement.
Tom
On Jun 4, 2009, at 11:51 AM, Greg Guerin wrote:
Tom Hohensee 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.
Is this for distribution, or only for your personal use?
How soon after the original app launches do you need to start the
secondary app?
How much control do you have over the original app?
Can you replace the original app's existing executable with another
one that triggers your secondary app, then goes on to exec the
original executable? The trigger could be many things, including
something that launchd monitors (see 'man launchd.plist' for on-
demand conditions).
Maybe run a daemon that monitors FSEvents for creation of a temp-
file you know the original app will create.
Maybe on-demand monitor the original app's user-defaults, so launchd
triggers that way.
Those are just some random ideas. It might help if you described
exactly what you're trying to accomplish, including what the
original app is. Describe the problem; don't propose a solution.
If you've already tried something, tell us what you've tried and
exactly why it didn't work. Be specific.
-- GG
_______________________________________________
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
_______________________________________________
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