[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Recreate windows when reattaching to session?
From: |
David Marsh |
Subject: |
Recreate windows when reattaching to session? |
Date: |
Sun, 7 Sep 2008 07:11:39 +1000 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
iEYEARECAAYFAkjC8gsACgkQRTj13dyLvnq9cACdHHpTr9dE9PoSo2t9BW81zNFI
okgAnjVkHDKEpjvMJllCxyg2pCRKwHxJ
=65G+
-----END PGP SIGNATURE-----
- Recreate windows when reattaching to session?,
David Marsh <=