This site is now 100% read-only, and retired.

Latinamerican Keyboard Layout Setup - The Right-Alt key affair.

Posted by gmedina on Sat 12 Nov 2005 at 21:03

If you are like me and have a Spanish Latinamerican keyboard, but it refuses to work the right way with the Right Alt Key, this will help.

  1. First use setxkbmap to select the correct layout: "setxkbmap la"
  2. First use xev to find out the code for the Right Alt key (just press the right Alt key) and see where it says "(keysym blah blah)", it might say either Alt_R or ISO_Level3_Shift, whatever it is, take note of it.
  3. Save the following script in your ~/.kde/Autostart folder, you can use whatever name you want for this file, I use spkeyboard.sh. Remember to make it executable with "chmod 755 spkeyboard.sh".

(If you're using a different window manager you might find some tips in the making scripts run at X11 login time article.)

#!/bin/bash
xmodmap -e "clear mod1"
xmodmap -e "keysym ISO_Level3_Shift = Mode_switch"
xmodmap -e "add mod1 = Alt_L"
xmodmap -e "clear mod3"
xmodmap -e "add mod3 = Mode_switch"
xmodmap -e "keycode 11 = 2 quotedbl at"
xmodmap -e "keycode 12 = 3 periodcentered numbersign"
xmodmap -e "keycode 48 = dead_acute dead_diaeresis braceleft"
xmodmap -e "keycode 51 = ccedilla Ccedilla braceright"
xmodmap -e "keycode 34 = dead_grave dead_circumflex bracketleft"
xmodmap -e "keycode 35 = plus asterisk bracketright"
xmodmap -e "keycode 49 = masculine ordfeminine backslash"
xmodmap -e "keycode 10 = 1 exclam bar"
xmodmap -e "keycode 26 = e E EuroSign"
xmodmap -e "keycode 15 = 6 ampersand asciitilde"

Once you've logged out and back in again to start the script things should be working properly.

To setup additional keys, just add a new line to the script, the format of the xmodmap lines is:

xmodmap -e "keycode [the keynumber from xev] = [key character] [shifted key character] [alt-righted character]"

That is, the line:

xmodmap -e "keycode 11 = 2 quotedbl at"

means setup the key with code '11' (the number 2 key) to deliver a number 2 when pressed alone, a double quote (") when pressed along with the Shift key, and the at symbol (@) when pressed along with the right Alt key.

As you see some characters have some kind of tags (constants) that must be used to represent the character (quotedbl, ampersand, ordfeminine, etc.), you can find this definitions on this page (among may others): http://www.ibiblio.org/pub/linux/X11/i18n/Xmodmap.fr

If you have any questions or concerns, please don't send them to me, as I'm a linux newbie myself, but given the fact that I googled and googled and just found bits and pieces of info here and there, I thought it would be a good idea to start contributing with as little or as much as I can!

I encountered this little problem, solved it, and well, here is how I solved it, hope it helps someone. If there are any linux gurus out there who think this note is incorrect or not general enough please let us know, We the people who use spanish/latinamerican keyboards will thank you.

Thanks
Gabriel Medina.
http://www.rha7.com/

 

 


Re: Latinamerican Keyboard Layout Setup - The Right-Alt key affair.
Posted by Anonymous (85.99.xx.xx) on Sun 13 Nov 2005 at 07:25
AFAIK using Xmodmap to modify keyboard layot is deprecated with XFree86 4.x releases. The right way for modifiying the keyboard layouts is modifiying them via xkb. So I think it will be better to edit /etc/X11/xkb/symbols/pc/la instead of executing a script at every login.

[ Parent ]

Re: Latinamerican Keyboard Layout Setup - The Right-Alt key affair.
Posted by lpenz (200.102.xx.xx) on Wed 16 Nov 2005 at 12:58
But isn't it gone if they upgrade the package? Had this problem a while ago.

[ Parent ]

Re: Latinamerican Keyboard Layout Setup - The Right-Alt key affair.
Posted by Anonymous (201.132.xx.xx) on Wed 6 Aug 2008 at 18:47
Nice !!

Thanks a lot Gabriel.

David.
http://www.estrategiasweb.com.mx

[ Parent ]