Re: How do I bend launchd to my will?

Gregory Weston <[email protected]> Fri, 01 Jul 2011 08:04:36 -0400
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On Jun 30, 2011, at 18:34, Kyle Sluder wrote:

> On Thu, Jun 30, 2011 at 3:30 PM, Gregory Weston <[email protected]> wrote:
>> In a new app I'm writing I want to provide the user with a checkbox to have the app launch at login. Traditionally, I'd add an entry to the login items list for this, but I'm under the impression that the modern, enlightened coder uses a well-formed plist in ~/Library/LaunchAgents. This seemed like a good idea, given that I'd like to pass it arguments when it's launched that way as well.
> 
> If you're really talking about launching your app at login, you still
> want to use the Login Items list via the LSSharedFileList API.
> http://cocoatutorial.grapewave.com/tag/lssharedfilelist-h/
> 
> Login Agents are for background helper apps that need to connect to
> the window server (usually to communicate with other apps). Login
> Daemons are for background services that don't need to connect to the
> window server.

I'm okay with the notion that this isn't really the right technique for this particular app. Thanks. I'm still curious about the underlying question though. I had actually originally split this in two parts, where there *was* a lightweight agent and a foreground controller/config tool. So what does it take to get an agent plist recognized? Are the implications of Apple's page and the explicit claim in the Big Nerd Ranch book wrong, or outdated, or was I just missing something?