up vote 5 down vote favorite
3
share [g+] share [fb]

Is there a way to move windows between different screen sessions?

For example lets say I have this scenario:

screen -S screen1
vim *.cpp
C-a d
screen -S screen2

Is there any way to move my shell containing my vim session from screen1 to screen2?

link|improve this question
1  
i don't think so, but i'm not much of a screen guru. interesting question, +1. – quack quixote Apr 10 '10 at 5:54
2  
found a discussion on the screen mailing list - lists.gnu.org/archive/html/screen-users/2008-04/msg00009.html - it's not possible at the moment and a 'nightmare' to implement apparently. – Bill Casarin Apr 12 '10 at 16:40
feedback

1 Answer

up vote 2 down vote accepted

You can use injcode to move a process between ttys. To move process with PID run in target screen window:

$ injcode -m retty PID

However when you close the parent Screen session, moved processes will also terminate.

Edit: I was wrong, it works. Everything is described here. Suppose you want to move "htop" and only one instance is running:

$ injcode -m retty $(pgrep htop)
$ pkill -SIGSTOP htop
$ pkill -SIGCONT htop

then on the previous shell type:

$ disown
link|improve this answer
Sort of hacky but it worked! Awesome. – Bill Casarin Aug 26 '10 at 2:41
feedback

Your Answer

 
or
required, but never shown

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