Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|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. –  William Casarin Apr 12 '10 at 16:40

1 Answer 1

up vote 3 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
share|improve this answer
    
Sort of hacky but it worked! Awesome. –  William Casarin Aug 26 '10 at 2:41

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.