aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2023-01-10 21:36:29 -0500
committerMitchell Riedstra <mitch@riedstra.dev>2023-01-10 21:36:29 -0500
commit94c9429abbc1d757aaf59e786d5aaa33fc9aabe6 (patch)
tree1ecfdbe2a3ad7fe4c2bc6323a0b91f0e369ed175
parentb893c2547d4ea73247f1ed5b1934187eb2c7d372 (diff)
downloaddotfiles-94c9429abbc1d757aaf59e786d5aaa33fc9aabe6.tar.gz
dotfiles-94c9429abbc1d757aaf59e786d5aaa33fc9aabe6.tar.xz
Add rotation script for the tablet
-rwxr-xr-xbin/rot48
1 files changed, 48 insertions, 0 deletions
diff --git a/bin/rot b/bin/rot
new file mode 100755
index 0000000..121471d
--- /dev/null
+++ b/bin/rot
@@ -0,0 +1,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
+