| Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | About BLU |
Jerry Feldman <gaf-mNDKBlG2WHs at public.gmane.org> writes:
> tcl/tk script. All well and good. The one question I have is how can I
> detect in a script that an X server is running. Most people use putty
> from their Windows laptops, and I want the script to run in text mode if
> they have not run ssh -X (or if Exceed is not running). One method would
> be to check the $DISPLAY. But if they use Putty, the -X option would be
> set. If I run wish(1) it returns 0, but does print out a line of text,
> "Application initialization failed: " that I could check and switch to
> text mode. I'm looking for a better way of testing.
As far as the usual X architecture is concerned, you don't. You
set DISPLAY to indicate X support. If you don't have X support, you
communicate this to apps by not setting DISPLAY.
If your users insist on doing the wrong thing, your approach will
probably work. Other routes include using a cheap X query tool, like
xdpyinfo, xrdb, xlsclients, etc.
If I had problems with users miscommunicating X support to apps
like this, I'd try to handle it in the login environment, rather than
in a particular app. Your app probably isn't alone in doing the wrong
thing with a bogus DISPLAY.