Hi, I have a tool that runs in the background via launchd and I need it to show a NSAlert to the currently logged in user.... what do you guys think the best way to do this is?
Hi, I have a tool that runs in the background via launchd and I need it to show a NSAlert to the currently logged in user.... what do you guys think the best way to do this is?
Hi, I have a tool that runs in the background via launchd and I need it to show a NSAlert to the currently logged in user.... what do you guys think the best way to do this is?
It's a foundation tool, running as a launch daemon - I actually haven't read TN2083 before but I was just scanning over it, it looks like launch daemons don't have access to WindowServer...
So, I wouldn't be able to do what I'm trying to do...right?
However, almost anything running as a launch daemon can easily be moved to the LaunchAgents folder, where it then runs as a launch agent. I could be wrong, but I don't think there's anything a daemon can do that is prohibited for agents. The last few things I worked on that fell into agent/daemon-ness I simply deployed as launch agents, and I didn't hit any prohibitions. As I recall, the main thing launch daemons get is a launch at an earlier point in time.
If the agent/daemon is running as root, there are a number of security things you have to take into account when interacting with users. So sometimes the safest thing is to start another process with a less privileged uid, and communicate with some form of inter-process messaging. Sockets is one way (lo0 loopback TCP/IP), but there are others. Whatever it is, it has to be secure, in the sense that privileged side won't accept unprivileged messages commanding any unauthorized privileged action.