Control screen rotation, touch screen, and trackpad using the terminal
Once I started work, I bought myself a Lenovo Yoga 3 14” laptop, because I needed a thin and light laptop for trains and the office. This came with windows, which within 10 minutes was running Ubuntu Gnome! Ubuntu greatly increased the performance, but I had to sacrifice all the screen, touchpad and keyboard customization when changing ‘modes’.
I found this thread with someone else trying to find a solution to this, to find a nice way of rotating the screen when in tablet mode. On the thread was a really nice simple script that rotated the screen perfectly, and did the touchscreen too.
This script worked great, doing exactly what it said it did, nicely and quickly, however it wasn’t a great solution for me. Yes it worked, but it didn’t allow me to change anything else, like the touchpad.
So I wrote my own CLI, based off the above script, that would allow me to tweak everything, so the laptop can be used as it was intended. With a simple command, I could swap the mode of the laptop to match how I was using it.
$ yoga mode tablet # Set to tablet mode $ yoga mode laptop # Reset to laptop mode
After writing this, It ended up finding an accidental usage. The touchscreen started glitching out, causing ghost presses on the screen, making the mouse move all over the screen and switch focus all over the place. Fortunately, I’d already written a command to disable the touch screen and prevent this:
$ yoga disable touch
Whilst I’ve only tested this on my laptop, there’s no reason it shouldn’t work on others too! If it doesn’t, submit an issue!