Skip to content

sarmbruster/thinkpad_x1_yoga_rotation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Warning
since I moved to Ubuntu 17.10 with Wayland and Gnome I don’t actively develop this script any longer since the desired functionality seem to work out of the box.

auto screen rotation on a Thinkpad X1 Yoga

The Thinkpad X1 Yoga is a convertible laptop, so you can flip the screen over and your laptop is now a tablet. Tablets are typically used in different orientations. To detect orientation it is supplied with a BMA 150 accelerometer.

Since version 4.9-rc2 linux kernel contains patches for this device so it works nicely with iio-sensor-proxy. It seems that Kernel 4.10 has an issue with this which was resolved in Kernel 4.11.

This project provides a script dealing with automatic screen rotation and some other tablet/laptop convenience features.

So far, I’ve tested it with Ubuntu 17.04 and appreciate any feedback.

prerequisites

  • Linux kernel 4.9-rc2 or >= 4.11

  • linux packages python3, python3-dbus, python3-gi, onboard, iio-sensor-proxy

installation and usage

This python script thinkpad_x1_yoga_rotation.py provides the following features:

  • Listen to dbus signals from sensor proxy and check if display orientation has changed. In case of a change event the display is rotated approriately using xrandr. The X1 Yoga has 3 wacom devices: finger touch, pen stylus and pen eraser. For all of them rotation is adoption appriately.

  • When the laptop is converted to tablet mode touchpad and trackpoint are switched off and a onboard keyboard is started. When going back to laptop mode the orginal state is restored.

  • disable finger touch if stylus is close to the display

  • upon termination, restore "normal" screen orientation, switch on touchpad and trackpoint

usage

./thinkpad_x1_yoga_rotation.py

Now rotate your display by 90 degrees and screen orientation should follow.

setup autostart

On Ubuntu open "Startup Applications" ("Startprogramme" in German) and add a startup application using the full path to thinkpad_x1_yoga_rotation.py.

About

automatic screen rotation on a Lenovo X1 Yoga

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages