Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I use GNU Screen constantly. But, I've been trying to figure out if there is someway to get X11 apps to forward over screen when I am ssh-ing (Is that a word?). Currently if I try to run 'gedit' through screen, it opens on my 'server' computer and not on my client. If I do the same outside of screen, then everything is fine. But I want everything to be fine when I use screen too!

Thanks!

PS: I have googled the problem and I see mention of xmove, but I can't seem to find the package that contains xmove on my ubuntu. (ubuntu 10.10)

share|improve this question
    
I have no time to find a complete answer now, but you need some environment variables to be set correctly. You can probably find out which ones from looking at you environment outside screen. –  JanC Oct 28 '10 at 4:17

4 Answers 4

up vote 15 down vote accepted

To manually do this, once you have SSHed in, but before you reattach to screen, check your DISPLAY environment variable:

echo $DISPLAY

Once you have re-attached to screen, explicitly set the environment variable:

export DISPLAY=:N.0

where :N.0 is what the echo showed before the attach. This won't be perfect, since some application may be expecting to talk to the Session D-Bus, which is a bit more complex to send over the SSH connection.

share|improve this answer
    
Awesome! This seems to work for most apps. I'm trying to up my screen 'fu'. Do you have any ideas or can you atleast point me in the general direction of how I can automate this? Thank you! –  Sandro Oct 28 '10 at 22:17
    
I've done weird things like scripting something like: echo $DISPLAY > $HOME/.display.txt; screen -x -d and then another in screen to run that does export DISPLAY=$(cat $HOME/.display.txt) –  Kees Cook Oct 29 '10 at 2:43
    
that's exactly what I've been trying to accomplish. But so far no luck. Trying to get that export to happen is quite the hurdle since running it in a script is no good, I need to somehow source it... and setenv also doesn't seem to have the magic touch either. –  Sandro Oct 30 '10 at 21:45
    
To source the script type . /path/to/script where script is export DISPLAY=$(cat $HOME/.display.txt) –  Kees Cook Oct 30 '10 at 22:15
    
This assumes you don't have screen auto-start on login (a la byobu) –  A Student at a University Sep 27 '11 at 13:46

there's a program called xpra in the repositories, it's like gnu screen for x11. it's not too hard to work with:

X Persistent Remote Applications

Xpra gives you the functionality of GNU Screen for X applications.

It allows the user to view remote X applications on their local machine, and disconnect and reconnect from the remote machine without losing the state of the running applications.

share|improve this answer
    
I have written about how to actually integrate xpra with Screen to achieve both console and X11 application persistence: krlmlr.github.io/integrating-xpra-with-screen . Works for me. –  krlmlr Mar 14 at 9:15

Byobu automatically reattaches ssh and gpg agents. I could make it reattach the display variable to, if that's helpful to you...

share|improve this answer
    
It doesn't seem to even pass along the display variable in NEW sessions created in an ssh session with X11 forwarding. It would be wonderful if it did... I've stopped using it because of the headache of having to disable auto-starting byobu so that one can use the X11 forwarding. –  A Student at a University Sep 27 '11 at 13:42

FreeNX is a wonderful app for working with remote displays.

share|improve this answer
3  
Could you explain further? –  A Student at a University Sep 27 '11 at 13:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.