Solution for alt_gr problem
Hi,
i had the same problems and it is really annoing if you can't type a "pipe" or even an "at" symbol in linux.
Solution:
Create a file named .xmodmap in your home directory.
Insert this:
keycode 9 = Escape
keycode 10 = 1 exclam
keycode 11 = 2 quotedbl
keycode 12 = 3 section
keycode 13 = 4 dollar
keycode 14 = 5 percent
keycode 15 = 6 ampersand
keycode 16 = 7 slash braceleft
keycode 17 = 8 parenleft bracketleft
keycode 18 = 9 parenright bracketright
keycode 19 = 0 equal braceright
keycode 20 = ssharp question backslash
keycode 21 = dead_acute dead_grave
keycode 22 = BackSpace
keycode 23 = Tab ISO_Left_Tab
keycode 24 = q Q at
keycode 25 = w W
keycode 26 = e E EuroSign
keycode 27 = r R
keycode 28 = t T
keycode 29 = z Z
keycode 30 = u U
keycode 31 = i I
keycode 32 = o O
keycode 33 = p P
keycode 34 = udiaeresis Udiaeresis
keycode 35 = plus asterisk asciitilde
keycode 36 = Return
keycode 37 = Control_L
keycode 38 = a A
keycode 39 = s S
keycode 40 = d D
keycode 41 = f F
keycode 42 = g G
keycode 43 = h H
keycode 44 = j J
keycode 45 = k K
keycode 46 = l L at
keycode 47 = odiaeresis Odiaeresis braceleft
keycode 48 = adiaeresis Adiaeresis braceright
keycode 49 = dead_circumflex degree
keycode 50 = Shift_L
keycode 51 = numbersign apostrophe
keycode 52 = y Y
keycode 53 = x X
keycode 54 = c C
keycode 55 = v V
keycode 56 = b B
keycode 57 = n N
keycode 58 = m M
keycode 59 = comma semicolon bracketleft
keycode 60 = period colon bracketright
keycode 61 = minus underscore slash
keycode 62 = Shift_R
keycode 63 = KP_Multiply XF86_ClearGrab
keycode 64 = Mode_switch Alt_L Meta_L
keycode 65 = space
keycode 66 = Caps_Lock
keycode 67 = F1 XF86_Switch_VT_1
keycode 68 = F2 XF86_Switch_VT_2
keycode 69 = F3 XF86_Switch_VT_3
keycode 70 = F4 XF86_Switch_VT_4
keycode 71 = F5 XF86_Switch_VT_5
keycode 72 = F6 XF86_Switch_VT_6
keycode 73 = F7 XF86_Switch_VT_7
keycode 74 = F8 XF86_Switch_VT_8
keycode 75 = F9 XF86_Switch_VT_9
keycode 76 = F10 XF86_Switch_VT_10
keycode 77 = Num_Lock Pointer_EnableKeys
keycode 78 = Scroll_Lock
keycode 79 = KP_Home KP_7
keycode 80 = KP_Up KP_8
keycode 81 = KP_Prior KP_9
keycode 82 = KP_Subtract XF86_Prev_VMode
keycode 83 = KP_Left KP_4
keycode 84 = KP_Begin KP_5
keycode 85 = KP_Right KP_6
keycode 86 = KP_Add XF86_Next_VMode
keycode 87 = KP_End KP_1
keycode 88 = KP_Down KP_2
keycode 89 = KP_Next KP_3
keycode 90 = KP_Insert KP_0
keycode 91 = KP_Delete KP_Separator
keycode 92 = Print Sys_Req
keycode 93 = Mode_switch
keycode 94 = less greater bar
keycode 95 = F11 XF86_Switch_VT_11
keycode 96 = F12 XF86_Switch_VT_12
keycode 97 = Home
keycode 98 = Up
keycode 99 = Prior
keycode 100 = Left
keycode 102 = Right
keycode 103 = End
keycode 104 = Down
keycode 105 = Next
keycode 106 = Insert
keycode 107 = Delete
keycode 108 = Delete
keycode 109 = Control_R
keycode 110 = Pause Break
keycode 111 = Print Sys_Req
keycode 112 = KP_Divide XF86_Ungrab
keycode 113 = ISO_Level3_Shift Multi_key
keycode 114 = Pause Break
keycode 116 = Super_R
keycode 117 = Menu
keycode 124 = ISO_Level3_Shift
keycode 125 = NoSymbol Alt_L
keycode 126 = KP_Equal
keycode 127 = NoSymbol Super_L
keycode 128 = NoSymbol Hyper_L
keycode 156 = NoSymbol Meta_L
execute:
xmodmap .xmodmap
in your home directory
That's it... now your alt key is Alt_Gr (keycode 64 = Mode_switch Alt_L Meta_L).
I tested this with the "Apple" key but e.g. if you press APPLE+Q for at, it will be interpreted as normal Mac OS command (close application) so not the perfect way... (keycode 115 = Mode_switch)
keycode 64: alt key
keycode 115: apple key
Normally you dont have to remap all the keys as shown above...
keycode 64 = Mode_switch Alt_L Meta_L
in .xmodmap should work.
To remap the keys automatically on every boot add a line
xmodmap ˜/.xmodmap
to your .bashrc, .profiles or whatever you are using.
FYI: I installed Ubuntu on a Macbook Pro with German keyboard layout.
Best regards
Christian
Source:
http://www.ubuntuforums.org/showthread.php?t=13640
Last edited: Jul 19, 2006