This
page describes the xsession file in Xdm and how it is used.
Xsession File
There are two Xsession files, an .Xsession file
in the Xdm directory that is a system- wide default file and an
.xsession file that is in the user's home directory. Usually the
.xsession is the only file of interest to the user. The Xsession file is
controlled by the system administrator and is used only if the user's
.xsession file is not found.
The user customizes his display environment by using an
individual .xsession file. This file contains a list of user commands
or selections appropriate for the user's environment, such as window
manager selection, clients to be run, etc.
The .xsession file is located in the user's home directory and
is run when xdm starts up. (The general .Xsession file created by the
system administrator contains sufficient information to run the system
and your display with default values without the customization of an
individual .xsession file.)
A typical .xsession file might contain some entries like
these: xrdb -merge .Xdefaults
xmodmap -e
"keycode 102 = Delete"
xclock -fg red -bg white -geom -0+0 &
xterm
-e "rsh hdssun5" -fg orange -bg black &
xterm -fn 10x20 -bg blue
-fg white &
twm&
xterm -title LOGIN -geometry 80x24+10+10
You should notice several things about this file. The
first line is the command to load the resource file. The next lines
start some clients, an xclock, an xterm on a remote host, an xterm with
a big font, and a window manager. (Additional levels of customization
can occur here, since each of the clients has an app-defaults file
(found in /usr/lib/X11/app-defaults) which can be used for individual
settings, such as scroll bars for the xterms, or special emulations,
etc. These customizations are often most important for the window
manager's operation, which often uses a run command file, such as
.twmrc, found in the user's home directory.)
The most important thing to notice about the .xsession file is
that the last entry cannot run in the background. If you assign this
last client to be a background process, xdm will detect the process as
not active and assume you are finished and will therefore close your
session. In this example, the last process is an xterm window with the
label LOGIN in the title bar. This means that you can open or close any
number of clients and windows in your session, but as soon as you close
the LOGIN window, xdm will close your session. You could use your window
manager or a client like xclock as your LOGIN window, but the same
rules apply; when that window closes, the entire session is over.
You may also use the xsession file to execute shell script
files, which might be used to set up and start a window manager; for
instance, your shell script file might contain the various environment
variables and path settings needed by the OPEN LOOK or Motif window
managers. The xsession file itself must be executable, which you can do
with the chmod command (chmod 777 .xsession).
For instance, you could create a simple shell script, called
do.olwm, to start the OPEN LOOK window manager. This script might
contain some environment settings and the command to start the window
manager: setenv OPENWINHOME /usr/openwin
setenv LD_LIBRARY_PATH $OPENWINHOME/lib
setenv X11ONLY=YES
setenv MANPATH $OPENWINHOME/share/man:/usr/man
set path=(
$OPENWINHOME/bin $OPENWINHOME/bin/xview $path )
echo "Starting
OPEN LOOK Window Manager"
echo "OLWM DISPLAY = $DISPLAY"
$OPENWINHOME/bin/olwm
&
This example uses simple settings and "default" paths
and directories; your installation may use different locations and
directories. This shell script must be executable and should be in your
home directory. Your entry in the .xsession file would be do.olwm
instead of the twm& command in the previous example.
Vendor
Display Class String
If you are using Indirect or Broadcast xdm
requests, you may need to enter a vendor display class string for the
ViewStation in the DisplayManager.servers resource. The HDS ViewStation
display class string is "HDS-ViewStationFX". The manufacturer's class
string is "-Ethernet-%s" where %s is your ViewStation's Ethernet
hardware address in hexadecimal form, nn:nn:nn:nn:nn:nn.
ViewStation
.xsession File
The xsession file shown above is a very simple
implementation of the Xdm startup file. In practice, your xsession file
would probably contain some code to analyze the display type (for
instance, for color or monochrome differences), or for display
capability (HDS ViewStation displays with local clients and other
devices without this capability). This could be done by node naming
distinctions or by analyzing the device's vendor string.
....
# extract a host name from $DISPLAY
HOST=`echo $DISPLAY | sed "s/".*$//"`
# check for HDS ViewStations
# all HDS ViewStations are color units
# all HDS ViewStations use local clients
if expr $DISPLAY : "hds*"
then
xsetroot -solid "PaleGreen"
xrdb -merge
$HOME/.Xdefaults-hds
xmodmap -e keymap-hds
rsh -n $HOST mwm
`&'
rsh -n $HOST hdsoclock `&'
rsh -n $HOST hdsmemory
-iconic `&'
fi
#
# create LOGIN window
xterm -title LOGIN -geometry 80x24+10+10
....
These examples can be customized further as your system
needs require. The principal advantage of Xdm is its management of the
user's session, so the system administrator can automatically provide a
complete session environment for each user.
Return to Section Heading Page
Return to the Home Page
If you need more information than is available here, you can reach
HDS via email at info@hds.com, or
call us at 1.800.HDS.1551 in the USA, or at +610.277.8300 from outside
the US. For questions or problems regarding the HDS WWW page, contact
webmaster@hds.com.
© 1996 by HDS Network Systems
Inc.