From 59fa6ca4ac6ab498b02fb43edd7b569ac458b444 Mon Sep 17 00:00:00 2001 From: crater2150 Date: Tue, 31 Aug 2021 16:54:50 +0200 Subject: [PATCH] new script: rotate --- misc/rotate | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 misc/rotate diff --git a/misc/rotate b/misc/rotate new file mode 100755 index 0000000..e3b96b8 --- /dev/null +++ b/misc/rotate @@ -0,0 +1,47 @@ +#!/bin/zsh +OUTPUT=eDP1 + +COORD_TRANS_NORMAL=( 1 0 0 + 0 1 0 + 0 0 1 ) + +COORD_TRANS_LEFT=( 0 -1 1 + 1 0 0 + 0 0 1 ) + +COORD_TRANS_RIGHT=( 0 1 0 + -1 0 1 + 0 0 1 ) + +COORD_TRANS_INV=( -1 0 1 + 0 -1 1 + 0 0 1 ) + +typeset -a mat +case $1 in + l|left) + mat=($COORD_TRANS_LEFT) + rotation=left + ;; + r|right) + mat=($COORD_TRANS_RIGHT) + rotation=right + ;; + i|inverted) + mat=($COORD_TRANS_INV) + rotation=inverted + ;; + n|normal) + mat=($COORD_TRANS_NORMAL) + rotation=normal + ;; + *) + echo "Usage: $0 " + exit 1 + ;; +esac + +for dev in $(xinput list | grep slave.\*pointer | grep -oP '(?<=id=)\d*'); do + xinput set-prop $dev 'Coordinate Transformation Matrix' "${mat[@]}" +done +xrandr --output $OUTPUT --rotate $rotation