Thursday, May 3, 2012

Touché: special key recognizer for Linux Desktops

a.k.a. Make your extra keyboard keys "just work".
read me first: apparently planet kde linked only this post from backlog instead of newer ones.
You can see more updates about Touché (including first two "stable" releases) here:

I always loved having some spare extra keys in my input devices.

Contrary to Apple's philosophy, which every year tries to remove some keyboard or mouse button here and there, just because "user might be scared! too much stuff to handle!", i find quite more simple to just press the "Play" button on my keyboard to start my audio player, or "Next" to skip to the following song, or "ZoomIn" to enlarge browser fonts, and so on.

It's also quite more productive, in my point of view: for instance i use a lot virtual desktops, therefore i can "switch context" just by switching desktop (for instance, desktop 1: internet; desktop 2: console apps; desktop 3: instant messaging; desktop 4: application development). And what's faster? Typing "CTRL+Shift+F2" (if you can remember it!) to switch to desktop 2, or just having a mouse with an extra button, binded to the (in my opinion, beautiful) desktop grid effect?
One button click, and you're directly here:

I can even remember that when i used to play Quake 3 Arena, my mouse with two extra lateral buttons gave me a fair advantage on my enemies, allowing me to fast-switch to the "most useful" weapons.

Therefore, as you might imagine, i always try to buy keyboards (and mices) with lots of extra keys. But as some of you might have experienced, not all of them do work.

My last purchase is a Microsoft Wireless Keyboard 3000: not so bad, it has lots of extra keys, the bundled mouse has 4 extra buttons (other than the standard 3 ones and the wheel), and most of the extra keys do work out of the box.

But "most of them" is not enough.

I never could get to work the "Flip Window" key  (bottom-right), nor the "12345*" keys, next to the standard multimedia keys. I barely could have the "ZoomIn-ZoomOut" keys (left), because i noticed that they were captured as joypad events (joypad? Wtf?)

So, after some research i noticed that all these keys do generate an event, in the special device "hiddev0".
And i wrote an application to read them: Touché.

It's still in heavy development, it lacks a configuration utility, and currently it supports only my keyboard model, but it's probably easly configurable to support other keyboards, if they do generate events in hiddev too.
And beside what's missing, it's already fully functional: it can both translate your special key to a Xorg recognized key, or run a custom command.

If you want your keyboard supported, you can inspect the application output (with the command line argument "--dump-events"), and contact me to get support.

Build instruction included in the README file.
Feedback is welcome :)


  1. I have exactly the same set for exactly one year now (so I can tell a bit how often it needs battery replacements etc.). ;-)
    I'll need to take a look at that application when I'll have some free time.

  2. Unfortunately two crucial features to me are either not properly supported by KDE, or not supported by Qt:
    Shift+Media Play to stop a song says "This key is not recognized by Qt" and the Calculator key which is present on many Microsoft keyboards which I’d like as dashboard buttons (those little sqaures representing calculator buttons look like widgets to me :P) is recognized as "Start (1)" and is also not working.

  3. Actually the good thing about Touché is that you can map each key to a different key symbol (maybe one recognized by KDE).
    Also, you can skip entirely keys remapping, and map them directly to a program.
    For instance, you can map the calculator key to
    qdbus org.kde.plasma-desktop /App toggleDashboard

  4. Hello, i have another type of problem. I have a USB remote control, that is detected by the computer as a second keyboard. Each keypress on the remote control is reconized by the computer as if i pressed a key on the keyboard.
    I needed to differentiate between remote-control and keyboard and map some of the remote-control keys to other keyboard shortcuts.

    I used evrouter for this problem and it woked nicely. The author also tries to work on evrouter2, but it seems dead atm... Maybe you could try to improve an already working solution instead of duplicating efforts, or you may "burrow" from his ideeas for v2.

  5. Hi
    Can you tell me which device gets the remote keypresses?
    candidates are /dev/usb/hiddev0 and /dev/hidraw*
    Anyway, while adding your remote control support might be easy, I guess the big problem will be to stop keys as being recognized as "keyboard keys",



    evrouter2 was supposed to support event "supressing", you should really exchange opinions with the author on the "how and why's"


Note: Only a member of this blog may post a comment.