#!/bin/sh
#
# /etc/X11/kdm/Xsetup_0
#
# This script is run whenever kdm is asked to manage a display on :0

sysmodmap=/etc/X11/Xmodmap

if grep -qs ^run-xconsole /etc/X11/kdm/kdm.options; then
  if [ -e /var/run/xconsole_0.pid ]; then
    # kill any running xconsole
    pid=$(cat /var/run/xconsole_0.pid 2> /dev/null)
    if [ "$pid" ]; then
      kill $pid 2> /dev/null
    fi
    rm /var/run/xconsole_0.pid
  fi
  # start fresh xconsole and store its PID
  xconsole -geometry 480x130-0-0 -notify -verbose -fn fixed \
   -exitOnFail -file /dev/xconsole &
  echo $! > /var/run/xconsole_0.pid
fi

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

# Example KDM options

#KDE_BITMAP=/usr/share/apps/kdm/pics/Debian.jpg
#xsetroot -cursor_name left_ptr -solid '#C0C0C0'
#if [ -e /usr/X11R6/bin/xview ]; then
#  xview -border black -fullscreen -onroot $KDE_BITMAP
#fi

/usr/bin/kdmdesktop &
exit 0
