> > > > Today's Topics: > > 1. Restarting X and screen (David Collins) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 25 Jun 2009 16:57:13 +0100 > From: David Collins <davidcollins...@gmail.com> > Subject: Restarting X and screen > To: screen-users@gnu.org > Message-ID: > <1b30fd140906250857v1e06c7e4mb4c50c5a91e31...@mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, > > I use 5 different screen sessions for various different purposes on my > work computer (linux open suse). When the X server is restarted and I > re-attach the screen sessions I can no longer open programs that use > X. The error I get is "cannot open display :0.0" The xterm without the > screen session running can open an X app just fine. > > Does anyone have any ways that I can stop this happening, usually it > isn't a problem but on the occsation it does happen I have to restart > the screen session. > > Thanks > David > > I use to script to save the x env:
#!/bin/bash # Copy X env into a file that can be sourced from another shell. host=$(hostname) file=~/.ssh.env.$host echo "set -a" >$file env | grep -e SSH -e DISPLAY | grep -v TTY | sed -e 's/=\(.\+\)/="\1"/' >>$file echo "set +a" >>$file and an alias to reload it: xenvload='. ~/.ssh.env.$hostname' So form a new shell with the correct x env you run "xenvsave", then from the screen shells, run xenvload. I'm sure there's an easier way but this works for me. -Bruce
_______________________________________________ screen-users mailing list screen-users@gnu.org http://lists.gnu.org/mailman/listinfo/screen-users