#!/bin/sh
########################################################################
# .xinitrc #
# 5/22/00 Stefan Jeglinski,
jeglin@rapierbit.org #
# based on one written by hollis+@andrew.cmu.edu 1/5/99 #
# Thanks Hollis! #
# #
# To use: #
# * if you have a ~/.Xclients, remove it. The system copy is in #
# /etc/X11/xinit/Xclients if you ever want it back. #
# #
# * place this file in your home (~) directory. For root, #
# home is /root. #
# #
# * Type 'startx after', 'startx kde', etc. #
# #
########################################################################
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
xclients=$HOME/.Xclients
sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f $userresources ]; then
xrdb -merge $userresources
fi
if [ -f $usermodmap ]; then
xmodmap $usermodmap
fi
########################################################################
# #
# to fix backspace and delete in X if necessary; #
# these may need to be removed for XFree86 4.x #
# #
########################################################################
xmodmap -e "keycode 59 = BackSpace"
xmodmap -e "keycode 125 = Delete"
########################################################################
# #
# accelerate the mouse in the window manager; #
# Gnome and KDE typically override this #
# #
########################################################################
xset m 8 3
########################################################################
# #
# define mouse button usage in the window manager; #
# this directive may be "eaten" by the Gnome or KDE startup #
# and may therefore need to be run again after the environment #
# is started #
# #
########################################################################
xmodmap -e "pointer = 2 1 3"
########################################################################
# #
# * Set variables for different window managers and environments #
# #
# * $1 represents the first argument to startx. #
# #
# * WM is the name of the program to execute. This is normally the #
# window manager itself, but in the case of kde or gnome it needs #
# to be the gnome-session or startkde script. #
# #
########################################################################
ARG=$1
# specify the default argument here:
DEFAULTWM="gnome-session"
if [ ! $ARG ]; then
ARG=$DEFAULTWM
fi
########################################################################
# #
# The difference between a desktop environment and a window manager #
# is that an environment provides a desktop, while a window manager #
# just handles the window dressing. An environment needs a WM, but #
# not vice versa. The only 2 environments are Gnome and KDE. Common #
# window managers for Gnome are Sawfish and Enlightenment. KDE #
# has its own window manager (kwm). #
# #
########################################################################
# to add another wm/environment here, just copy, paste,
# and edit the 'elif' line:
if [ $ARG = "gnome" ]; then
WM=gnome-session
elif [ $ARG = "kde" ]; then
WM=startkde
elif [ $ARG = "after" ]; then
WM=afterstep
elif [ $ARG = "wm" ]; then
WM=wmaker
elif [ $ARG = "en" ]; then
WM=enlightenment
elif [ $ARG = "bb" ]; then
WM=blackbox
elif [ $ARG = "ice" ]; then
WM=icewm
else
WM=$DEFAULTWM
fi
########################################################################
# #
# set a background window color for window managers only; #
# if an environment starts up, it will override this #
# #
########################################################################
xsetroot -solid MidnightBlue
########################################################################
# #
# don't turn on screen-saver for window manager #
# #
########################################################################
#xset s on
########################################################################
# #
# turn on a REAL screensaver,
http://www.jwz.org/xscreensaver/ #
# #
########################################################################
xhost +localhost
xscreensaver &
xscreensaver-command -activate
########################################################################
# #
# The next line actually runs the selected window manager and logs #
# the output (stdout AND stderr) to the file ~/console. If you run a #
# #
# tail -f ~/console #
# #
# in an xterm, it will display the (constantly updated) contents of #
# that file. This can be usful for talk requests, wm errors, etc. #
# #
########################################################################
exec $WM >& ~/console