Configuring ThinkPad Yoga 12 with Ubuntu 15.10

UPDATE! Since I wrote this post, I’ve added a number of features to spin.py. Go to my github page for the most up to date version, and detailed instructions on how to use it.

A few months ago I got myself a new laptop, after my 9 year old trusty HP TC4400 was slowly falling apart, with display problems and getting overly hot when doing anything beyond typing working in the terminal. Then again, getting 9 years out of a laptop is pretty good, so I can’t really fault HP.

Picking a laptop for doing art and comics on Linux is a tricky proposition, especially if you want a convertible one with stylus support. Linux has gotten a lot better at supporting all kinds of new hardware, but with a new TabletPC you’re really pushing it. With a touchscreen, stylus, screens that can flip around, accelerometers that detect screen orientation and more to deal with, in addition to WiFi cards and trackpads, things can quickly become problematic.

I wanted a laptop that was powerful and light weight, a typical ultra book, but made for drawing. I considered many options, including the:

  • Dell XPS 13 with my Cintiq 13HD, a great machine with official Linux support, but not very portable when combined with a Cintiq.
  • The Asus ZenBook with intel core m. It’s less powerful, but also less expensive, than the Dell. On the plus side, it has no fans, so can run completely silently, but would require me to lug along the Cintiq.
  • The Cintiq Companion 2, looks like a great machine for drawing, but I needed a machine that was 50% for drawing, and 50% for typing…plus I couldn’t find much info about running Linux on it so was a bit skeptical if I would run into problems I couldn’t solve, and would be stuck with Windows.

Lenovo ThinkPad Yoga 12 (2nd gen)

What I wound up with was the ThinkPad Yoga 12 (2nd gen), with core i7 and 8G of RAM. It ticked most of the boxes, being powerful and light, and with Wacom support. The stylus that comes with it was a bit on the skinny side, so I bought a Wacom Bamboo Feel Carbon pen, which works great. It feels like I’m getting more accurate pressure support with the Bamboo stylus than the original, it seems to register strokes with a lighter touch. Still, neither pen is quite as good as the Cintiq 13HD one. You simply have better control over the pressure with it, especially when using light pressure, plus it has a double side switch.

I got the laptop about a month before Ubuntu 15.10 came out, and quickly found out that it required a newer kernel than the one found in 14.04 and 15.04. Instead of being adventurous and upgrading the kernel, or trying another bleeding edge distro, I decided to wait it out, and just use Windows 10 on it for a while. It also gave me an opportunity to see how the hardware was meant to function.

Installation

A while after Ubuntu 15.10 came out, I found the time to install it on my new laptop. I started by cloning the whole drive to another machine, just in case, and installed Ubuntu alongside Windows. This worked more or less out of the box, all I had to do was go into the BIOS and disable Secure Boot, and then just follow the onscreen instructions during the install. Even resizing the windows partition worked fine (it’s recommended that you defrag and run a file check on Windows before doing this).

What Works

After the installation, I found that a lot of things work out of the box. The stylus, touchscreen and touchpad all worked. In addition, the following special keys, just work:

  • Fn-Esc – Function lock
  • Fn-F1 – Mute sound
  • Fn-F2/3 – Adjust volume
  • Fn-F4 – Mute microphone
  • Fn-F5/F6 – Adjust screen birghtness
  • Fn-F8 – Toggle WiFi on/off
  • Fn-Space – Keyboard light
  • Fn-F12 – Opens the home folder

The following keys did not work out of the box, and I honestly haven’t tried to get them working:

  • Fn-F9 – System settings
  • Fn-F10 – Search
  • Fn-F11 – Swtich desktops (I think)

I haven’t tested Fn-F7, which is presentation mode, as it needs an external display or projector attached.

Battery Life

Out of the box, Ubuntu 15.10 was using up the battery quicker than Windows 10. This, I believe is mostly due to the default kernel settings, and is easy to fix. Just run the following commands:

sudo apt-get install powertop tlp tlp-rdw tp-smapi-* acpi-call-dkms
sudo tlp start

You can also run ‘sudo powertop’ to see what is draining your power. These changes gave me similar battery life to what I was seeing under Windows 10, at around 7.5 hours.

The Touch Screen and the Wacom Stylus

While the touch screen works out of the box, scrolling using touch did not work in Firefox. So I installed Google Chrome instead, which works great. Evince, the PDF viewer, on the other hand, supports both scrolling and pinch to zoom out of the box.

The stylus worked out of the box too, but there are a few issues with it. Firstly, the calibration seems broken. Sometimes it will be unable to finish, and if it does, the calibration gets worse each time you run it. You can run ‘xsetwacom –set “Wacom ISDv4 EC Pen stylus” ResetArea’ to reset the calibration for the current session.

Secondly, there is no palm rejection, so if you rest your hand on the screen while drawing, it will register multiple touches all over the place and mess everything up. Luckily I found wdbm/spin on github, which solved this and other problems, but it didn’t do quite what I wanted. Since it was open-source, I simply forked it and made the changes I needed to get it working the way I wanted. You can find my fork here https://github.com/ragtag/spin

What this gives you is manual toggle between laptop and tablet mode, automatic screen rotation when in tablet mode and screen rotation locking if needed. It also includes palm rejection when using the stylus, and disables the touchpad and nipple, when in tablet mode (I believe the keyboard is disabled in the kernel). See my github page, for instructions on how to set it up and use it.

I really wanted to trigger the switching between laptop and tablet mode by flipping the screen backwards, but have yet to figure out how to get this working properly.Currently I can’t detect any difference between going from tent mode to tablet mode, and going from tent mode to laptop mode, so the solution was to do this manually for now, either using a desktop icon you can add to the Unity launcher, or running spin.py with the –mode option.

I haven’t tested this extensively yet, as I just finished coding it a couple of days ago, but so far it seems to be working fine. The only problem I’ve found, is that I sometimes get a unity-settings error, when screen rotation is changed too rapidly, though this error doesn’t seem to cause any problems. If you do find any problems with it, please let me know.

Look Ma, No Keyboard

With the tablet mode working, you quickly find you miss having a keyboard. You can, of course, connect a wireless or USB keyboard, but for ultimate portability it would be good to do without. I’ve found the Onboard keyboard, that comes with Ubuntu 15.10, to be pretty nice. You can set it to be a full keyboard with function keys, and by checking “Show floating icon when Onboard is hidden” in the Onboard General Preferences, you get a small icon you can place anywhere on the screen, to quickly access the keyboard. With a multi touch screen, you can even type reasonably quickly on it.

On my old laptop, that had a Wacom pen, but no touch screen, so I used CellWriter instead. This is a nice alternative to Onboard, that includes both an on-screen keyboard and hand writing recognition.

Another essential tool, that can replace keyboard shortcuts when drawing, is Easystroke gesture recognition software. It lets you assign different mouse/pen gestures to keyboard shortcuts or commands. You can even assign the same gesture to different things in different software. When using it you simply hold in the side switch on the pen and draw a shape on the screen to trigger a keyboard shortcut, such as drawing an S to save, or a straight line down, to Undo. It’s very snappy, and you’ll find that all you need is just a handful of gestures.

Drawing Software

Since I only got all of this working a few days ago, I really haven’t had the time to do a lot of real work on it yet, but I’ve done some quick tests with the Gimp, Krita and MyPaint. All work nicely with the pen, but none work great with the touch screen yet. Krita has got preliminary support for touch to zoom/pan on Windows only, while with both the Gimp and MyPaint you’ll find yourself finger painting if you try to touch the canvas. Hopefully we’ll see improvements there soon, as moving around the canvas is with no keyboard and thus no modifier keys, can be problematic and more and more devices are getting touch screens.

I worked a bit in Clip Studio Paint under Windows, and it has really great touch support by comparison, with touch to pan, zoom and rotate the canvas, plus a GUI that can optionally be optimized for touch screens, with bigger buttons, special sliders, toolbar with frequently used actions and more.

Conclusion

It’s been an interesting experience to get my ThinkPad Yoga 12 up and running on Linux, and it was honestly a lot more work than I expected, but I’m pretty happy with the result. When I bought it I didn’t think I would use the touchscreen much, I was mostly getting it for the pen support, but now I find myself using the touchscreen all the time, I even reach for the screen on other laptops that do not have a touchscreen. It just feels natural. 🙂

When it comes to drawing it’s very good, just not quite as good as a Cintiq. I recently finished a painting on it done on the go in Krita (under Windows as my Linux setup wasn’t ready), and printed it on canvas at 40x50cm. I did miss my calibrated 30″ screen for previewing it on, but the end result came out just fine. This machine can definitely be used for professional work, especially when on the go, but if you draw full time, you’ll probably want a bigger screen/cintiq at home.

December 25, 2015

24 responses to Configuring ThinkPad Yoga 12 with Ubuntu 15.10

  1. Francesco Paparella said:

    I thank you for making available the ‘spin’ program. I found it very useful on my thinkpad yoga. However, palm detection is still quite flaky, and this makes life very hard when taking notes.

    If touch and pen are two different sensors built into the screen, would it be possible to toggle the touch and leave only the pen on when desired?
    This would make note-taking a lot easier!

    Thanks!

    • Ragnar said:

      I just hadn’t thought of it, but that would definitely be a useful feature when you’re taking notes or drawing, and it should be relatively straight forward to implement. I’ll add it to my todo list, and will hopefully get around to implementing it soon.

  2. Ragnar said:

    I just finished updating spin.py, with an option to toggle the touch screen on and off. See the README at https://github.com/ragtag/spin for details.

    I also added a .desktop launcher for toggling the touch screen, and added it to the right click menu of the one for toggling between laptop and tablet mode.

    I’ve done some quick testing, and it seems to work fine, but let me know if you run into any issues with it.

  3. Francesco Paparella said:

    Hi, sorry for such a late reply. I tried your new version and with the ability to switch off touch completely, note taking is now a breeze! (I’ve also bough at Feel Carbon pen in the meanwhile, which also helps!)

    Thanks!

  4. Yarik said:

    Hallo.
    Thank you for such interesting story…
    I have the same yoga 12 with Ubuntu installed as prymary OS
    Is there some thing new with Ubuntu 16.04?
    I tried to install ubuntu 15.10 but there was some very strange issue. When i opened my laptop i saw my desktop for half a second with all opened windows. And only after this (half a second, maybe less) i saw a blockscreen. It was very strange. The same was in Ubuntu 14,04…

    I cheked all parameters about sleep mode and blocking display. And they all were right.
    I tryed to reinstall system several times and it was the same.

    After i installed 16.04 and it become ok.

    But i have several problems with WiFi now…
    When i boot notebook it is everything fine: i see wifi shortcut in the right coner and a list of visible wifi nets. But when i wakeup the notebook i see not wifi shotcut but two arrows up and down. And i can not see list ow wifi nets. It looks like i have pluged in cabel internet. But in the same time i have internet connection… And it is very strange… But sometimes i do not. And it is very uncomfortable to reboot to resume connection.
    What do you think about this? Did you noticed this problems?

    • Ragnar said:

      16.04 has worked pretty well for me. The only real error I’ve had is with getting an error when I try to access shutdown from the menu. It works if I try again though. I haven’t noticed if the wifi icon changed, but it’s possible.

      Note that spin.py, if you’re using it doesn’t work correctly with suspend yet. I need to try to fix this, but just been busy with other stuff lately.

  5. Brian said:

    Thanks for your work. I have had this laptop for a while now and I have just decided to switch it over to linux. I have been hesitant because I wanted to keep its features. I was thinking of Mint. Is there any reason that your script would not work on it?
    thanks.

    • Ragnar said:

      It uses the pop up notify in Ubuntu, but I don’t think it will fail if it doesn’t find those. I haven’t tested it, but I don’t see any obvious reason it shouldn’t work.

  6. Hany said:

    I followed the instructions to install. Once I ran the process with spin.py –daemon I got the following error:

    Process Process-1:
    Traceback (most recent call last):
    File “/usr/lib/python2.7/multiprocessing/process.py”, line 258, in _bootstrap
    self.run()
    File “/usr/lib/python2.7/multiprocessing/process.py”, line 114, in run
    self._target(*self._args, **self._kwargs)
    File “/usr/bin/spin.py”, line 344, in stylus_proximity
    “grep Proximity | cut -d \” \” -f3 | ” + \
    KeyError: ‘stylus’

    • Ragnar said:

      Do you have xinput installed? And what does the following command return.

      xinput –list

      The code expects to find “Wacom ISDv4 EC Pen stylus”. See line 530 of the code. If you are trying to run it on different hardware, you would get the error you saw. You can always edit that line of the code, with the wacom stylus device that the xinput command returned.

  7. Hassan said:

    I am trying to setup Linux on a Thinkpad Yoga 14.
    I was wondering if you can point me in the right direction as I am unable to find option to disable SecureBoot

    • Ragnar said:

      On my ThinkPad yoga 12 inches you need to press the enter/return key just as you power it on. You should then get the boot menu. Press F1 for the BIOS and using the arrow keys to select the Security tab. You should find Secure Boot options there. It may be different on the 14 inch, but I suspect it’s the same.

  8. Nicola said:

    Hi Ragtag,
    thankyou for making this amazing program.
    I have a Thinkpad yoga 12 S1 and I installed Debian testing.
    I followed your instructions installing first the prerequisites, but when I launch the daemon I receive this message:

    spin.py –daemon
    Process Process-3:
    Traceback (most recent call last):
    File “/usr/lib/python2.7/multiprocessing/process.py”, line 258, in _bootstrap
    self.run()
    File “/usr/lib/python2.7/multiprocessing/process.py”, line 114, in run
    self._target(*self._args, **self._kwargs)
    File “/usr/bin/spin.py”, line 591, in acpi_sensor
    socket_ACPI.connect(“/var/run/acpid.socket”)
    File “/usr/lib/python2.7/socket.py”, line 228, in meth
    return getattr(self._sock,name)(*args)
    error: [Errno 2] No such file or directory
    *** TABLET ***
    sh: 1: notify-send: not found
    sh: 1: notify-send: not found
    *** LAPTOP ***
    Warning! Unable to detect screen orientation.
    sh: 1: notify-send: not found

    In fact when i switch to Tablet mode the screen orientation doesn’t work, on the contrary the toggletouch works perfectly.

    Can you help me?

    Thanks in advance

    Nicola

    • Ragnar said:

      Sorry for the late reply. The notify-send error, is because you’re missing libnotify-bin. I’m not sure if this package is in Debian, but a quick ‘sudo apt-get install libnotify-bin’ in Ubuntu fixes it. What it does is pop up a notification when you change modes, so commenting out all the notify-send lines in the code, won’t break anything important.

      The first error I’m a bit less sure of. It’s looking for /var/run/acpid.socket, but doesn’t find it. If you run ‘ls -l /var/run/acpid.socket’, do you get any result?

      • Nicola said:

        Hi Ragnar, here I am. I’ve installed the libnotify-bin package and the pop up appeared, so this is solved, Thanks.

        For the first error I tried the command in terminal and this is the answer:

        # ls: cannot access ‘/var/run/acpid.socket’: No such file or directory

        The screen rotation doesn’t work.

        Thanks

  9. MaBo said:

    Spin sounds great. I tried it on my Lenovo Helix (1st gen). It all built and installed fine (even though I did not install xserver-xorg-input-wacom as that triggered removal of a lts packages.

    I can start the app, it listens to –mode commands, but it does not read the sensor, and palm rejection is not working either.

    Any clues what might be wrong?

    • Ragnar said:

      I actually almost bought the Helix, before I got the Yoga.

      Try starting the command manually by running going into the folder where spin.py is, and run: ‘./spin.py –daemon –loglevel 2’

      You can use loglevel 1 too, which will output the rotation vector every few seconds. In another terminal, you can try to run ‘./spin.py –mode’ to switch modes. You can also try to bring the pen near the screen. See if you get any errors in the original terminal, and copy-paste the output you’re getting here.

  10. Edward Rusu said:

    Excellent work! I like to take notes in tablet mode, and you have made that possible. One problem I am encountering on my Thinkpad Yoga 12: the rotation doesn’t work. When I enter tablet mode, I rotate my computer, but the screen doesn’t work. I’ve tried toggling rotation lock several times, but no luck. Any thoughts?

    I’ve installed everything according to your instructions here and on github.

  11. JDJ said:

    This is a wonderful post and script – thanks so much for figuring all of this out and sharing it! All works flawlessly on my ThinkPad Yoga 12 (Haswell model, 2014-ish, I think – just picked it up refurbished). I’m running Plasma desktop (Kubuntu 16.10, Plasma 5.7.5) with my main panel on the left (16:9 screen is just too darn thin for a top or bottom panel, IMO). However, upon rotating the screen, now I’ve got a tiny, narrow panel that is completely useless. What I really wanted was for the panel to switch to the top of screen in portrait mode, while returning to the left side in landscape mode. After poking around and testing a bit, I came up with the following, which works really well – I added qdbus commands to the display_orientation() method that handle the panel re-positioning (and you also need to resize it, or it gets really tiny when out of the normally-configured position):

    def display_orientation(self, orientation = None):
    if orientation in [“left”, “right”, “inverted”, “normal”]:
    log.info(“Orienting display to {0}”.format(orientation))
    engage_command(“xrandr -o {0}”.format(orientation))
    // JDJ, 2016-12-18
    if orientation == “normal” or orientation == “inverted”:
    os.system(“qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript ‘panelById(1).location=\”left\”; panelById(1).height=80;'”)
    else:
    os.system(“qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript ‘panelById(1).location=\”top\”; panelById(1).height=80;'”)
    else:
    log.error(“Unknown display orientation \”{0}\” requested”.format(orientation))
    sys.exit()

    There might be similar techniques for use with other desktop environments – I guess I’ll have to find out if/when I switch.

  12. Landon said:

    Wow, thanks for the thorough work you’ve done here. I’m now convinced to set up the dual boot on my Yoga 12, as Windows 10 has become annoyingly slow and temperamental (e.g. trackpad multi-touch quits, 30 sec lag in keyboard input, etc.). Just one question: Has Firefox fixed the touch scrolling issue yet? Thanks again for this guide and spin.py which I will certainly be putting to use 🙂

    • Ragnar said:

      Sorry for the super late reply. I don’t think Firefox has fixed the touch scrolling issue yet, though I’m not sure as I’ve been using Chrome where touch works fine. That said, Windows 10 is relatively easy to re-install from scratch these days if you want to start with a clean slate. Just make sure to backup all your files first. Also, do a BIOS update of your Yoga. There was an older version of the BIOS that didn’t run the fans correctly, making the machine waaay too hot.

  13. viralata said:

    Hi, thanks a lot for Spin.py that I use on my thinkpad yoga S1 happily. Only problem I have with the last version (I used an old one for long) on linuxmint 18: I can start it in a terminal just by typing spin.py, but it wont start if I doubleclick on int and won’t start automaticaly if I add it to the applications at start.

    • Ragnar said:

      Yes, I changed it a bit around, so it needs to be run with the –daemon flag to work. You can get the latest version, and docs here https://github.com/ragtag/spin

      You should still be able to add it to startup applications, typing in the command /path/to/your/spin.py –daemon

Leave a Reply

Your email address will not be published. Required fields are marked *