From WildPikachu, 5 Years ago, written in Bash.
  1. #!/bin/bash
  2.  
  3. CUR=$(xrandr | grep LVDS1 | awk '{ print $4 }')
  4.  
  5. echo "CURRENT: $CUR"
  6.  
  7.  
  8. if [ "$CUR" == "left" ]
  9. then
  10.         xrandr -o 0
  11.         for i in Touchscreen MultiTouch "Pen "{stylus,eraser,pad}
  12.         do
  13.                 xinput set-prop "N-Trig $i"  --type=float "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
  14.         done
  15.         gnome-shell --replace > /dev/null 2>&1 &
  16.  
  17. elif [ "$CUR" == "(normal" ]
  18. then
  19.         xrandr -o 1
  20.  
  21.         # rotate left
  22.         for i in Touchscreen MultiTouch "Pen "{stylus,eraser,pad}
  23.         do
  24.                 xinput set-prop "N-Trig $i" --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
  25.         done
  26.  
  27.         # rotate right
  28.         #xinput set-prop "N-Trig Touchscreen" --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
  29.  
  30.         gnome-shell --replace > /dev/null 2>&1 &
  31. fi
  32.  
captcha