View RSS Feed

oldcpu's meandering thoughts on Computers, GNU/Linux and openSUSE

Switch between English (US) and Thai Keyboard in LXDE

Rating: 3 votes, 5.00 average.
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
Code:
setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,th
where 'th' at the end of that line is for Thai.

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:

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
With 'pcmanfm' (the LXDE file manager) I also flagged that thaikeyboard.sh file executable.

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

Code:
[Desktop Entry]
Type=Application
Exec=/home/mrscpu/bin/thaikeyboard.sh
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.

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

Submit "Switch between English (US) and Thai Keyboard in LXDE" to Digg Submit "Switch between English (US) and Thai Keyboard in LXDE" to del.icio.us Submit "Switch between English (US) and Thai Keyboard in LXDE" to StumbleUpon Submit "Switch between English (US) and Thai Keyboard in LXDE" to Google Submit "Switch between English (US) and Thai Keyboard in LXDE" to Facebook Submit "Switch between English (US) and Thai Keyboard in LXDE" to Twitter

Categories
Uncategorized

Comments

  1. oldcpu's Avatar
    Our Linux User Group (LUG) laptop is also running Tumbleweed-11.4 with LXDE. While it has English(US) region openSUSE-11.4 (Tumbleweed) LXDE installed, the hardware keyboard on the LUG laptop is in fact a German keyboard, and at times it can be difficult to hunt-and-peck at the keys to find the right one since we have a nominal English(US) key assignment !

    So I used the above techique to install a German keyboard assignment, where of course instead of 'th' for Thai, one uses 'de' for German. And on this laptop I can now switch between English (US) keyboard and German keyboard.

    It worked very well. Most impressive