Re: Detecting X11.app with launchd, was Re: The meaning(s) of $DISPLAY
Re: Detecting X11.app with launchd, was Re: The meaning(s) of $DISPLAY
- Subject: Re: Detecting X11.app with launchd, was Re: The meaning(s) of $DISPLAY
- From: "Nathaniel Gray" <email@hidden>
- Date: Mon, 19 Nov 2007 11:30:58 -0800
On Nov 19, 2007 1:06 AM, Ben Byer <email@hidden> wrote:
> On Nov 18, 2007, at 10:14 PM, Nathaniel Gray wrote:
> >
> > If you want to know the whole story, check out the website:
> > http://www.n8gray.org/code/forget-me-not
>
> See, this is why I wanted more info about what you would like to
> accomplish. Launchd can answer this question for you, and it can do
> so in a way that is robust (i.e. it won't get confused if you have
> multiple users logged in to the same machine.)
>
> If you want to test this out on the command line, the command
> "launchctl list org.x.X11" will spit out a plist data structure that
> describes that LaunchAgent. If it is currently running for the current
> user, it will list the pid of the process along with the other
> attributes of the launchd plist. So, you just need to use this
> functionality in your program; you can even use the programmatic
> interface to launchd to get this info. (As far as I know, this should
> degrade gracefully back to at least Tiger, if not Panther -- a Tiger
> user won't have anything that matches org.x.X11, so the launchd check
> will have no effect).
>
> My ObjC is horrendous and I wasn't able to figure out how to properly
> test this, but I hope the attached patch will point you in the right
> direction.
Thanks, and thanks as well to Nicholas Riley for pointing out the same
thing off-list! Geez, Ben, you're too much. A patch and everything?
:-)
This is pretty good -- good enough for me -- but I wish it was solely
based on the socket, not the implicit assumption that
DISPLAY=/tmp/launch* implies org.x.X11. I'm fully aware that anything
else is highly unlikely, but you may recall it used to be the case
that anything but DISPLAY=:0 was considered highly unlikely...
> Oh, please. I'm not unreasonable! Martin correctly guessed the owner
> of that code; unfortunately, it fails on Leopard because we moved
> X11.app. :/
I think the bug I filed about Software Update failing when Apple's app
bundles are moved from /Applications just got fixed in Leopard, but
I'm not abandoning my tree of symlinks under /Apps just yet...
Cheers,
-n8
--
>>>-- Nathaniel Gray -- Caltech Computer Science ------>
>>>-- Mojave Project -- http://mojave.cs.caltech.edu -->
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden