#!/bin/bash
# This script rotates the screen and touchscreen input left and input right, changing back and forth
rotation="$(xrandr -q --verbose | grep 'connected' | egrep -o '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')"
case "$rotation" in
normal)
xrandr -o left
xinput set-prop 'Atmel Atmel maXTouch Digitizer' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1
;;
left)
xrandr -o normal
xinput set-prop 'Atmel Atmel maXTouch Digitizer' 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1
esac
onboard &