Simple on screen keyboard control in Linux

I am attempting to use Linux on keyboard-less tablet, which works nicely until you actually need a keyboard. There are a few on screen keyboards available for Linux, with matchbox-keyboard being small, simple, and fast. The only issue is that there was no easy way to control if you wanted it displayed, and with the Stylistic LT C-500 I am running Linux on being only 800×600 screen space is at a premium. What is nice about matchbox-keyboard is that it support controlling if it is displayed by send ing it X events. The latest SVN version even supports just sending it a single event and it will toggle it’s display, so you don’t have to keep track of it’s state. If you are using the matchbox-panel there is an applet available that will send the appropriate toggle events when you click on it, but I am not using matchbox-panel, instead I am using the GNOME panel. I couldn’t find a panel applet for that, but since I just need to send a toggle event a launcher in the panel would be good enough.

The first step to making this work was to get the SVN version of matchbox-keyboard and compile it. That was straightforward. Next was to make the utility to send the event, again that was very easy and the code is available on the Downloads page. After that I had to define an application launcher in the panel to launch my toggle-utility, again this was simple, just define a launcher that runs matchbox-keyboard-toggler. And the last step was to make sure that matchbox-keyboard was running when the user logs in, this is achieved by putting “matchbox-keyboard -d” as an application to be started in the session. Log back in, and now when you tap the matchbox-keyboard-toggler launcher, the keyboard will pop onto the screen. Tap it again and it goes away. Just what I wanted.

I did run into a small problem which might have been from me installing all sorts of other GTK IM handling stuff. There was a gtk-im handler installed for matchbox-keyboard that tried to be intelligent, displaying the keyboard whenever you clicked in a text entry field. This was extremely annoying to me since the keyboard covers over a quarter of the screen, and whenever i would click on the wrong place on a web page, or click on a terminal it would hide a rather large part of the screen. To get around this I turned off GTK IM completely. This is done by editing /etc/environment and adding this line:

GTK_IM_MODULE="xim"

Now I only get a keyboard when I explicitly ask for it by clicking on my launcher icon. If you want the icon to be a keyboard, open up the launcher definition in ~/.gnome2/panel2.d/default/launchers and edit the Icon lines to use “gnome-dev-keyboard” as their icon. Here is a screen shot showing how my desktop looks now:

Matchbox keyboard toggler

Leave a Reply