Walt Mankowski on Mon, 8 Sep 2003 16:38:31 -0400

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] Propagating DISPLAY into screen sessions

Many thanks to the folks at the meeting a few months ago who helped me
get remote X sessions working properly through an ssh tunnel.  It's
working fine, but it's led me to another issue.

Here's the problem.  I ssh into a remote host like this:

  % ssh -X example.com

That sets DISPLAY to something like localhost:11.0, and then X
programs I start run on my local box.  The problem, though, is that I
like to use screen to keep multiple sessions running on the remote box
even when I'm not logged into it.  Or I'll be attached to the screen
session twice, once from my desktop and once from my laptop.

Inside each of the screen sessions, DISPLAY is set to whatever it was
when I first started screen.  It's often not what DISPLAY is currently
set to.  For example, I might have created the screen session from
localhost:11.0, but not I'm connected from localhost:13.0.

A typical session looks something like this:

  % ssh -X example.com
  % screen -x
  % emacs foo.pl

  [nothing happens, much swearing]

  % echo $DISPLAY
  % C-a d
  % echo $DISPLAY
  % screen -x
  % DISPLAY=localhost:13.0
  % emacs foo.pl

While this (eventually) works, I'm getting annoyed that I have to
manually reset DISPLAY all the time.  Is there any easy way to
reattach to a screen session and get it to automatically propagate
DISPLAY to all the sessions?


Attachment: pgp0HuIGrHLzq.pgp
Description: PGP signature