home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / gdm / Init / Default
Encoding:
Text File  |  2006-10-20  |  2.4 KB  |  84 lines

  1. #!/bin/sh
  2. # Stolen from the debian kdm setup, aren't I sneaky
  3. # Plus a lot of fun stuff added
  4. #  -George
  5.  
  6. PATH=/usr/X11R6/bin:$PATH
  7. OLD_IFS=$IFS
  8.  
  9. gdmwhich () {
  10.   COMMAND="$1"
  11.   OUTPUT=
  12.   IFS=:
  13.   for dir in $PATH
  14.   do
  15.     if test -x "$dir/$COMMAND" ; then
  16.       if test "x$OUTPUT" = "x" ; then
  17.         OUTPUT="$dir/$COMMAND"
  18.       fi
  19.     fi
  20.   done
  21.   IFS=$OLD_IFS 
  22.   echo "$OUTPUT"
  23. }
  24.  
  25.  
  26. sysmodmap=/etc/X11/Xmodmap
  27.  
  28. XMODMAP=`gdmwhich xmodmap`
  29. if [ x$XMODMAP != x ] ; then
  30.   if [ x$GDM_PARENT_DISPLAY = x ]; then
  31.     if [ -f $sysmodmap ]; then
  32.       $XMODMAP $sysmodmap
  33.     fi
  34.   else
  35.     ( DISPLAY=$GDM_PARENT_DISPLAY XAUTHORITY=$GDM_PARENT_XAUTHORITY $XMODMAP -pke ) | $XMODMAP -
  36.   fi
  37.  
  38.   #
  39.   # Switch Sun's Alt and Meta mod mappings
  40.   #
  41.  
  42.   UNAME=`gdmwhich uname`
  43.   PROCESSOR=`$UNAME -p`
  44.   if [ x$PROCESSOR = xsparc ]; then
  45.     if $XMODMAP | /usr/bin/grep mod4 | /usr/bin/grep Alt > /dev/null 2>/dev/null
  46.     then
  47.       $XMODMAP -e "clear Mod1" \
  48.                -e "clear Mod4" \
  49.                -e "add Mod1 = Alt_L" \
  50.                -e "add Mod1 = Alt_R" \
  51.                -e "add Mod4 = Meta_L" \
  52.                -e "add Mod4 = Meta_R"
  53.     fi
  54.   fi
  55. fi
  56.  
  57. SETXKBMAP=`gdmwhich setxkbmap`
  58. if [ x$SETXKBMAP != x ] ; then
  59.   # FIXME: is this all right?  Is this completely on crack?
  60.   # What this does is move the xkb configuration from the GDM_PARENT_DISPLAY
  61.   # FIXME: This should be done in code.  Or there must be an easier way ...
  62.   if [ -n "$GDM_PARENT_DISPLAY" ]; then
  63.     XKBSETUP=`( DISPLAY=$GDM_PARENT_DISPLAY XAUTHORITY=$GDM_PARENT_XAUTHORITY $SETXKBMAP -v )`
  64.     if [ -n "$XKBSETUP" ]; then
  65.       XKBKEYMAP=`echo "$XKBSETUP" | grep '^keymap' | awk '{ print $2 }'`
  66.       XKBTYPES=`echo "$XKBSETUP" | grep '^types' | awk '{ print $2 }'`
  67.       XKBCOMPAT=`echo "$XKBSETUP" | grep '^compat' | awk '{ print $2 }'`
  68.       XKBSYMBOLS=`echo "$XKBSETUP" | grep '^symbols' | awk '{ print $2 }'`
  69.       XKBGEOMETRY=`echo "$XKBSETUP" | grep '^geometry' | awk '{ print $2 }'`
  70.       if [ -n "$XKBKEYMAP" ]; then
  71.         $SETXKBMAP -keymap "$XKBKEYMAP"
  72.       elif [ -n "$XKBTYPES" -a -n "$XKBCOMPAT" -a -n "$XKBSYMBOLS" -a -n "$XKBGEOMETRY" ]; then
  73.         $SETXKBMAP -types "$XKBTYPES" -compat "$XKBCOMPAT" -symbols "$XKBSYMBOLS" -geometry "$XKBGEOMETRY"
  74.       elif [ -n "$XKBTYPES" -a -n "$XKBCOMPAT" -a -n "$XKBSYMBOLS" ]; then
  75.         $SETXKBMAP -types "$XKBTYPES" -compat "$XKBCOMPAT" -symbols "$XKBSYMBOLS"
  76.       elif [ -n "$XKBSYMBOLS" ]; then
  77.         $SETXKBMAP -symbols "$XKBSYMBOLS"
  78.       fi
  79.     fi
  80.   fi
  81. fi
  82.  
  83. exit 0
  84.