View Single Post
Benson's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#32
Here it is, new and improved:
Code:
#!/bin/sh
if [ "x$1" == x ] ; then
  direction=normal
else
  direction=$1
fi

case $direction in
  [Cc][Ww])
    direction=`xrandr --verbose|awk '/connected/ {print $5}'`
    case $direction in
      normal)
        direction=left;
        ;;
      left)
        direction=inverted;
        ;;
      inverted)
        direction=right;
        ;;
      right)
        direction=normal;
      ;;
    ;;
  [Cc][Cc][Ww])
    direction=`xrandr --verbose|awk '/connected/ {print $5}'`
    case $direction in
      normal)
        direction=right;
        ;;
      left)
        direction=normal;
        ;;
      inverted)
        direction=left;
        ;;
      right)
        direction=inverted;
      ;;
    ;;
esac

case $direction in
  [Nn]ormal)
    xmodmap -e "keycode 114 = Right" -e "keycode 111 = Up" -e "keycode 113 = Left" -e "keycode 116 = Down";
    ;;
  [Ll]eft)
    xmodmap -e "keycode 114 = Down" -e "keycode 111 = Right" -e "keycode 113 = Up" -e "keycode 116 = Left";
    ;;
  [Ii]nverted)
    xmodmap -e "keycode 114 = Left" -e "keycode 111 = Down" -e "keycode 113 = Right" -e "keycode 116 = Up";
    ;;
  [Rr]ight)
    xmodmap -e "keycode 114 = Up" -e "keycode 111 = Left" -e "keycode 113 = Down" -e "keycode 116 = Right";
    ;;
  *)
    echo "Usage: $0 [ cw | ccw | normal | inverted | left | right ]";
    exit 1;
    ;;
esac

xrandr -o $direction
EDIT: Curious why you ditched it? I think there's nothing greater. (With some modifications, of course. The default config doesn't do the fine software justice.)

EDIT: Now integrated into zip in my post above.

Last edited by Benson; 2008-03-14 at 12:51.
 

The Following 2 Users Say Thank You to Benson For This Useful Post: