6

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

5

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

setxkbmap -option ctrl:ralt_rctrl
2

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 '12 at 9:00
  • Anyway thanks antje-m. I'm going to +1 your answer when I'll get 15+ rep! – mt22 Feb 26 '12 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 '12 at 2:18
  • 1
    xmodmap is ancient and superseeded by xkbd tools. – ManuelSchneid3r Oct 5 '16 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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