#!/bin/bash
# $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $

#The following lines are from the old .xinitrc as far back as OSX 10.4
#userresources=$HOME/.Xresources
#usermodmap=$HOME/.Xmodmap
#sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
#sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap

#These lines are from the default xinitrc file on the version meant for OSX 10.9
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/opt/X11/lib/X11/xinit/.Xresources
sysmodmap=/opt/X11/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

# start some nice programs

quartz-wm &
# twm &
#/usr/X11R6/bin/quartz-wm &
# xclock -geometry 50x50-1+1 &
# xterm -geometry 80x50+494+51 &
# xterm -geometry 80x20+494-0 &

#XPREP now spawns its own xterm (dark on light) using a launch wrapper script.
#xterm -bg grey90 -fg black -geometry 82x67+1168+60 -T "xterm for XPREP" -sb -sl 1500 -e "cd /Structures; tcsh" &
#sleep 0.25

# Open a yellow on dark grey xterm in the directory where in-progress structures are kept.
# Modify the colour scheme, geometry and/or directory as necessary.  It should be easy to 
# decipher what goes where.
#

screen_height=$(xdpyinfo | grep dimension | awk '{print $2}' | cut -d 'x' -f2 | xargs)

if [[ "$screen_height" == "1178" ]]; then
  xterm -bg grey10 -fg yellow -geometry 82x81+1409+0 -T "xterm for XP" -sb -sl 1500 -e "cd /Structures; bash"
else
  xterm -bg grey10 -fg yellow -geometry 82x67+1168+0 -T "xterm for XP" -sb -sl 1500 -e "cd /Structures; bash"
fi
