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'm trying to remap my right alt to behave like my right ctrl so I can use my right thumb to press the ctrl button. This is ubuntu 12.04.

I've created the file .Xmodmap in my home folder with the following content:

clear control
clear mod1
!keycode 64 = Alt_L Meta_L
keycode 108 = Alt_R Meta_R
add control = Control_L Control_R Alt_R
add mod1 = Alt_L Meta_L

As you might guess, my left alt key has keycode 64 and my left alt key has keycode 108.

This actually works in the sense that my right alt key behaves as if I press the ctrl key.

However my left alt key now doesn't do anything anymore, which means I don't have an alt key left. This is strange given that xmodmap gives the following output:

xmodmap:  up to 4 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
control     Control_L (0x25),  Control_R (0x69),  Alt_R (0x6c)
mod1        Alt_L (0x40),  Alt_L (0xcc),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3      
mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

The strange thing is that when I remove the Alt_R mapping onto control the alt keys work

(ie., change the second to last line to:)

add control = Control_L Control_R

Now even my right alt behaves as an alt key which confuses me. After removing the Alt_R mapping from the control line the output of xmodmap gives:

xmodmap:  up to 4 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
control     Control_L (0x25),  Control_R (0x69)
mod1        Alt_L (0x40),  Alt_L (0xcc),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3      
mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

Hope you guys can help,

ps. I used this website as a source

share|improve this question

1 Answer 1

up vote 4 down vote accepted

You should be able to simply use Keyboard Layout >> Options >> Ctrl key position >> Right Alt as Right Ctrl, but this doesn't work. This has already been filed against Debian as Bug#663218

1) Start fresh by deleting ~/.Xmodmap.

2) Note that you do not need to clear Control and Mod1. This makes it easier to change only what you want. Your ~/.Xmodmap shoud be:

!Swap right control and right alt
remove Control = Control_R
remove Mod1 = Alt_R
keycode 105 = Alt_R
keycode 108 = Control_R
add Control = Control_R
add Mod1 = Alt_R
share|improve this answer
    
Thank you. This works flawlessly! –  Hoogendijk Apr 12 '13 at 9:39

Your Answer

 
discard

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.