I have three possible ideas.

The first is to put all windows into the same session, and name them  
all accordingly. I would consider this messy however, and screen lacks  
any way to meaningfully sort windows except by most-recently-used.

Another idea is to use a nested screen session. Use a different escape  
character for the outer than with the inner otherwise you'll damage  
your brain. This is only really useful if you're continually switching  
between them, and especially if you are copy/pasting between them  
using screen's buffer.

Thirdly, you could simply detach and reattach. You could even speed  
this up with a small script, perhaps written using dialog(1) to list  
available sessions, connect to the chosen session, and repeat upon  
detach. Here is a script which I worked up to do this (requires  
'dialog' to be installed).


#!/bin/bash
#
# Present a menu of screen sessions, and connect or reattach to it.
# Upon detach, repeat.
#
# Cameron Kerr <ck...@cs.otago.ac.nz>
# 19 Jan 2009

set -e

mydialog() {
     dialog --backtitle 'Screen Connection Menu' "$@"
}

msgbox() {
     mydialog  --aspect 20 --title "$1" --msgbox "$2" 0 0
}

error() {
     msgbox Error "$1"
}

die() {
     error "$1"
     exit "${2:-1}"
}

menu() {
     local text="$1"
     shift
     mydialog --menu "$text" 0 0 0 "$@"
}

screen_sessions() {
     screen -ls \
         | sed -ne 's/^\t\([^\t]*\)\t(\(Detached\|Attached\))/\1\t\2/ 
p' \
         | tee /tmp/foo \
         | while read screen_id attachment
           do
               echo -n "$screen_id $attachment "
           done
}

view_screen() {
     local screen_id="$1"
     screen -x "$screen_id"
}

screen_session_menu() {
     tempfile=$(tempfile 2>/dev/null) || tempfile=/tmp/dialog$$
     trap "rm -f $tempfile" 0 1 2 5 15
     eval menu '"Select screen session."' $(screen_sessions) 2>  
$tempfile
     retval=$?
     choice=$(cat $tempfile)

     case $retval in
           0) view_screen $choice ;;                 # Option chosen
           1) exit 0 ;;                              # Cancel chosen
         255) exit 0 ;;                              # ESC pressed
     esac
}

while true; do
     screen_session_menu
done



Cheers,
Cameron

On 18/01/2009, at 5:28 AM, lanas wrote:

> Le Samedi, 17 Janvier 2009 16:52:35 +0100,
> grandpas <grand...@dawal.org> a écrit :
>
>> I'm not sure to understand the question. You can have only one "big"
>> screen session with all your UML's inside, each on a virtual terminal
>> (and thus switchable through Ctrl-A xx).
>
>> For this you can use a specific .screenrc file to start many  
>> terminals
>> and commands at the initialisation of screen. The following link has
>> some example screenrc files:
>> http://www.softpanorama.org/Utilities/Screen/screenrc_examples.shtml
>
>> Screen is very convenient for UMLs, and should fit your needs. Or
>> maybe I misunderstood your problem?
>
> When UMLs are started in the following way:
>
> screen -d -m -S UML1 <...>
> screen -d -m -S UML2 <...>
> screen -d -m -S UML3 <...>
>
> Then there's seemingly no way to have a main comsole and do Ctrl-A S-"
> switching between sessions.  So it means several terminals, each with
> its own 'screen -r <name>' when work/tests have to be performed on
> several UMLs.
>
> So that was the question: how to keep the 'switch console' while  
> having
> several UMLs launched in batch mode (eventually at boot time).
>
> It looks like, from a cursory browse of the link above, that it is
> possible to put the sessions in a resource file and then have the
> benefit of being able to use Ctrl-A S-".  So that's great.  The web
> site also seems to have a lot more about using screen, so thanks for
> the link.
>
> I'm also looking at ClusterSSH to perform simultaneous actions on
> several UMLs.
>
> Cheers.
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> User-mode-linux-user mailing list
> User-mode-linux-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

-- 
Cameron Kerr <ck...@cs.otago.ac.nz>
Teaching Fellow, Computer Science, University of Otago




------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to