#!/bin/sh
# $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $
# $OpenBSD: xinitrc.cpp,v 1.13 2006/01/21 22:12:13 matthieu Exp $

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    /usr/X11R6/bin/xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
    /usr/X11R6/bin/xmodmap $sysmodmap
fi

if [ -f $userresources ]; then
    /usr/X11R6/bin/xrdb -merge $userresources
fi

if [ -f $usermodmap ]; then
    /usr/X11R6/bin/xmodmap $usermodmap
fi

# if we have private ssh key(s), start ssh-agent and add the key(s)
id1=$HOME/.ssh/identity
id2=$HOME/.ssh/id_dsa
id3=$HOME/.ssh/id_rsa
if [ -x /usr/bin/ssh-agent ] && [ -f $id1 -o -f $id2 -o -f $id3 ];
then
	eval `ssh-agent -s`
	ssh-add < /dev/null
fi

# start some nice programs

/usr/X11R6/bin/xclock -geometry 50x50-1+1 &
/usr/X11R6/bin/xconsole -iconic &
/usr/X11R6/bin/xterm -geometry 80x24 &
/usr/X11R6/bin/fvwm || /usr/X11R6/bin/xterm

if [ "$SSH_AGENT_PID" ]; then
	ssh-add -D < /dev/null
	eval `ssh-agent -s -k`
fi
