i3/.config/i3/rotate.sh

33 lines
717 B
Bash
Executable File

#!/bin/bash
#ids=$(xinput --list|grep "SAM\|Digitizer"|grep -oP "id=\K[\w]*") # gets by name
ids=$(xinput list | grep -oP "^⎜.*id=\K[\w]*" ) # gets all pointing
#ids=( 9 10 11 )
transform_matrix=""
rotate=$1
case $rotate in
0) #normal
transform_matrix="1 0 0 0 1 0 0 0 1";;
1) #left
transform_matrix="0 -1 1 1 0 0 0 0 1";;
2) #inverted
transform_matrix="-1 0 1 0 -1 1 0 0 1";;
3) #right
transform_matrix="0 1 0 -1 0 1 0 0 1";;
esac
for input in ${ids[@]}; do
echo xinput set-prop $input "Coordinate Transformation Matrix" $transform_matrix
xinput set-prop $input "Coordinate Transformation Matrix" $transform_matrix
done
xrandr -o $rotate
if [ -e "$HOME/.fehbg" ]
then
~/.fehbg
fi