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

as many others I don't need CapsLock. I want to reassign it such that it has the function of AltGr. I use Kubuntu 9.10 but I think there must be a solution which is distribution independent.

I already tried to use setxkbmap or xmodmap. Using xmodmap at least I managed that CapsLock to behaves like Del by following this description.

But I could not achieve assigning the AltGr behavior to CapsLock.

share|improve this question

I know this question is old, but if anyone stumbles across it again, there is an alternative solution:

setxkbmap -option "lv3:caps_switch"

For a full list of options, read the "OPTIONS" section of

man xkeyboard-config
share|improve this answer
up vote 4 down vote accepted

Based on Dennis' answer and by playing around with xev I found out that the magic phrase seems to be ISO_Level3_Shift.

At least this works for me:

xmodmap -e "keycode 66 = ISO_Level3_Shift"

Now I dont' run into danger to break my fingers while typing [, ], {, } and co on my german keyboard layout.

Edit: now using the -e option of xmodmap

share|improve this answer
Thanks! I've been looking for exactly this since moving to Ubuntu from Windows. Without this JavaScript is a pain on a German keyboard. – gzost Feb 12 at 14:17

Try one of these (substitute the keysim or keycode of your caps-lock key if it's different):

xmodmap -e "keysym 0xffe5 = Mode_switch"


xmodmap -e "keycode 66 = Mode_switch"
share|improve this answer
Thanks. Your line did not work directly for two reasons: 1. xmodmap wants a file so I have to pipe the string and read from stdin. 2. Mode_switch was successfully assigned but did not result in the 3rd level modifier. Then I played with xev again. When I realized that the string "Mode_switch" showes up there it was easy to press AltGr and look what one could read instead in the corresponding place. -> ISO_Level3_Shift. – basweber May 7 '10 at 14:38
@basweber: I forgot the -e option. I've edited my answer. – Dennis Williamson May 7 '10 at 15:13
Yes. Thats much cleaner than the piping approach. – basweber May 8 '10 at 20:20

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.