I've already checked the option section in /usr/share/X11/xkb/rules/base.lst but I didn't find an entry for AltGr...

2 Answers 2


Thanks to the suggestions of the Xorg community I found out the correct setxkbmap command:

setxkbmap -option ctrl:ralt_rctrl

Surely, you can achieve this by editing the xkb rules set but it might be more convenient to use xmodmap.

You can use xev to lookup the keycode of your AltGr key. On my system it also has the name ISO_Level3_Shift which is already used for the modifier mod5 (use xmodmap to see the modifier maps). Removing it from mod5 and adding it to the control modifier makes the AltGr key work like the Ctrl: xmodmap -e "remove mod5 = ISO_Level3_Shift"; xmodmap -e "c add control = ISO_Level3_Shift".

  • 1
    Thanks for your help. However the reason I asked for setxkbmap is because some xmodmap entries on my /.xsesssionrc seem to be ignored at system startup, and they don't take effect. How can I edit the xkb rules to achieve the same effect? Thanks again.
    – mt22
    Feb 25, 2012 at 9:00
  • Anyway thanks antje-m. I'm going to +1 your answer when I'll get 15+ rep!
    – mt22
    Feb 26, 2012 at 18:08
  • Thank you. You mentioned that some xmodmap in .xsessionrc get ignored. Have you considered that your desktop environment might set some keyboard options that override yours? I know you didn't ask, but the thought just crossed my mind.
    – antje-m
    Feb 29, 2012 at 2:18
  • 1
    xmodmap is ancient and superseeded by xkbd tools. Oct 5, 2016 at 22:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .