Switch between English (US) and Thai Keyboard in LXDE
by
, 26-Jun-2011 at 16:23 (5774 Views)
I installed 32-bit openSUSE-11.4 LXDE desktop, with Tumbleweed, on an old laptop computer, that my wife uses a lot. My wife, being a Thai national, wanted to switch between English and Thai keyboards, so I set out to implement this in LXDE.
This is an old laptop (Fujitsu-Siemens Amilo 7400M with an Intel Pentium M 1400 Mhz CPU), too slow for Windows7 and Windows XP is no longer supported. So GNU/Linux is the only remaining Operating System option for continued support. I chose LXDE so as to reduce the load on the laptop.
I installed openSUSE GNU/Linux from the 32-bit openSUSE-11.4 DVD chosing LXDE and the English(US) keyboard. Then after installing some different software packages, it was time to try to sort the keyboard.
YaST
First I went to YaST > Software > Software Management > View > Search and searched for Thai. There were a lot of packages, and I was not clear what to add, so I simply added 'fonts-thai' and 'libthai'.
Second, I went to YaST > System > Language, noting the 'primary language' was set for English(US). I kept that setting. But in the Secondary Language section I scrolled down to Thai and selected that. That immediately caused the installation of a massive number of language packages for different applications. I had a good wireless connection for this, as a good connection is essential here IMHO.
Setup Switching Keyboard in LXDE desktop
After that was complete I then noted this article in an LXDE forum which then gave me guidance what to do next. On the LXDE Panel I righted click on LXPanel->Add/Remove Panel Items->Panel Applets->Add->Keyboard Layout Switcher. Upon a restart of X that gave me a US flag symbol (for US keyboard) in lower right hand corner. No other language selection (yet).
![]()
Then as a test I sent the command
where 'th' at the end of that line is for Thai.Code:setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,th
That worked, and I was immediately able to switch between English(US) and Thai on the keyboard, either by clicking on the flag in the lower right corner, or by pressing <ALT><SHIFT> on the keyboard.
![]()
However that was only temporary, and I wanted this more permanent.
After spinning my wheels a bit looking (and failing) with different options, I elected to seek help on our forum, which I did here in this Forum help thread. And help I did get !
The solution in the end that I adopted was to create a script that was launched everytime my wife logged in to her LXDE desktop, setting up the switchable English(US)/Thai keyboard control. I did that by creating this script which I placed in a new file in my wife's (mrscpu) home directory: /home/mrscpu/bin/thaikeyboard.sh:
With 'pcmanfm' (the LXDE file manager) I also flagged that thaikeyboard.sh file executable.Code:#!/bin/bash # oldcpu hack to provide switch between us and thai keyboard setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,th # end of hacked script
Then to call that script each time my wife ran LXDE, I also created in my wife's (mrscpu) home directory: /home/mrscpu/.config/autostart/thai.desktop with content
Note while the directory /home/mrscpu/.config existed before, I had to create the 'autostart' subdirectory and the new very small file thai.desktop. I also spun my wheels on that 'thai.desktop' file as I had bad syntax, with a dot mistakenly inserted between 'Desktop' and 'Entry', and only after walking away from the project and coming back 15-minutes later was I able to see my syntax foolishness.Code:[Desktop Entry] Type=Application Exec=/home/mrscpu/bin/thaikeyboard.sh
I then restarted the PC, and the switchable English(US)/Thai keyboard worked by default, and no need to send the command each time !
My wife can now switch keyboards by either right clicking on the flag in the lower right corner (and the keyboard toggles between English(US)/Thai) or by pressing <ALT><SHIFT>.
Lessons
I also relearned 3 lessons in doing this:
- surf carefully to look for a solution. Odds are someone else has done something similar before, and
- don't spin one's wheels too long. If stumped, post for help as we have many polite and smart volunteers providing support on openSUSE forums, and
- take a 10 to 15 minute break now and then, and come back with a clear mind. It can help in picking up silly mistakes