Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I use an IBM Model M, so I don't actually have Win keys. In Windows, I've had right-alt set to act as the Win key, and I'd like to set that up on Ubuntu as well. I went to the Keyboard Layout Options http://i.imgur.com/KJOUD.png

and found an option for Left Alt is swapped with Left Win, but I didn't see one to do the same for the right.

Swapping the left just doesn't work for me--Alt+Tab is particularly difficult with only Right Alt acting as Alt. Am I just missing something, or is there no way to swap Right Alt and Right Win?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

I've answered the same question here: How do I swap Left Ctrl with Left Alt on my keyboard?

The short answer is to create a file called ~/.Xmodmap

It needs to contain the following xmodmap expressions to change the key mapping and reset the modifier mapping for both keys. The file needs to contain the following:

clear control
clear mod1
keycode 37 = Alt_L Meta_L
keycode 64 = Control_L
add control = Control_L Control_R
add mod1 = Alt_L Meta_L

Next time you login the new key mappings will be active. To have the changes take effect immediately run the following from terminal:

xmodmap ~/.Xmodmap
share|improve this answer
Where do I put the ~/.Xmodmap file? –  Kerrick Feb 7 '12 at 9:14
Whenever you see "~/" that means your home directory, that isn't part of the filename it's just the path where you need to put the file. For example my home directory on my Ubuntu machine is /home/peter but I can also write that as ~/. Your home directory will be different to mine but you can access it the same way. –  cossovich Feb 11 '12 at 1:35
AAAH NOOO! You switched my left alt key and my left control key! I do NOT want that! I want left control to be left control, left alt to be left alt, right control to be right control, and RIGHT ALT to be RIGHT SUPER. –  Kerrick Apr 26 '12 at 21:49
@Kerrick You'll need to find out what the keycodes and keysyms are for the RIGHT ALT and RIGHT SUPER. Firstly you need to remove the ~/.Xmodmap file and restart your computer to remove the modified key bindings. <br><br> Next: can you run "xmodmap -pm" from the command line? Paste the output you get here. Also run "xmodmap -pk" from the command line and paste the output and I'll modify the answer based on your keyboard info. –  cossovich May 29 '12 at 3:04
add comment

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.