Hatred for ssh sessions spawning X11.app
Hatred for ssh sessions spawning X11.app
- Subject: Hatred for ssh sessions spawning X11.app
- From: Mike Beattie <email@hidden>
- Date: Fri, 02 Nov 2007 09:04:09 +1300
- Thread-topic: Hatred for ssh sessions spawning X11.app
In my last mail, I mentioned that an ssh connection using X forwarding will
spawn X11.app. I hate this. So, here's my workaround that some others may
like to use. It's pretty beta, and I'm sure it's got some flaws.. I wrote it
in about 10 minutes last night in anger.
Add the following to your .bashrc or similar. (this was written for zsh, so
I'm not sure if the function will work, you may need to remove the "()"
after "startx". Also, ">!" may not be valid in bash..).
--------------------------------8<-------------------------------
# Deal with $DISPLAY
if [ -e "$DISPLAY" ];then
dpyfile=~/.Xdisplayvar
update=yes
if [ -f $dpyfile ];then
if [ "$DISPLAY" = "$(cat $dpyfile)" ];then
update=no
fi
fi
if [ "yes" = "$update" ];then
echo "$DISPLAY" >! $dpyfile
fi
unset update dpyfile
export DISPLAY=
fi
startx() {
export DISPLAY=$(cat ~/.Xdisplayvar)
xhost
}
--------------------------------8<-------------------------------
Basically, if you want to start using X via a shell, just type 'startx'.
This is broken enough that it'll have effect in the shell started in an
xterm - you'd have to 'startx' there too. I may get around to enhancing it
to not blat out $DISPLAY if X11 is running.
Mike.
--
Mike Beattie <email@hidden> UNIX Systems Engineer, ITS
Ph: +64 3 479 8597 Fax: +64 3 479 5080 Cell: +64 21 626 624
* Opinions expressed are my own, not those of the University of Otago *
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden