7 rotate (left|right|invert) [output]
8 rotate set (normal|right|inverted|left) [output]
11 rotate set right HDMI2
13 Only the first letter of each command is checked (case-insensitive), so they
14 can be abbreviated or even cut to one letter each in lower or upper case.
16 For example, the following commands do the same thing:
25 # normal right invert left
26 # convert to numbers to allow math to rotate
36 # maps to rot_to_num output
50 # set: rotate set (normal|right|inverted|left) [output]
51 output=${3:-$default_output}
55 # rotate (left|right|invert) [output]
56 output=${2:-$default_output}
57 rot_to_num `xrandr --query --verbose | grep $output | awk '{print $5}'`
59 [lL]*) rot0=$(($rot0 - 1));;
60 [rR]*) rot0=$(($rot0 + 1));;
61 [iI]*) rot0=$(($rot0 + 2));;
67 # add 4 modulo 4 to prevent negatives and overflows
68 num_to_rot $((($rot0 + 4) % 4))
70 xrandr --output $output --rotation $rot1
72 if which xsetwacom >/dev/null; then
73 xsetwacom --set stylus Rotate $rot2
74 xsetwacom --set eraser Rotate $rot2
75 xsetwacom --set touch Rotate $rot2