Date: Fri, 27 Jul 2001 07:21:45 -0500 From: Mike Meyer <mwm@mired.org> To: "Chad R. Larson" <chad@DCFinc.com> Cc: Stable@FreeBSD.org Subject: Re: running on X server? Message-ID: <15201.23769.367007.292402@guru.mired.org> In-Reply-To: <20010726150701.C9091@freeway.dcfinc.com> References: <20010726150701.C9091@freeway.dcfinc.com> <200107262222.f6QMMXO00601@bunrab.catwhisker.org> <20010726202622.A9940@freeway.dcfinc.com>
next in thread | previous in thread | raw e-mail | index | archive | help
I think this belongs on -questions, not -stable, but I'm not going to move it. Chad R. Larson <chad@DCFinc.com> types: > Is there a simple, reliable way to determine if a script is running > in an X environment? What does "running in an X environment" mean? The best I can come up with is "can reach an X server that will talk to it." Determing that accurately is a non-trivial process, generally difficult, and probably best done by a human being. > I've seen too many scripts (such as the one shipped with urlview) > that test for the presence of the environmental variable DISPLAY, > but that's hardly foolproof. If you don't know which of the many possible ports on the internet the X server you're supposed to talk to might be listening on, you're pretty much screwed. DISPLAY tells you which of those X servers to use. Without it, the only safe assumption is that you don't have an X server to talk to. If it's wrong - well, you could try connecting to it and if that fails go back to the "no X" assumption. But failing and letting the user fix it is probably a better bet. Chad R. Larson <chad@DCFinc.com> types: > So, still looking for a clean, quick way to come up with what should > be set in the DISPLAY environmental variable (if anything) from > inside a login script. This is a completely different question. In general, the answer is don't do anything. It should be set by startx (or however you start x) if you log into a cli, by xdm or the equivalent if you log into an X environment, and passed over the wire by whatever remote connection protocol you're using. Like Harlan, I recommend ssh for the later, as it will go through a firewall without having to make the firewall resemble a tea strainer. Unless the remote protocol passes the information across the wire, you're pretty much screwed and will have to set it by hand. How else is the second machine I connect to going to know if I'm sitting in front of my workstation in an X environment, sitting in front of it at a console prompt, or ssh'ed in from my Palm(*)? You can set it to the most common case if it's not already set, and then have to deal with changing it instead of setting it. > Anyway, you get the drift. I believe there may be an oversight by > the X committee. Yeah, the should have adopted DWIM from Interlisp. Failing that, all they can do is provide a mechanism to let the user specify which of all the possible X server locations on the internet to actually use, and that mechanism is the display environment variable. BTW, qterm is in the netbsd ports tree. Or was. <mike *) I tried running in an X environment displaying on the Palm. It's agony. -- Mike Meyer <mwm@mired.org> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15201.23769.367007.292402>