#!/bin/sh

# Sample .xsession file, by Branden Robinson
# To use this file:
#    cp -i /usr/doc/xbase/examples/xsession $HOME/.xsession

# Users are strongly encouraged to edit this file to their tastes.

# The X session file, in this case $HOME/.xsession, is a shell script that
# contains a list of things to do (programs to run and so forth) every time
# X Windows starts for a particular user.  It allows you to personalize your
# X Windows environment and get down to business (or play) faster.  If there
# are things you want done every time you start X (or log into a machine using
# XDM), rather than doing them by hand every time by running commands from a
# terminal window, you can place them here, in the .xsession file, and they
# will be run automatically, every time.

# There are essentially three types of commands of in an .xsession file; we
# usually fire up some persistent X clients, like xterms, a clock, a biff
# program of some sort, etc., which we expect to stick around more or less
# for the duration of our X Windows session.  These commands will need to
# be backgrounded, or "amped off", otherwise your X session will "stay" on
# that command until it exits.  The second type of command is relatively
# instantaneous in effect, or we *desire* the X sesson to stop until that
# command exits -- we don't background those.  Finally, at the end of our
# .xsession file we generally "exec" a window manager.  That replaces the
# running .xsession shell script with the window manager process, and when the
# window manager exits, the X session is over (the user returns to the virtual
# console or the XDM login screen).

# Before starting, I should mention that all of the commands used in this
# example have manual pages ("man xclock", for instance) and reading those
# will help you a long way towards getting things tweaked just the way you
# like them.

# First, let's have a command that is not backgrounded; let's show the
# system's message of the day with the xmessage command (which is in the
# xcontrib package).  This may be very useful on multi-user machines where the
# /etc/motd file is actually used for announcements; it may be less useful
# on a personal computer that is minimally shared.  If we amped this off,
# then the message box would come up and execution would proceed (in other
# words, the remaining commands in this .xsession script will go ahead and
# execute while the xmessage window in still on the screen).  Without being
# backgrounded, this sort of forces an acknowledgement of the message before
# proceeding, but a timeout of sixty seconds, after which the message will
# dismiss itself, is set in case the machine is slow and the user has wandered
# off just after logging in (if it takes a while to start the remaining X
# clients, he'll probably want to come back with them up and running).

# You may remove the if block if you know you have xcontrib installed (if
# you're unfamiliar with Bourne shell scripting, simply delete, or comment out
# by adding a hash mark to the front of, the lines that begin with "if" and
# "fi").  Commands referenced in this script that are not protected by an if
# block are part of the xbase package itself, as is this example file, so we
# assume they are available.
if [ -x /usr/bin/X11/xmessage ]; then
  xmessage -nearmouse -file /etc/motd -timeout 60 -button Continue
fi

# The following command simply sets the screen background (often called the
# "desktop" in other winodwing systems, but in X the proper term is "root
# window") to blue, and has relatively instantaneous effect.  We could amp it
# off, but that would be pretty pointless, since this command takes almost no
# time to run.  If you have something else that will do something with the
# root window (xloadimage, floatbg, xearth, etc.), you'll probably want to
# comment out or delete the next line.
xsetroot -solid skyblue

# Let's get a little load average action going...
# It is important to learn how the geometry option/resource works -- the first
# two numbers are the dimensions (width and height, in pixels), and the next
# two are position parameters as offsets from the edges of the screen.  See
# the X manpage ("man X"), section "GEOMETRY SPECIFICATIONS" for more
# information.
if [ -x /usr/bin/X11/xload ]; then
  xload -bg black -fg green -hl red -update 5 -geometry 170x100+70+0 &
fi

# Something to check the mail...
if [ -x /usr/bin/X11/xbiff ]; then
  xbiff -bg black -fg green -geometry 100x50+255+0 &
fi

# Something to keep track of time...
xclock -bg black -fg green -update 1 -digital -geometry 150x40-0+0 &

# And finally, the most important part of any GUI, the command-line interface.
# Note that for xterm the geometry dimensions are expressed in character
# cells, not pixels (e.g., 80x24).
xterm -title "Debian GNU/Linux" -ls -geometry 80x24+70+135 &

# Now execute the window manager and we'll be on our way.  Most people have
# window managers they like better than twm -- install the corresponding
# Debian package and edit the following line appropriately if you're one of
# them.
exec twm
