-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrotate
More file actions
executable file
·75 lines (65 loc) · 1.22 KB
/
Copy pathrotate
File metadata and controls
executable file
·75 lines (65 loc) · 1.22 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
get_rotation(){
rotation=$( xrandr --query --verbose | grep "LVDS-1" | cut -d ' ' -f 6)
case $rotation in
normal)
direction="left"
;;
left)
direction="down"
;;
right)
direction="up"
;;
inverted)
direction="right"
;;
esac
echo "$direction"
}
rotate(){
ALL_DEV="$(xinput | grep 'slave pointer' | awk -F'id=' '{ print int(substr($2,1,2)) }')"
local direction="$@"
if [[ $direction = "next" ]]; then
direction="$(get_rotation)"
# echo "setting direction as $direction"
fi
case $direction in
down)
NUM_OR=2
NUM_PEN=3
TRANSFORM_MATRIX="-1 0 1 0 -1 1 0 0 1"
;;
right)
NUM_OR=3
NUM_PEN=1
TRANSFORM_MATRIX="0 1 0 -1 0 1 0 0 1"
;;
up)
NUM_OR=0
NUM_PEN=none
TRANSFORM_MATRIX="1 0 0 0 1 0 0 0 1"
;;
left)
NUM_OR=1
NUM_PEN=2
TRANSFORM_MATRIX="0 -1 1 1 0 0 0 0 1"
;;
esac
xrandr -o $NUM_OR
# xsetwacom set "10" "Rotate" "$NUM_PEN"
for i in $ALL_DEV; do
## xsetwacom set "$i" "Rotate" "$NUM_PEN"
xinput -set-prop $i 'Coordinate Transformation Matrix' $TRANSFORM_MATRIX
done
}
if [ "$#" -gt 0 ]; then
direction="$@"
else
direction="next"
fi
rotate $direction
for id in 9 10 15: do
xsetwacom --set $id MapToOutput LVDS-1
done
exit 0