5 #Detect the current orientation
6 current_orientation="$(xrandr -q --verbose | grep 'connected' | egrep -o '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')"
7 # 1=left, 2=inverted, 3=right, 0=normal
9 #Next orintation, rotate 90 degrees
10 case $current_orientation in
25 #Use the orientation if it is given
26 if [ "$1." != "." ]; then
30 #Touchscreen input method
33 #Detect input device id
34 device=`xinput --list | grep Cando|awk '{ print $12 }' | awk -F '=' '{ print $2 }'`
36 #Default input settings (first 2 rows of a 3x3 rotation matrix)
44 #Work out the input settng for each orientatiom
80 #Set the touchscreen rotation
81 if [ $method = "evdev" ]; then
82 xinput set-prop "$device" "Coordinate Transformation Matrix" $mata $matb $matc $matd $mate $matf 0 0 1
85 #Set the screen rotation
86 xrandr -o $orientation