Classroom situation

With the InWindow option the XmetaX proxy can display a screen in a window (Screen of type window), which may be integrated into a running X11 session. This capability is used, for instance, in a classroom, when the teacher wants to see copies of the students' screens within his session and even control it via keyboard and mouse.

A special case of the classroom situation is the help-desk scenario, where an expert helps a remote user with operating his application.

The following examples assume rather similar X Window servers. Otherwise, the probeOnly screen tag (Screen tags) is to be used or the common capabilities of all participating X Window servers — currently and in the future — must be configured (Common resources and capabilities). The configuration of the authorization (Authorization) is neglected, too.

Fixed configuration

If a student's display has to be copied into the teacher's X11 session, the student's XmetaX proxy is configured with the local screen and a screen of window type (Screen) on the teacher's X Window server (teacher). This screen is iconified immediately (Screen tags):

options +InWindow
screen local display :1.0
window "$USER" display teacher:0.0
sameAs local
displayWidth 1278 displayHeight 1022
pointer allowEnter off
tags iconify
serverCommand
/usr/bin/X11/X :1

In this situation the teacher's machine does not need an XmetaX proxy. If the teacher wants to see a student's screen, he simply activates the icon with the student's name. The teacher may control an arbitrary number of students' screens simultaneously.

The window may be smaller than the student's screen, of course (Dynamic position of a screen):

options +InWindow
screen local display :1.0
window "$USER" display teacher:0.0
sameAs local
pointer allowEnter off
tags iconify
displayWidth 640 displayHeight 480
followPointerX 64
serverCommand /usr/bin/X11/X :1

Dynamic configuration

If the student's screen should be copied into the teacher's X11 session at a later time, the DynamicServer option (Dynamic configuration) is needed:

options +InWindow +DynamicServer
screen local display :1.0
tags static
serverCommand /usr/bin/X11/X :1

Using the following shell script, the teacher modifies the student's XmetaX configuration so that his screen is displayed in a local window:

#!/bin/sh
# /etc/opt/XSOXmetaX/shadowStudent

usage="Usage: $0 displayName"
if [ $# != 1 ]
then
echo $usage 1>&2; exit 1
fi
/opt/XSOXmetaX/bin/xmetaxtool -nogui -display "$1" \
window "student@$1" display `hostname`:0.0 \
sameAs local \
displayWidth 1022 displayHeight 766 \
followPointerX 64 \
pointer allowEnter off

The shell script can be bound to a window manager action like a menu entry:

"Student@one" f.exec "/etc/opt/XSOXmetaX/shadowStudent one:0.0 &"

By simply closing the window it is deleted from the configuration. The teacher may use the following shell script alternatively:

#!/bin/sh
# /etc/opt/XSOXmetaX/unshadowStudent

usage="Usage: $0 displayName"
if [ $# != 1 ]
then
echo $usage 1>&2; exit 1
fi
/opt/XSOXmetaX/bin/xmetaxtool -nogui -display "$1" \
window "student@$1" delete

If the student's screen is displayed in the teacher's session, either the student or the teacher may issue input events. Using the following shell script, the teacher modifies the student's XmetaX configuration so that input events are accepted from his own or from the student's X Window server, respectively (Screen tags):

#!/bin/sh
# /etc/opt/XSOXmetaX/shiftInput

usage="Usage: $0 grab|release displayName"
if [ $# != 2 ]
then
echo $usage 1>&2; exit 1
fi
case "$1"
in grab)
teachersSub="input on"
studentsSub="input off"
;; release)
teachersSub="input off"
studentsSub="input on"
;; *)
echo $usage 1>&2; exit 1
;; esac
/opt/XSOXmetaX/bin/xmetaxtool -nogui -display "$2" \
screen local $studentssub \
window "student@$2" $teachersSub

Classroom situation reversed

The previous configurations can be used the other way round — from the teacher to the students, too. To avoid cyclic situations and to prevent the students from seeing the whole teacher's screen, the XmetaX proxy on the teachers's machine should be configured with a local window type screen (Screen), which is displayed in the teacher's running X11 session (the environment variable $HOSTNAME must be set appropriately):

options +InWindow +DynamicServer
connection :2.0
window teacher@$HOSTNAME display :0.0
displayWidth 1024 displayHeight 768

X Window clients connecting to :2.0 (X Window client connection) are displayed in the window, like:

mwm -display :2.0 & xterm -display :2.0 &

The following shell script copies the window into the X11 sessions of one or several students or deletes the student's screens from the configuration:

#!/bin/sh
# /etc/opt/XSOXmetaX/shadowTeacher

usage="Usage: $0 [off] displayName..."
if [ $# = 0 ]
then
echo $usage 1>&2; exit 1
fi
if [ "$1" = "off" ]
then
sub=delete
shift
else
hostname=`hostname`
sub="sameAs teacher@$hostname
displayWidth 1024 displayHeight 768
pointer allowEnter off"
fi
screens=
for display in $*
do
hostname=`echo $display | sed 's/\([^:]*\).*/\1/'`
screens="$screens window student@$hostname
display $display $sub"
done
/opt/XSOXmetaX/bin/xmetaxtool -nogui -display :2.0 $screens

If one of the participants wants to issue input, he executes the following shell script, which lets the XmetaX proxy accept input events from his X Window server only:

#!/bin/sh
# /etc/opt/XSOXmetaX/grabInput

usage="Usage: $0 displayName"
if [ $# != 1 ]
then
echo $usage 1>&2; exit 1
fi
teacher=$1
hostname=`hostname`
/opt/XSOXmetaX/bin/xmetaxtool -display $teacher \
-print screens \
| while read screenWindow screen
do
case $screen
in *@$hostname)
tags="input on"
;; *)
tags="input off"
;; esac
/opt/XSOXmetaX/bin/xmetaxtool -nogui \
-display $teacher $screenWindow $screen $tags
done

Copyright © 2018 X-Software GmbH
info@x-software.com