Starting Your X Session:
.xinitrc and .xsession

This is minor voodoo. Depending on how you start X, either the .xinitrc or the .xsession file will be executed by the server, with the user's permissions (NOT root's!)

The best way to deal with this is to create an .xsession file in your home directory, and create a symbolic link to it called ".xinitrc" (ln -s .xsession .xinitrc)

Where to start?

Forget the system default session scripts. Most of them suck, the rest are merely confusing. Try this instead:
#!/bin/sh

# Load your X Resource defaults, if you have them...

if [ -f $HOME/.Xdefaults ]; then
  xrdb -merge $HOME/.Xdefaults
fi


# Set the background color
xsetroot -solid steelblue

# Put up the niftiest clock available.  /usupport/bin is where the
# EWS machines keep "unsupported" stuff

if [ -f /usupport/bin/xdaliclock ]; then

    /usupport/bin/xdaliclock -fn "-adobe-helvetica-bold-*-*-*-16-*-*-*-*-*-*-*" -noseconds -bg black -fg steelblue -geometry 70x64-0+0 &

elif [ -f /usr/local/bin/xdaliclock ]; then

    /usr/local/bin/xdaliclock -fn "-adobe-helvetica-bold-*-*-*-16-*-*-*-*-*-*-*" -noseconds -bg black -fg steelblue -geometry 70x64-0+0 &

else

    xclock -bg black -fg steelblue -padding 2 -geometry 70x64-5+0 &

fi

# Get just the first part of the machine's full hostname, I like
# this as an xload label...  Note the BACKquotes used here!

SHORTHOST=`hostname | sed 's/\..*//'`

# Display a graph of the system load

xload -geometry 70x70-1+68 -fg SteelBlue -bg black -hl blue -fn fixed -label $SHORTHOST &

# Launch an xterm so we have someplace to type...

xterm -bg black -fg green -cr white -ls -geometry 80x25+0+0 &

# Start the window manager.  *I* like to run fvwm if it's there,
# falling back to mwm if that fails.  If you want to just run mwm,
# delete EVERYTHING below except the line that says "exec mwm"

if [ -f /usupport/bin/fvwm ] ; then
    exec /usupport/bin/fvwm
elif [ -f /usr/local/bin/fvwm ] ; then
    exec /usr/local/bin/fvwm
else
    exec mwm
fi

Permissions

Your life will be easier if your .xsession file is executable...
chmod 700 .xsession
  or
chmod u+x .xsession


Mark D. Roth (roth@uiuc.edu)

tcsh-startup top window managers