Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 34 lines (25 sloc) 945 Bytes
#!/bin/sh
#
# Cribbed heavily from:
# http://www.androidtablets.net/threads/rotating-screen-touchpad-on-linux.33309/
#
rotation="$(xrandr -q --verbose | grep 'connected' | egrep -o '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')"
function input_rotator {
# TypeCover
xinput set-prop --type=int --format=8 "Microsoft Surface Type Cover Mouse" "Evdev Axes Swap" ${1}
xinput set-prop --type=int --format=8 "Microsoft Surface Type Cover Mouse" "Evdev Axis Inversion" 0 ${1}
# Pen
xinput set-prop --type=int --format=8 "NTRG0001:01 1B96:1B05 Pen" "Evdev Axes Swap" ${1}
xinput set-prop --type=int --format=8 "NTRG0001:01 1B96:1B05 Pen" "Evdev Axis Inversion" 0 ${1}
xinput set-prop --type=int --format=8 4 "Evdev Axis Inversion" 0 ${1}
}
case "$rotation" in
normal)
xrandr -o right
input_rotator 1
;;
right)
xrandr -o normal
input_rotator 0
;;
esac