Add a keyboard layout in LXDE

With the latast Ubuntu 11.10 out, I had to go for something that would be less resource hungry than Unity on my laptop. After considering a downgrade to one of the older releases, or switching to Mint or Debian, I chose Lubuntu as it seemed to combine up-to-date Ubuntu software sources that contain all I’m used to having on my laptop, and a more lightweight desktop environment.

I have to say I took to it immediately as there are no lags or glitches that I experienced before. All configuration was easy to find, with the only exception of adding a secondary keyboard layout. I added Keyboard Layout Switcher to the panel and then went to the general Preferences -> Keyboard and Mouse -> Keyboard section. But there was no way to add another layout, I could only go to LXKeymap application from there and change to another layout system-wide, but not to add a secondary layout.

After some time, I found help on this forum:
http://forums.linuxmint.com/viewtopic.php?f=175&t=62681

One has to go to this configuration file:

/etc/xdg/lxsession/LXDE/autostart

and add the following:

@setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,cz

Naturally, you add whatever locales you need instead of us,cz. You can switch between the layouts using Alt + Shift after you’ve logged out and in.

I also prefer qwerty version of the Czech layout so there was one minor thing to change:

@setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,cz_qwerty

Apart from this small drawback, I have to say I’ve become quite partial to LXDE so far.