aboutsummaryrefslogtreecommitdiff
path: root/bin/rot
blob: 121471d07ce001742124e9d43ccf80411de5d8cd (plain) (blame)
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
#!/bin/sh
set -x

IFS="
"

devices="$(xinput list --name-only | grep Wacom)"

setTransform() {
	for d in $devices ; do
		xinput set-prop "$d" --type=float \
			"Coordinate Transformation Matrix" \
			"$@"
	done
}

while [ $# -gt 0 ] ; do case $1 in
	left)
		setTransform \
			0 -1 1 1 0 0 0 0 1
		xrandr -o left
		shift
		;;
	right)
		setTransform \
			0 1 0 -1 0 1 0 0 1
		xrandr -o right
		shift
		;;
	normal)
		setTransform \
			0  0 0 0 0 0 0 0 0
		xrandr -o normal
		shift
		;;
	inverted)
		setTransform \
			-1 0 1 0 -1 1 0 0 1
		xrandr -o inverted
		shift
		;;
	*)
		echo Unknown option "$1";
		shift
		exit 1
	;;
esac ; done