I would like to use the key AltGr as my main Alt key. Unfortunately, the AltGr doesn't behave like the left Alt key with the software I use, e.g. urxvt.

With the command xev the left Alt key has the keycode 64, and the AltGr has the keycode 108.

$ xmodmap -pke gives me the following result for the left Alt key and the right AltGr keys:

keycode  64 = Alt_L Meta_L Alt_L Meta_L
keycode 108 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift

To be brief, I would like to swap the left Alt key, with the AltGr key.

I'm using 14.04 server.

1 Answer 1


Found the solution by myself :-)

$ xmodmap .Xmodmap

The .Xmodmap file should contain the following:

! Swap Mod1 and Mod5
remove Mod1 = Alt_L Meta_L Alt_L Meta_L
remove Mod5 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
keysym Alt_L Meta_L Alt_L Meta_L = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
keysym ISO_Level3_Shift NoSymbol ISO_Level3_Shift = Alt_L Meta_L Alt_L Meta_L
add Mod1 = Alt_L Meta_L
add Mod5 = ISO_Level3_Shif

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.