Linux rotate Lenovo Yoga X1 Display with Xrandr

The Lenovo Yoga X1 with the OLED display is a great linux laptop, but there are some things that can be quite tricky. When you rotate the Lenovo Yoga X1, you need also adjust the Touchscreen and Pen Input Matrix (Two devices). There are two different drives available for the touchpad, libinput or evdev. Personally i prefer libinput as it just seems to work more precise and reliable.

So for the perfect tablet left mode, you need the following (Check the ids before with xinput)

# Rotate the screen right (prefer that, because on the on this side there are no buttons)
xrandr -o right

# For Evdev:
# xinput set-prop 9 ‘Evdev Axis Inversion’ 1, 0
# xinput set-prop 9 ‘Evdev Axis Swap’ 1
# xinput set-prop 16 ‘Evdev Axis Inversion’ 1, 0
# xinput set-prop 16 ‘Evdev Axis Swap’

# For Libinput
xinput set-prop 9 ‘Coordinate Transformation Matrix’ 0 1 0 -1 0 1 0 0 1
xinput set-prop 16 ‘Coordinate Transformation Matrix’ 0 1 0 -1 0 1 0 0 1

# Keyboard is disabled automatically, but not the touchpad
xinput –disable 13

In combination with a nice virtual keyboard if needed (for example onscreen) and xournal the table mode makes a lot of fun for annotating PDFs with the pen (you can also disable touch, so it only listens to the pen!!)