#!/bin/bash
#
# file: $ISIP_IFC/login/x11_xinitrc.sh
# version: $Id: x11_xinitrc.sh 9614 2004-07-03 18:24:30Z picone $
#
# this file creates an isip-standard environment.
#
# notes:
#
# 07/02/04 (joe picone): streamlined this file for our move to linux/windows
# 07/15/95 (joe picone): first version
#
# important definitions
#
DEFAULT_ISIP_TWMRC="$ISIP_IFC/login/x11_twmrc.sh";
DEFAULT_ISIP_TWM_LOGFILE="$HOME/.X_twm_error_log";

# export terminal type
#
TERM=xterm;
export TERM;

# allow access control to all hosts
#
xhost +;

# generate a log file name and process ID
#
ISIP_TWM_LOGFILE="$DEFAULT_ISIP_TWM_LOGFILE";
twm -f "$DEFAULT_ISIP_TWMRC" 2>"$DEFAULT_ISIP_TWM_LOGFILE" &
ISIP_WINDOWMGR=$!

# load xresources - note that we have dropped use of the preprocessor
# since Solaris does not come with cpp.
#
xrdb -nocpp -load $ISIP_IFC/login/x11_xresources.sh;

# set the bell / screen saver
#
xset b 20 500 50 s default;

# set the background:
#  note that a depth of 1 bit implies black and white, anything else
#  implies color. this may need to be changed for a grayscale terminal.
#  on 6/29/95, an awk script was replaced by cut to handle the
#  outputs of several different versions of X.
#
nbits_depth=`xwininfo -root | grep Depth | awk '{print $NF}'`;
if (test "$nbits_depth" = "1") then
    xsetroot -def;
else
    xsetroot -solid DodgerBlue;
fi

# clean up the index file
#
rm $ISIP_INDEX_FILE;

# start a console window - make sure we use X11's xterm rather than
# the ISIP equivalent (so that the window name is correct). with the
# release of SunOS 4.1.2 or higher, if the terminal is not a console, 
# the "-C" option will not disrupt the console. If the terminal is running
# something like display manager, the existing console window will be
# converted to a plan ol' xterm window.
# 
xterm -C -title "-console-" -n "-console-" -name "-console-" -iconic &

# start the clock
#
/usr/X11R6/bin/xclock &

# wait until the window manager dies (i.e., the user exits)
#
wait $ISIP_WINDOWMGR;

# restore the default background
#
xsetroot -def

#
# end of file
