LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Reply
  Search this Thread
Old 10-19-2010, 04:27 PM   #1
tullbd
LQ Newbie
 
Registered: Oct 2010
Posts: 6

Rep: Reputation: 0
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.

Last edited by tullbd; 10-19-2010 at 05:02 PM.
 
Old 10-19-2010, 07:12 PM   #2
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Hello tullbd and welcome to LQ,

could you please explain which program(s) you are using and if your are working with X, and if so, which windowmanager are you using?

Markus
 
Old 10-20-2010, 12:29 PM   #3
tullbd
LQ Newbie
 
Registered: Oct 2010
Posts: 6

Original Poster
Rep: Reputation: 0
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.
 
Old 10-20-2010, 01:05 PM   #4
Expeto
Member
 
Registered: Sep 2010
Posts: 30

Rep: Reputation: Disabled
I'm not sure what you want, but few thoughts...

First, you don't need to waste your caps lock for this, you can use something like ctrl-space.

Second if you want your software to change language when you press your language changer button, it will be very hard.



If you just want you keyboard keymap to change, use "loadkeys". Set a script and a lock thingy. In openbox I did something like this with a defined hotkey and a very simple script.

I used something like this;

Code:
if [ -f /tmp/loadedkeys ]; then
  /usr/bin/loadkeys language1.map
rm /var/loadedkeys
else
  /usr/bin/loadkeys language2.map
touch /var/loadedkeys
fi
set this to an hotkey, I bet kde has something to manage hotkeys.

for caps lock, you might do something with xmodmap, but I have no idea how to use xmodmap.

Last edited by Expeto; 10-20-2010 at 01:14 PM.
 
Old 10-20-2010, 01:27 PM   #5
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Hello,

by chance I found this thread: http://www.linuxquestions.org/questi...3/#post4111461
Id seems promising.

Markus
 
Old 10-20-2010, 05:56 PM   #6
tullbd
LQ Newbie
 
Registered: Oct 2010
Posts: 6

Original Poster
Rep: Reputation: 0
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.

Hope this helped.

Last edited by tullbd; 10-20-2010 at 05:59 PM.
 
Old 10-21-2010, 01:47 AM   #7
Expeto
Member
 
Registered: Sep 2010
Posts: 30

Rep: Reputation: Disabled
OK, I slightly edited the script


Code:
if [ -f /tmp/loadedkeys ]; then
  /usr/bin/loadkeys japanese.map
  rm /var/loadedkeys
  #kbde to disable capslock here  
else
  /usr/bin/loadkeys english.map
  touch /var/loadedkeys
  #kbde to enable capslock here
fi
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.

GOOD LUCK
 
Old 10-21-2010, 04:42 PM   #8
tullbd
LQ Newbie
 
Registered: Oct 2010
Posts: 6

Original Poster
Rep: Reputation: 0
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.
 
Old 10-21-2010, 05:09 PM   #9
DavidMcCann
Senior Member
 
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 4,164

Rep: Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223
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?
 
Old 10-21-2010, 05:22 PM   #10
tullbd
LQ Newbie
 
Registered: Oct 2010
Posts: 6

Original Poster
Rep: Reputation: 0
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.
 
Old 10-22-2010, 01:54 AM   #11
Expeto
Member
 
Registered: Sep 2010
Posts: 30

Rep: Reputation: Disabled
if you need a way to know about capslock state ;
http://arniealmighty.wordpress.com/2...l-awesomeness/
 
Old 10-23-2010, 12:09 PM   #12
tullbd
LQ Newbie
 
Registered: Oct 2010
Posts: 6

Original Poster
Rep: Reputation: 0
[Solved]

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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Toggling Network Devices halfpower Slackware 5 08-13-2006 09:30 PM
toggling network interfaces beer.h Slackware 2 06-19-2006 02:30 PM
toggling touchpad BCarey Linux - Laptop and Netbook 5 05-12-2006 01:10 PM
languages of linux: which languages can be choosen in suse and red-hat distributions? Klaus Schnorr Linux - Software 3 09-10-2005 03:19 AM
customizing Linux eshwar_ind Programming 3 02-16-2004 05:35 PM


All times are GMT -5. The time now is 04:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration