Customizing toggling between different languages in Linux
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Customizing toggling between different languages in Linux
I have a Linux system, RH Enterpise 5, that I must toggle between two different languages, one being English, but when I am in English mode I only want to get capital letters for my user programs. I can't use the Caps-lock key, because then the default key to toggle between the languages no longer works when Caps-lock is on and I need to be able to switch back and forth languages with a single key stroke. So, I need capital English letters but mixed case second language characters and a single key to toggle between the two. I can't figure out a solution for this. I have tried different mods to xmodmap, but can't solve it for both languages. Oh, slight correction, the default keys for toggling languages Alt-R and Alt-L are fine, just need upper case in English mode.
Thanks markush, any/all programs like text editors and custom developed applications. Yes, using KDE. I would like it to be like the Caps-lock is on when in English, but when in other language, Caps-lock is not on.
I can't understand how all the keycodes and keysyms relate to the keyboard after the language is switched to something other than English.
Let me try to explain the problem again, in an example maybe. I have the system configured correctly with both character sets, English and Japanese. I have logged into the system in Japanese mode. I can also switch with no problem between typing English and Japanese with the default keys Alt-R switches to J. and Alt-L switches back to English. No problem with this and that is fine. The special thing I need is that when I have switched to English input using the Alt-L key, I only want the keyboard to type Capital letters. No lower case. If I need to type lower-case as in some maintenance commands, I can use the shift key to key lower case, but the default should be upper case. But, if I switch back to Japanese using the Alt-R, I don't want this same thing to happen. I want the standard Japaese characters while in this language.
I have studied and studied and tested the xmodmap, loadkeys, dumpkeys, showkey, and setkeycodes commands. All of these pretty much reference all the same words and terms and explanations. BUT, they don't reference/explain multi-language situations when the input mode is changed to another language and keycode 27, keysym 0x72 (r) is no longer an 'r' but a Japanese character. Even the helpful program 'xev' does not work correctly when the input mode is changed to another language. It captures the Alt-R key and doen't allow the input mode to switch to the other language.
if [ -f /tmp/loadedkeys ]; then
#kbde to disable capslock here
#kbde to enable capslock here
what this script does is
if there is no /var/loadedkeys =>makes your keyboard english and creates a /var/loadedkeys
if there is already a /var/loadedkeys => makes your keyboard japanese and deletes the /var/loadedkeys
/var/loadedkeys file is a random empty file used to make script remember last position. You can set this anywhere with any name.
save the code in an text file named languageswap, than do "chmod +x languageswap". than "./languageswap" to test it, if it work nice set a hotkey for it in KDE -> K Menu -> CONTROL CENTER -> REGIONAL & ACCESSIBILITY -> KEYBOARD SHORTCUTS.
for caps lock you need to emulate capslock signal, you can use "http://kbde.sourceforge.net/", just add the code to send caps signal under the comments at the script. But this seems unnecessary, just pressing capslock once everytime is a better option.
Okay, let's approach this from a different angle. How about figuring out why when I leave the Caps-lock key engaged, my Alt L/R stops functioning to switch my locale between Japanese and English. If I could get this to work then my problem would be solved.
One solution, if I've understood the situation, is to use key strokes that are unaffected by the caps-lock or language: say Alt+1 and Alt+2. That seems so simple, that perhaps I haven't understood the situation?
That is the problem. The alt keys are affected by the caps-locks key. Currently in my system and my previous HPUX systems, the input language is toggled by the the Alt-R and Alt-L keys. But, if the Caps-lock key is engaged, then the Alt R/L keys don't work to toggle between languages.
I solved this. The problem ended up being SCIMs default configuration did not allow the default On/Off keys (ALT-R and ALT-L) to function if Caps-Lock was engaged. A simple manual modification of the SCIM config file added the Modifier CapsLock allowed this to work correctly with the CapsLock engaged. This change can't be made using SCIMs config window.