[launchd-dev] Starting Agents in specific GUI sessions

Quinn "The Eskimo!" eskimo1 at apple.com
Fri Aug 16 09:24:06 PDT 2013


On 16 Aug 2013, at 17:17, Jerry Krinock <jerry at ieee.org> wrote:

> I would say that you should write a little app (.app) to do that, and your daemon should launch it as needed.

Please don't have your daemon launch an app; that's an exercise fraught with compatibility liability.  The most straightforward solution to this problem is to install a tiny GUI launchd agent [1].  It can then communicate with the daemon, allowing the daemon to know about all the login sessions and send messages to the agent in one specific session or all sessions.  If the agent needs to display GUI, it can either do so directly or launch an app to do so.  It's safe for a GUI launchd agent to launch an app because it is, by definition, running in a GUI login context.

Share and Enjoy
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

[1] I'm using the terms from Technote 2083 "Daemons and Agents", which I recommend you read.

<https://developer.apple.com/library/mac/#technotes/tn2083/_index.html>



More information about the launchd-dev mailing list