Screen rotation

Several things need to be covered in order to rotate the screen properly: 1. Detection 2. Visual rotation 3. Input rotation 4. Settings

Detection

Latitude XT detects the screen rotation but to be able to use it in Linux, you need to patch dell_wmi module.

Visual rotation

Visual rotation is quite easy with XrandR.

Input rotation

This is quite tricky. I managed to get the stylus input rotated properly using xsetwacom with appropriate Coordinate Transformation Matrix.

Unfortunately finger input (touchscreen/multitouch) is unusable due to constant “jumps” and glitches.

Script

I found this script on LinuxMint forum and it’s the best rotation script I could find:

#!/bin/sh

# Author: Oliver Mueller
# Source: http://forums.linuxmint.com/viewtopic.php?f=191&t=108174

# Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation.

rotation="$(xrandr -q --verbose | grep 'connected' | egrep -o  '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')"

# Using current screen orientation proceed to rotate screen and input devices.

case "$rotation" in
   normal)
    # rotate to the right
    xrandr -o right
    xsetwacom set "N-Trig Pen stylus" rotate cw
    xinput set-prop "N-Trig MultiTouch" "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
    ;;
    right)
    # rotate to inverted
    xrandr -o inverted
     xsetwacom set "N-Trig Pen stylus" rotate half
    xinput set-prop "N-Trig MultiTouch" "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
    ;;
    inverted)
    # rotate to the left
    xrandr -o left
    xsetwacom set "N-Trig Pen stylus" rotate ccw
    xinput set-prop "N-Trig MultiTouch" "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
    ;;
    left)
    # rotate to normal
    xrandr -o normal
     xsetwacom set "N-Trig Pen stylus" rotate none
    xinput set-prop "N-Trig MultiTouch" "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
    ;;
esac

You can easily bind this script to RotateScreenButton on the display.