For When You Can't Have The Real Thing
[ start | index | login ]
start > Linux > Automatic X Display Setting

Automatic X Display Setting

Created by dave. Last edited by dave, 13 years and 191 days ago. Viewed 3,719 times. #1
[edit] [rdf]
labels
attachments

Automatically Setting Your X Display To From Whence You Came

I use ssh from cygwin to connect from my laptop to various linux servers. For various no good reasons, I use the eXceed X display software on my laptop rather than cygwin's. I have a batch file set up which permits me to launch a rxvt with a ssh $USER@$PLACE command in it. This ssh usually does not know about an X server, so it generally tends to not set the X display on the system where I land. This is annoying.

Therefore, today's slightly-clever-bit in my .bash_profile (on the system I ssh too, not my laptop):

if [ -z "$DISPLAY" ] ; then
    MyTTY=`who am i | awk '{print $2." "}'` 
    export DISPLAY=`w | grep "$MyTTY" | awk '{print $3.":0.0"}'`
fi
echo Display:$DISPLAY
no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful:


snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt