1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#!/usr/bin/env bash
nibble="TPPS/2 IBM TrackPoint"
stylus="Wacom ISDv4 90 Pen stylus"
eraser="Wacom ISDv4 90 Pen eraser"
matrix="$(xinput list-props "$stylus" | awk '/Coordinate Transformation Matrix/{print $5$6$7$8$9$10$11$12$NF}')"
# Matrix declarations
normal="1 0 0 0 1 0 0 0 1"
normal_float="1.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,1.000000"
inverted="-1 0 1 0 -1 1 0 0 1"
inverted_float="-1.000000,0.000000,1.000000,0.000000,-1.000000,1.000000,0.000000,0.000000,1.000000"
left="0 -1 1 1 0 0 0 0 1"
left_float="0.000000,-1.000000,1.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000"
right="0 1 0 -1 0 1 0 0 1"
if [ "$matrix" == $normal_float ] && [ "$1" != "-n" ]; then
xrandr -o inverted
xinput set-prop "$stylus" 166 $inverted
xinput set-prop ""$eraser"" 166 $inverted
xinput set-prop ""$nibble"" 166 $inverted
elif [ "$matrix" == $inverted_float ] && [ "$1" != "-j" ] && [ "$1" != "-n" ]; then
xrandr -o left
xinput set-prop "$stylus" 166 $left
xinput set-prop "$eraser" 166 $left
xinput set-prop "$nibble" 166 $left
elif [ "$matrix" == $left_float ] && [ "$1" != "-j" ] && [ "$1" != "-n" ]; then
xrandr -o right
xinput set-prop "$stylus" 166 $right
xinput set-prop "$eraser" 166 $right
xinput set-prop "$nibble" 166 $right
else
xrandr -o normal
xinput set-prop "$stylus" 166 $normal
xinput set-prop "$eraser" 166 $normal
xinput set-prop "$nibble" 166 $normal
fi
|