[comp.windows.x] setting DISPLAY

wohler@sri-spam.istc.sri.com (Bill Wohler) (05/22/87)

folks,

  i had hardcoded my DISPLAY environment variable to my workstation
  name.  now that i work on several workstations, it is no longer a
  workable paradigm.  could people send me their methods of setting
  this variable?  do people just set it to `hostname`:0 and then use
  command line args when using rsh?

  thanks.
  						--bw

dcmartin@POSTGRES.BERKELEY.EDU (David C. Martin) (05/22/87)

Run this as your startup command to xinit and follow it with whatever are
you standard startup commands:

dcm
-------- cut here -------
#!/bin/csh -f
# edit display name in .uwmrc
sed "s/\([^ ]*:0\)/$DISPLAY/g" < ~/.uwmrc >! /tmp/.uwmrc$$
mv -f /tmp/.uwmrc$$ ~/.uwmrc
# my standard startups
\nuwm >&! /dev/null &
\xload &
\xclock &
\xset m 2 5
\xsetroot -cursor $home/.cursor $home/.cursor_mask
\xsetroot -bitmap $home/.background.bitmap &
\screensaver -b $home/.screensaver.bitmap
# check if on uVAX
if (`tty` != "/dev/ttyv0") then
	exec $SHELL
endif

rlk@ATHENA.MIT.EDU (Robert L. Krawitz) (05/22/87)

I have this little hack called xdsp, and some code I put in my .login
file that I call xpickup.  Here it is:

#!/bin/sh
# Usage: execute this script in your xterm line -- xterm -e xdsp <machine>
xhost $*
TERM=xt.$DISPLAY
export TERM
exec /usr/ucb/rsh $*
exit

# This hair unpacks the TERM variable into DISPLAY (xpickup)
if (($TERM =~ xt?.*) || ($TERM =~ xt.*)) then
  setenv DISPLAY `echo $TERM | sed 's/xt[^.]*\.//'`
  set term = xterm
  setenv TERM xterm
  unsetenv LOGIN
  setenv NOTLOGIN 0
endif

Robert^Z

keith@nih-csl.UUCP (keith gorlen) (05/23/87)

In article <10162@sri-spam.istc.sri.com>, wohler@sri-spam.istc.sri.com (Bill Wohler) writes:
> folks,
> 
>   i had hardcoded my DISPLAY environment variable to my workstation
>   name.  now that i work on several workstations, it is no longer a
>   workable paradigm.  could people send me their methods of setting
>   this variable?  do people just set it to `hostname`:0 and then use
>   command line args when using rsh?
> 

We have xinit set DISPLAY to unix:0, and we use the following script to
"leap" to other machines:

#! /bin/sh
#
#   leapto  - shell script for accessing a remote machine under X Windows
#
case $DISPLAY in
	unix:[0-9] )	XDISPLAY=`hostname``expr $DISPLAY : '.*\(:[0-9]\)'` ;;
	* )		XDISPLAY=$DISPLAY ;;
esac
xhost $1
rsh $1 "setenv DISPLAY $XDISPLAY; setenv TERM xterm; setenv PATH $PATH; xterm -132 -n $1"&


-- 
	Keith Gorlen			phone: (301) 496-5363
	Building 12A, Room 2017		uucp: seismo!elsie!nih-csl!keith
	National Institutes of Health
	Bethesda, MD 20892