# swap ctl and caps:
#/usr/bin/setxkbmap -option ctrl:swapcaps

COLORDEPTH=$(xdpyinfo | grep -i 'depth of root window' | awk '{print $5}')
SCREENRES=$(xdpyinfo | grep 'dimensions' | awk '{print $2}')

# set root-window background
if [ ${COLORDEPTH} -gt 16 -a -x /usr/bin/display -a -f ${HOME}/.wallpaper.jpg ]; then
  /usr/bin/display -window root -resize \!${SCREENRES} ${HOME}/.wallpaper.jpg
else
  /usr/bin/xsetroot -solid darkslategray
fi

# start clock in lower-right corner of the screen (maxX-150, maxY-37)
if [ -x /usr/bin/xdaliclock ]; then
  /usr/bin/xdaliclock -transparent -builtin0 -noseconds \
         -xrm "*overrideRedirect: True" \
         -geometry +$(( ${SCREENRES%x*} - 100 ))+$(( ${SCREENRES#*x} - 37 )) &
fi

# prevent mouse from going nuts while we type (tested on a MacBook Pro):
#/usr/bin/syndaemon -i 1 -k -d

# authentication agent (e.g. for when virt-manager needs to ask for password):
AUTH_AGENT='/usr/libexec/polkit-mate-authentication-agent-1'
if [ -x ${AUTH_AGENT} ]; then
  ${AUTH_AGENT} &
fi

# start some useful applets and the panel, if available:
PANEL='/usr/bin/lxpanel'
PANEL_APPLETS='
  /usr/bin/mate-power-manager
  /usr/bin/mate-volume-control-applet
  /usr/bin/nm-applet
  '
if [ -x ${PANEL} ]; then
  for APP in ${PANEL_APPLETS}; do
    if [ -x ${APP} ]; then
      ${APP} &
    fi
  done
  ${PANEL} &
fi

# fire up some useful default apps:
/usr/bin/xterm -geometry 80x25+0+0 &
#/usr/bin/pidgin &
#/usr/bin/firefox &
#/usr/bin/xscreensaver &
