"Detach" and "Reattach" xterms across X sessions?

14

4

Is there a way to save/detach an xterm (or another window), and reopen/load/reattach it on a different X session on the same machine ?

What I'm trying to achieve is "move" running xterms between two VNC sessions running on a machine.

No, I'm not looking for screen :)

I do not want to use screen, because then I will need to use a separate screen session for each xterm. Using multiple tabs in screen does not work fine for my case, as I need to look at multiple xterms at once - not switch between the tabs.

NX is another option which came up, but it requires privileges on the server to install the s/w. I am looking for some solution using X, or some option in one of the window managers directly. fvwm / xfce / gnome would be good, but other WMs having this facility are welcome too.

Abhinav

Posted 2009-07-15T13:38:09.753

Reputation: 2 030

Answers

8

I know this post is old but...

http://xpra.org/ Xpra is 'screen for X'

...Crazy how many people seemed to have answered without actually reading your question. Xpra will not only let you move applications from one display to another on any machine, it will allow you to totally shut disconnect the apps from any real display and then re-attach later.

MadReasonable

Posted 2009-07-15T13:38:09.753

Reputation: 91

I just became aware of xpra, and remembered about this question. Thought I was going to get a decent answer to it after all this time. Oh well, have an upvote. – Greg – 2014-01-15T15:03:33.930

4

Not quite what you've asked for, but screen may do what you want.

This shares at the shell level rather than the X-window level, so you could have two xterms (on different Xservers, so long as they were on the same box), running screen -x, which would show the same sh sessions.

This wouldn't work for non-terminal things.

EDIT: xpra is probably what you want.

Greg

Posted 2009-07-15T13:38:09.753

Reputation: 305

1With screen you can actually have different xterms with different terminals. Just use screen -x and switch each xterm to it's own screen. One xterm can have screen 1, another screen 2, etc. This could all be scripted, too... "xterm -e screen -x -p 1 &" etc. – TREE – 2009-10-28T17:57:23.960

If you don't want to use screen, use tmux. – valbaca – 2013-05-25T01:00:44.333

1Thanks, I am aware of screen, but it is not what I'm looking for. – Abhinav – 2009-07-15T13:42:10.733

+1 for screen. You said that "I do not want to use screen, because then I will need to use a separate screen session for each xterm. " - but you can share the same screen session with all your xterms (using screen -x to reattach, as TREE said), and each xterm can look at the same screen window (if that's what you want), or a different screen window inside each xterm (if that's what you want; it's not clear from your original question). – James Polley – 2009-12-28T11:20:46.123

2

You can use screen within an xterm. This is a program that allows you to attach and detach terminal sessions. So you would start an xterm, start screen within the xterm, and use the xterm as normal. To move the session, you would detach from the session within screen and exit the xterm. Start up another xterm somewhere else, and reattach to the existing screen session.

If you want to do it with any X program, you can use NX. It works like screen, in that you are able to detach/attach to a X server. It also understands the X11 protocol, so it does a good job at speeding up X over slow networks.

KeithB

Posted 2009-07-15T13:38:09.753

Reputation: 8 506

Thanks for the pointer to NX, but I don't have privileges to install s/w on the servers. Is there anything built into any of the window managers, or X itself which can be used ? – Abhinav – 2009-07-15T13:47:10.980

2

CryoPID used to be able to move GTK+ applications (like gnome-terminal) between X servers. It's been unmaintained for a while, so it might not work at the moment, but some people have picked it up and started working on it again.

TRS-80

Posted 2009-07-15T13:38:09.753

Reputation: 2 923

1

As shipped? No. There used to be a "xmovex" application which would sometimes kinda do what you are asking, but it wasn't very popular and didn't work very well.

There are a couple of ways to get close to what you want:

  • run the desktop in a vnc session then connect to that from everywhere;
  • share your desktop through x11vnc;
  • look into nx and freenx.

David Mackintosh

Posted 2009-07-15T13:38:09.753

Reputation: 3 728

I already /run/ two vnc sessions. I need to move xterms between them, if possible. – Abhinav – 2009-07-15T13:53:10.430

1

No. Out of the box X does not have this facility. If you want to do this the best way is to use XVNC which is an x server that renders to a VNC virtual frame buffer. Then you can connect to your X session using a VNC client.

ConcernedOfTunbridgeWells

Posted 2009-07-15T13:38:09.753

Reputation: 1 814

1

Have you looked into xmove?

http://en.wikipedia.org/wiki/Xmove

Richard Hoskins

Posted 2009-07-15T13:38:09.753

Reputation: 10 260

Abhinav, did you look into this option? I was trying to do the same thing, and I found this question while searching for xmove. – rplevy – 2010-02-10T21:27:41.250

xmove is old and dead, NX is old but still sort of works, xpra does work – totaam – 2013-10-10T08:57:28.453

0

If you only care about the command-line session inside the xterm, use screen

Roalt

Posted 2009-07-15T13:38:09.753

Reputation: 463

0

I wonder if you are looking for export display handling.

nik

Posted 2009-07-15T13:38:09.753

Reputation: 50 788

As I understand, export display will spawn the window on a particular display. I want to change the display while the spawned process is running. – Abhinav – 2009-07-15T14:00:26.770