Or to most anything else really. So this is what I hope will become the first of a series of blogs documenting my adventures getting a regular KDE Plasma (desktop) installation to tango with an x86 touch device – common nowadays in the form of Windows 8 tablets.
On my Machine and OS:
My specific machine is a Lenovo Yoga 11s (Haswell version), so not fully a tablet, but convertible into one by flexing the lower half all the way to the back. I had initially attempted with fair success to set up a Plasma Active-based system (by using experimental OpenSUSE Plasma Active packages), and with the right amount of tinkering that actually worked very well. However I eventually bumped into a few insurmountable hurdles: for example, the inability to set up Chinese and Japanese input since Maliit (the virtual keyboard) was an input method and, to the best of my knowledge, not dynamically switchable with a foreign language input method like ibus. So when inevitable circumstance eventually forced me to set up everything from scratch again, I decided this time to start with a regular KDE Plasma Desktop (on top of OpenSUSE 13.1), and see if I can harness the inherent malleability of Plasma and of Linux itself to achieve an acceptably touch-friendly setup.
Anyway on to the topic at hand. One of the distinguishing features of most x86 tablet computers today is that they, being originally sold as windows machines, sport a physical “windows button” near the screen:
This button on Linux would be bound to “super”, which on most DEs makes it basically useless since “super” by itself doesn’t usually do anything. On the other hand, touch screens on Linux generally simply behave like mice do, where taps are clicks and swipes are click-drags. The right click context menu is invaluable when using a traditional Linux desktop without a keyboard, and yet there is no direct way to right click with a touch screen. So a very useful customization I was able to put on my system is to bind the useless “windows button” to right-click.
This is less trivial than it might initially appear. A major pitfall is that while “super” on Linux by itself generally doesn’t do anything, it is heavily used as a modifier key for many keyboard shortcuts in most setups. So we need to bind “super” to a custom trigger, while at the same time preserving its use as a modifier key so that we don’t affect the keyboard shortcuts. Fortunately, someone has already worked this out for us. KSuperKey was originally written to allow KDE Plasma users to open the Kickoff menu (or the KDE Desktop’s “start menu”) by hitting just the super key a’la windows, but the program is also powerful enough that it could be used to bind the super key to any key combination – while preserving its status as a modifier key.
So as a first step, grab and install KSuperKey, then use it to bind super to a currently unused key-combination. For example, to bind super to Alt + F10, run the following:
ksuperkey -e 'Super_L=Alt_L|F10'
You can add this to a script in ~/.kde4/Autostart/ so that it is run automatically on session startup. Now hitting the windows button should be the same as hitting Alt + F10, so the next step is to map Alt + F10 to right click. But how do we emulate right click in the first place? Turns out it isn’t half hard. Just install xdotool, and create a script called fake-right-click (or anything you want) with the following contents:
xdotool click 3
Give it execute permissions and run it and you should immediately see the right click context menu open next to your mouse pointer! So now all we need to do is bind Alt + F10 to our new script.
You may think this easily achievable using the built in KDE custom shortcuts control module, and indeed this was what I tried first, but it turned out that for some reason or another this wasn’t reliable, and hitting the windows button would sometimes bring up the context menu and sometimes not. A more reliable means by experiment is to use xbindkeys. Using it for our purposes is quite easy: get it installed, then create the file ~/.xbindkeysrc with the following content:
alt + F10
Then simply run xbindkeys. (Again, you can add xbindkeys to a script in ~/.kde4/Autostart/ to have it run on session startup). That’s the last step! Hitting the windows button now should behave exactly like right click, letting you do all kinds of things previously not possible without a keyboard and mouse: