#!/bin/bash

# check if second screen is connected
rand=`/usr/bin/xrandr`
if echo $rand | grep -s "TMDS-1 connected" > ~/.xdualscreen 2>&1 ;then
   # use the dual screen settings for openSUSE 11.2
   echo TMDS-1 connected openSUSE 11.2
   xrandr --output TMDS-1  --mode 1920x1080     
   xrandr --output TMDS-1  --right-of LVDS
   if [[ -e .XSettings/Xdefaults_dual ]]; then
      xrdb .XSettings/Xdefaults_dual
   fi
elif echo $rand | grep -s "VGA connected" > ~/.xdualscreen 2>&1 ;then
   # use the dual screen settings for openSUSE 11.2
   echo VGA connected openSUSE 11.2
   xrandr --output VGA  --mode 1680x1050     
   xrandr --output VGA  --right-of LVDS
   if [[ -e .XSettings/Xdefaults_dual ]]; then
      xrdb .XSettings/Xdefaults_dual
   fi
elif echo $rand | grep -s "VGA1 connected" > ~/.xdualscreen 2>&1 ;then
   # use the dual screen settings for openSUSE 11.3
   echo VGA1 connected openSUSE 11.3
   xrandr --output VGA1  --mode     1920x1080 # openSUSE 11.3
#  xrandr --output VGA1  --mode     1680x1050 # openSUSE 11.3
   xrandr --output LVDS1 --mode     1440x900  # openSUSE 11.3
   xrandr --output VGA1  --right-of LVDS1     # openSUSE 11.3
   if [[ -e .XSettings/Xdefaults_dual ]]; then
      xrdb .XSettings/Xdefaults_dual
   fi
elif echo $rand | grep -s "LVDS1 connected" > ~/.xdualscreen 2>&1 ;then
   echo VGA1 not connected openSUSE 11.3
   xrandr --output LVDS1 --mode     1440x900  # openSUSE 11.3
#else
   # use the single screen settings
#  if [[ -e .XSettings/Xdefaults_single ]]; then
#     xrdb .XSettings/Xdefaults_single
#  fi
fi

# enable right button of Logitech MX-1000 Cordless Mouse for insert
lsusb | grep -s "Logitech, Inc. MX-1000 Cordless Mouse" > /dev/null && XMODMAP="1 9 3 4 5 6 7 8 2 10 11 12" || XMODMAP="1 2 3 4 5 6 7 8 9 10 11 12"
echo pointer = $XMODMAP | xmodmap -

# Name: caps-lock_on - disable Caps-Lock key
xmodmap -e "clear Lock"

#  Wait 2 seconds after the last key press before enabling the touchpad.  (default).
/usr/bin/syndaemon -d

