Last active
May 21, 2017 07:54
-
-
Save n1trux/491c52d547d746d8dbdbacb92e97a287 to your computer and use it in GitHub Desktop.
x230 tablet scripts for rotating screen and disabling ultranav touchpad/trackpoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation. | |
rotation="$(xrandr -q --verbose | grep 'connected' | egrep -o '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')" | |
# Using current screen orientation proceed to rotate screen and input devices. | |
# find the names for devices with xinput --list | |
case "$rotation" in | |
inverted) | |
# rotate to the left | |
xrandr -o left | |
xsetwacom set 'Wacom ISDv4 E6 Pen stylus' rotate ccw | |
xsetwacom set 'Wacom ISDv4 E6 Pen eraser' rotate ccw | |
xsetwacom set 'Wacom ISDv4 E6 Finger touch' rotate ccw | |
xinput set-prop 'SynPS/2 Synaptics TouchPad' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1 | |
xinput set-prop 'TPPS/2 IBM TrackPoint' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1 | |
;; | |
right) | |
# rotate to inverted | |
xrandr -o inverted | |
xsetwacom set 'Wacom ISDv4 E6 Pen stylus' rotate half | |
xsetwacom set 'Wacom ISDv4 E6 Pen eraser' rotate half | |
xsetwacom set 'Wacom ISDv4 E6 Finger touch' rotate half | |
xinput set-prop 'SynPS/2 Synaptics TouchPad' 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1 | |
xinput set-prop 'TPPS/2 IBM TrackPoint' 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1 | |
;; | |
normal) | |
# rotate to the right | |
xrandr -o right | |
xsetwacom set 'Wacom ISDv4 E6 Pen stylus' rotate cw | |
xsetwacom set 'Wacom ISDv4 E6 Pen eraser' rotate cw | |
xsetwacom set 'Wacom ISDv4 E6 Finger touch' rotate cw | |
xinput set-prop 'SynPS/2 Synaptics TouchPad' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1 | |
xinput set-prop 'TPPS/2 IBM TrackPoint' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1 | |
;; | |
left) | |
# rotate to normal | |
xrandr -o normal | |
xsetwacom set 'Wacom ISDv4 E6 Pen stylus' rotate none | |
xsetwacom set 'Wacom ISDv4 E6 Pen eraser' rotate none | |
xsetwacom set 'Wacom ISDv4 E6 Finger touch' rotate none | |
xinput set-prop 'SynPS/2 Synaptics TouchPad' 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1 | |
xinput set-prop 'TPPS/2 IBM TrackPoint' 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment