#!/bin/sh

/usr/bin/X11/xsetroot -solid "#000044"

CLOUDS=/var/lib/xplanet/clouds_current.jpg
MARKERS=/var/lib/xplanet/markers/cities

if [ -s ${CLOUDS} -a -s ${MARKERS} ] ; then

  LC_ALL=C \
  xplanet \
    -label \
    -longitude 10.76 \
    -latitude 23.5  \
    -radius 69.5 \
    -color LimeGreen \
    2>/dev/null &
   
  ##  -observer 10.76,51.87  \   ## Wernigerode im Zentrum, aber dann ist zu viel Nordpol
fi

# xsnow vom 1. Dezember bis 6. Januar
monattag=`date +%m%d`
machschnee="/usr/bin/xsnow -nomenu -santa 2 &"
if [ $monattag -ge 1201 -o $monattag -le 0106 ]; then eval "$machschnee"; fi

# (at, 3.6.2003 ab hier original /etc/gdm/Init/Default)
#!/bin/sh
# Stolen from the debian kdm setup, aren't I sneaky
# Plus a lot of fun stuff added
#  -George

PATH=/usr/bin/X11:/usr/X11R6/bin:/opt/X11R6/bin:$PATH

sysmodmap=/etc/X11/Xmodmap

XMODMAP=`which xmodmap 2>/dev/null`
if [ x$XMODMAP != x ] ; then
  if [ x$GDM_PARENT_DISPLAY = x ]; then
    if [ -f $sysmodmap ]; then
      $XMODMAP $sysmodmap
    fi
  else
    ( DISPLAY=$GDM_PARENT_DISPLAY XAUTHORITY=$GDM_PARENT_XAUTHORITY $XMODMAP -pke ) | $XMODMAP -
  fi
fi

SETXKBMAP=`which setxkbmap 2>/dev/null`
if [ x$SETXKBMAP != x ] ; then
  # FIXME: is this all right?  Is this completely on crack?
  # What this does is move the xkb configuration from the GDM_PARENT_DISPLAY
  # FIXME: This should be done in code.  Or there must be an easier way ...
  if [ -n "$GDM_PARENT_DISPLAY" ]; then
    XKBSETUP=`( DISPLAY=$GDM_PARENT_DISPLAY XAUTHORITY=$GDM_PARENT_XAUTHORITY $SETXKBMAP -v )`
    if [ -n "$XKBSETUP" ]; then
      XKBKEYMAP=`echo "$XKBSETUP" | grep '^keymap' | awk '{ print $2 }'`
      XKBTYPES=`echo "$XKBSETUP" | grep '^types' | awk '{ print $2 }'`
      XKBCOMPAT=`echo "$XKBSETUP" | grep '^compat' | awk '{ print $2 }'`
      XKBSYMBOLS=`echo "$XKBSETUP" | grep '^symbols' | awk '{ print $2 }'`
      XKBGEOMETRY=`echo "$XKBSETUP" | grep '^geometry' | awk '{ print $2 }'`
      if [ -n "$XKBKEYMAP" ]; then
        $SETXKBMAP -keymap "$XKBKEYMAP"
      elif [ -n "$XKBTYPES" -a -n "$XKBCOMPAT" -a -n "$XKBSYMBOLS" -a -n "$XKBGEOMETRY" ]; then
        $SETXKBMAP -types "$XKBTYPES" -compat "$XKBCOMPAT" -symbols "$XKBSYMBOLS" -geometry "$XKBGEOMETRY"
      elif [ -n "$XKBTYPES" -a -n "$XKBCOMPAT" -a -n "$XKBSYMBOLS" ]; then
        $SETXKBMAP -types "$XKBTYPES" -compat "$XKBCOMPAT" -symbols "$XKBSYMBOLS"
      elif [ -n "$XKBSYMBOLS" ]; then
        $SETXKBMAP -symbols "$XKBSYMBOLS"
      fi
    fi
  fi
fi

exit 0
