Não é realmente uma solução para literalmente "pegar janelas de programas já em execução", mas ainda assim ...
Use xpra .
On X11, it is also known as screen for X11: it allows you to run programs, usually on a remote host, direct their display to your local machine, and then to disconnect from these programs and reconnect from the same or another machine, without losing any state.
[…]
Xpra also allows forwarding of sound, clipboard and printing services. Sessions can be accessed over SSH, or password protected over plain TCP sockets with or without SSL.
Ele precisa ser instalado, configurado e iniciado antecipadamente, assim como screen ou tmux para aplicativos de console. Você tem que executar seu programa via xpra em primeiro lugar, então você pode fazer a mágica de (re) conectar de diferentes máquinas.
xpra está disponível como xpra package pelo menos no Debian e no Ubuntu. Eu usei algumas vezes. O desempenho foi melhor do que para o encaminhamento simples do X.
Exemplos são aqui . Os seguintes são de man xpra no meu Kubuntu:
xpra start :7Start an
xpraserver using display number:7.DISPLAY=:7 firefoxStart
firefoxrunning inside thexpraserver. Run this on the host wherexprawas started or in terminal forwarded byxpra. No window will appear until you attach withxpra attach.
Você executa os exemplos acima em seu A. Então você pode anexar diretamente de A:
xpra attach :7Attach to the
xpraserver that is using local display number:7. Any apps running on that server will appear on your screen.
ou do seu B:
xpra attach ssh:foo@frodo:7Use
sshto attach to thexpraserver that is running on machinefrodoas userfooand using display:7. Any apps running on that server will appear on your local screen.