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?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
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: