On 05/07/2011 03:56 PM, Daniel Hagerty wrote: > Jerry Feldman <g...@blu.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. > _____________________________________ The issue commonly occus when a Windows user does not first bring up Exceed. Putty would have -X set, so the DISPLAY environment variable gets set.
-- Jerry Feldman <g...@blu.org> Boston Linux and Unix PGP key id: 537C5846 PGP Key fingerprint: 3D1B 8377 A3C0 A5F2 ECBB CA3B 4607 4319 537C 5846
_______________________________________________ Discuss mailing list Discuss@blu.org http://lists.blu.org/mailman/listinfo/discuss