3

I am on archlinux and trying to swap the left Alt key with the left Ctrl key for my convenience in emacs as well as bash command line editing. I use the following ~/.xmodmap:

remove mod1 = Alt_L
remove control = Control_L
keycode 37 = Alt_L
keycode 64 = Control_L
add mod1 = Control_L
add control = Alt_L

For some unclear reason to me, although xev output shows that indeed the two keys are swapped, no application actually uses the new bindings. Can someone enlighten me?

  • 1
    I removed lines 3 and 4 and the problem is solved. All I needed to do is just remove the key from its original modifier and rebind it to the desired one. By swapping the keycodes I effectively rebound the each key to its original modifier. How silly of me! – stk Apr 29 '11 at 21:37
  • @stk, you can mark this question answered, if you post the above comment as answer and mark it as correct. – Mirzhan Irkegulov Oct 26 '11 at 7:47
2

You are switching it twice so it returns to the origin.

Instead you should have changed modifier:

remove mod1 = Alt_L
remove control = Control_L
add mod1 = Control_L
add control = Alt_L

or keycode:

remove mod1 = Alt_L
remove control = Control_L
keycode 37 = Alt_L
keycode 64 = Control_L
add mod1 = Alt_L
add control = Control_L

Check out xmodmap(1) example, they add to the same modifier they removed from:

remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L

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.