tapinput: Yet another soft keyboard for the freerunner.

15 February 2009, 22:42 UTC

In theory at least, my preferred method for entering text into my Freerunner involves using hand writing recognition. i.e. just draw the letters and other symbols on the front of the display and it will Do-The-Right-Thing. In practice, I need an alternate method, at least some of the time.

I do have some code in http://neil.brown.name/git/scribble which does some recognition. However it is only about 80% accurate (if that) and is a little bit slow (possibly because it is written in python). The low accuracy means that I really need to wait for each character to be recognised before starting the next one. And combining this with the slow matching speed means that I actually enter text quite slowly.

I have hopes for making this better and faster. But even then, I suspect that entering punctuation will be a bit of a challenge, and sometimes I just want something more reliable, if a little more awkward in other ways.

So I have a written a little toy that I call 'tapinput'. Its key characteristics are:

For lowercase input, the window looks like this (I've scale down by a factor of two to partially compensate for that fact that the Freerunner has very small pixels).

Text Entry

To enter the symbol in the middle of a button, you tap that button twice. Thus tapping the middle button twice gets you a space (nice and easy as it should be) and tapping the top left button twice gets you a zero (0).

To get the other black symbols, you tap the button containing the symbol, then the adjacent button on the same side as the symbol. So to get 'e' you tap the middle button then the top-middle button, and to get asterisk, tap bottom right followed by middle.

The red symbols are a little harder as the two buttons that you tap are not adjacent, and it is not easy to explain which is the second button to press. The pattern is fairly simple and in most cases it is easy to get used to. As an example, Return can be entered by tapping top-right followed by bottom-left.

If you tap just one button and wait half a second, the buttons will change to show just one symbol each. Tapping that button will generate that symbol. That way if you cannot figure out how to get a particular red symbol, or for some other reason you only tapped one button, you will quickly find out what to do next.

The one key that you can always enter with only one tap is Backspace. That is the key with the Undo symbol at the very bottom on the right. If you have pressed one button and the tapboard is waiting for the second of a two-tap sequence, then pressing this Undo key will forget that single tap and revert back to waiting for a first tap.

The key in the middle at the very bottom is currently configured as an alternate way to provide arrow keys (alternate to the red options). I don't think I like that and will probably change it, but I'm not sure what to yet... maybe support for Control and Alt. I have that button so that the numeric keypad can generate a zero easily.

The key on the left at the very bottom cycles the mode between 'abc', 'Abc', 'ABC', and '123'. 'ABC' has all the letters as capitals but everything else the same. 'Abc' enters the 'ABC' mode for one symbol, then reverts to 'abc'.

Numbers

The '123' mode looks like this:

As you will see, most keys have only one symbol, so double-tapping seems pointless. With '123' we get a special single-tap mode. A single tap will generate the symbol in the middle of the key. If you tap-and-hold the 0 key, the display will change to

and then you can enter '*' or '#'. This makes entering numbers easy and allows normal touch-tone functionality.

Summoning and dismissing

The tapinput app puts a little keyboard symbol (stolen from mastchbox-keyboard) in the Panel. This can be used to bring the tapboard up at any time. It will always appear centrally on the screen. If that obscures the place where you are entering text, you can easily move the tapboard by dragging it around. Just tap-and-drag.

To dismiss the tapboard from the screen, just drag it more than half-way off the screen. It will then disappear until the next time you call for it.

I really want some way to make it pop-up in number mode (it currently comes back in whatever mode you left it in). And I would like applications to be able to request it. I haven't really given much thought to this yet.

Future Work

Some thoughts I have for the future include:

Implementation

This program is written in python. It uses a library called fakeinput.py which I wrote based heavily on pykey from http://shallowsky.com/blog/tags/crikey/. This library makes it easy to generate X keyboard events and send them to the window which currently has the focus. As such it requires python-xlib, which I don't think it packaged for the OpenEmbedded distributions (that was one of the reasons I moved to Debian).

But if you have python-xlib, you can pick up the other bits you need from by git repo at http://neil.brown.name/git/freerunner or git://neil.brown.name/freerunner .

All my code is released under the GPLv2 - though I need to check if the author of pykey is happy with that.





[æ]