6

Suppose I have a few machines, all connected to a monitor and all running linux. I want to be able do the following: Start an application on computer A and then move its window to computer B if necessary. Once the application window was moved it B should be able to use it like any other window (Similar to ssh-forwarding). Now A and B should be able to put the window back to A.

I found xpra, but I don't think this is what I need. It lets me open remote windows, but AFAIK I can't move my windows between computers.

Is there any tool out there that can do what I want? The world of X-programs is big, so there should be something.

Sirac
  • 163
  • 5
  • 1
    From what I can tell the application needs to be started using `xpra` in order for you to move it while running. Did you start your application with `xpra`? – Centimane Sep 08 '16 at 18:05
  • @Dave I'm just reading the manpage of `xpra`, trying to understand the mechanisms. – Sirac Sep 08 '16 at 18:11
  • 2
    Possible duplicate of [Sharing an X server (session) across computers](https://unix.stackexchange.com/questions/2554/sharing-an-x-server-session-across-computers) – eadmaster Mar 01 '18 at 14:56

1 Answers1

6

As Dave says, xpra is ideal for this. You need to start an xpra session on the system where your application will be run (not displayed):

xpra start :20

(20 must be a free X display number — I usually start at 20, that leaves room for multiple local X servers and incoming forwarded X sessions using SSH.)

Then you start your application on display 20:

DISPLAY=:20 myapp &

To display your application, you attach to it with xpra:

xpra attach :20

You can do this over SSH too:

xpra ssh:user@host:20

You can run multiple applications in one xpra session. xpra offers tons of possibilities, including forwarding PulseAudio, sharing the clipboard, forwarding files...

By default, attaching from one machine detaches the session from any others, so you don't need to remember to detach.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
  • 1
    Ok, that sounds good. What I still miss is a way to put an window into that :20 display. I might be using firefox normally and a few minutes later I want to put it on another machine. Still, xpra already looks good, maybe it also has the final option I'm looking for, that is to open the window on computer B without B typing anything. – Sirac Sep 08 '16 at 18:58
  • AFAIK there's no way to "steal" an application from your standard X display to move it to the `xpra` display; you need to start it on the `xpra` display. Once you've done that you can move it around. If you attach to an `xpra` session running on A from computer B, any application added to that display will show up on B — so you can subsequently start Firefox from A on the `xpra` display, and it will show up on B without any action on B. – Stephen Kitt Sep 08 '16 at 19:07
  • Ok, I'n beginning to like it. For now, I might `xpra start :20` at startup, `xpra attach :20` after that and open all exchangable programs there. I'm using i3, do you know if I can somewhere set the `DISPLAY` so that all my programs open up on `:20`? – Sirac Sep 08 '16 at 22:16
  • For completeness: Using --sharing during `xpra start` and `xpra attach` gives you the possibility to use shared sessions, although you have to test it for speed. Also, on i3 you can use `i3-input -F 'exec --no-startup-id DISPLAY=:20 %s'` to exec an command on display :20. – Sirac Sep 09 '16 at 01:23