Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an annoying UK keyboard which has an Alt Gr key where the right Alt key is on a US keyboard. This is really annoying when using Gnome which makes heavy use of the Alt/Meta key.

Does anyone know how I can map the Alt Gr key to the Alt key?

share|improve this question
up vote 1 down vote accepted


The 'shift, lock, control, modN' on the left are what X sees and cares about. The keysyms on the right map to them. Mode_switch is your AltGr key. Move it to join the others at mod1:

xmodmap -e 'clear mod5'
xmodmap -e 'add mod1 = Mode_switch'
share|improve this answer
No that didn't work for me, fired up emacs and AltGr-v gives me “ instead of scrolling the page up as it would with alt-v. – ChrisInCambo Oct 9 '09 at 4:28
Those specific commands didn't work, or looking at the output of 'xmodmap' and moving the keysym didn't work? You can use 'xev' to help with this: run it, mouse over the window, and press modded keys. – ayrnieu Oct 9 '09 at 5:05
The command worked and here is the output of the xmodmap: shift Shift_L (0x32), Shift_R (0x3e) lock Caps_Lock (0x42) control Control_L (0x25), Control_R (0x69) mod1 Alt_L (0x40), Meta_L (0xcd) mod2 Num_Lock (0x4d) mod3 mod4 Super_L (0xce), Hyper_L (0xcf) mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb) – ChrisInCambo Oct 9 '09 at 5:11
Sorry for the mess, is seems like this site strips line breaks from comments. – ChrisInCambo Oct 9 '09 at 5:11
That output shows that you haven't cleared mod5, and that you haven't added Mode_switch to mod1. xmodmap -e changes like this are temporal: you can blow them away with setxkbmap, for instance. – ayrnieu Oct 9 '09 at 5:17

For those UK users still pulling their hairs out, this worked for me:

xmodmap -e "clear mod5"
xmodmap -e "keycode 108 = Alt_L"

Explanation: The first line removes the current behaviour of your AltGr (which is assigned to the mod5 modifier). The second takes the AltGr key (which on my keyboard produces a keycode of 108), and maps that to whatever keycode your Alt_L key is mapped to.

If you have no idea what is going on with keycodes and keysyms, I found this xmodmap introduction very useful.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.