Re: The meaning(s) of $DISPLAY (was Re: Explanation of X implementations)
Re: The meaning(s) of $DISPLAY (was Re: Explanation of X implementations)
- Subject: Re: The meaning(s) of $DISPLAY (was Re: Explanation of X implementations)
- From: "Nathaniel Gray" <email@hidden>
- Date: Sun, 18 Nov 2007 14:31:31 -0800
On Nov 18, 2007 9:32 AM, Ben Byer <email@hidden> wrote:
>
> On Nov 17, 2007, at 8:35 AM, Ambrose Li wrote:
>
> > On 17/11/2007, Andrew J. Hesford <email@hidden> wrote:
> >>
> >> The point you're missing is that the user doesn't always want to use
> >> the X server just because it is available (via launchd) or already
> >> running (started either by the user or launchd). Checking $DISPLAY to
> >> determine the course of action circumvents the user, and that's not
> >> good. I'll give you a good example: when I log into remote machines
> >> and launch vim, it causes launchd to start X11, because vim was
> >> compiled with X11 support, and it is querying the display about
> >> something. This happens even though vim doesn't use X... it is purely
> >> textual. To avoid having my X server automatically start when I start
> >> vim, I have to explicitly tell vim not to use X. This is annoying and
> >> wrong.
> >>
> >> You'll think this is a case in your favor, but it isn't. Because the
> >> issue isn't that launchd is starting the server... it's that vim is
> >> checking for servers. Even if I already have X open for a legitimate
> >> reason (let's say I'm running an xterm), vim has no business looking
> >> for servers, because I didn't tell it to. Yes, it was compiled with
> >> support for X11. But until I launch it as gvim (which opens up a
> >> graphical window), it should stay the hell away from my X server.
> >
> > This is a valid example, but apart from showing that vim is a bad
> > program (I can't stand it and never use it for other reasons), it also
> > shows how prevalent checking $DISPLAY is. It is simply the
> > convention.
> >
> > As to whether an example is "in my favour", I was not arguing for
> > "my point of view". It was just pointing out an existing convention
> > that apparently has been overlooked, and "my views" are always
> > wrong anyway, so they don't matter.
>
>
> Errr.... let me step in here and try to make our thought process and
> intentions clearer.
>
> Andrew's analysis is correct -- From now on, you should think of
> $DISPLAY as indicating a *capability*, and not as a way of "triggering
> other random behavior".
>
> Ambrose's response is also noted, but I'm going to stand up for myself
> and say that it was not "overlooked". Rather, we came up with what we
> thought was a more correct use of $DISPLAY, and so we implemented
> according to that belief, fully knowing it would break some
> assumptions that various scripts were making. It's the price of
> progress.
>
> I am more than happy to try to help anyone rewrite those scripts :)
I'm pretty happy with the new way, but I *would* like a bulletproof
way of knowing if $DISPLAY is connected to a running X server. I've
got some code (mostly working around the lack of accessibility info in
X) that tries to connect to DISPLAY as a way of checking for a running
X server, since that seemed like the best way of detecting that.
Since that's no longer appropriate I need a replacement, and I really
hope you aren't going to say "ps -a -U $USER | grep X11" or some such.
;^)
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