Subject: Recreate windows when reattaching to session?

From: David Marsh <[email-masked]>
Date: Fri, 5 Sep 2008 23:50:52 +1000

Hi all,

Is there a way to recreate windows that were previously closed when  
reattaching to a session?

Example: I have vi in 0 and emacs in 1, created from .screenrc like  
this:

~~~~
screen -t vi 0 vi
screen -t emacs 1 emacs
~~~~

If I quit vi (:wq) and window 0 closes, then I detach with a C-a d, is  
there a way when I reattach using "screen -D -RR" to recreate the  
missing vi window?

Ideally the command would be this "screen -D -RR -t vi 0 vi" which  
would put vi back in window 0 only if there wasn't already a window 0.  
Unfortunately that command only reconnects to the detached session and  
does not recreate window 0. I could use ":screen -t vi 0 vi" from  
inside the screen session, but this will be for end users and I don't  
want them spawning new windows, they have to be locked down to two  
only (eg vi, emacs). This also rules out using C-a c.

I'll also attach a shell script is being run from the .profile, it  
might give you an idea of where I've gone so far:

~~~~
#!/bin/bash
if screen -ls | grep -q "No Sockets" ; then #check we aren't already  
running screen
	screen -dm #start in detached mode, allows us to use -p below
fi

case $1 in
	vi) screen -D -RR -p 0;;
	emacs) screen -D -RR -p 1;;
	*) echo "usage: $0 [vi|emacs]"
esac
exit
~~~~

Thanks for any help of suggestions you'd be able to provide. I'm  
stumped with this.

- -Dave

_______________________________________________
screen-users mailing list
[email-masked]
http://lists.gnu.org/mailman/listinfo/screen-users