cur_state=`xrandr -q | grep LVDS | cut -d' ' -f5`
if [ $cur_state = "(normal" ]; then
	cur_state="0"
elif [ $cur_state = "left" ]; then
	cur_state="1"
elif [ $cur_state = "inverted" ]; then
	cur_state="2"
elif [ $cur_state = "right" ]; then
	cur_state="3"
fi

if [ $cur_state = "3" ]; then
	xrandr -o 1
	xsetwacom set 10 Rotate ccw
	xsetwacom set 9 Rotate ccw
	xsetwacom set 15 Rotate ccw
elif [ $cur_state = "1" ]; then
	xrandr -o 3
	xsetwacom set 10 Rotate cw
	xsetwacom set 9 Rotate cw
	xsetwacom set 15 Rotate cw
elif [ $cur_state = "0" ]; then
	xrandr -o 2
	xsetwacom set 10 Rotate half
	xsetwacom set 9 Rotate half
	xsetwacom set 15 Rotate half
else
	xrandr -o 0
	xsetwacom set 10 Rotate none
	xsetwacom set 9 Rotate none
	xsetwacom set 15 Rotate none
fi