I just installed Arch Linux on my Macbook Air, and I've been using Macs for so long that my PC keyboard muscle memory has all but deteriorated. In Mac when I type "special" chars like $, @ etc. I use the left option (or alt) key to do that. Now in linux (or Windows, for that matter) the right alt key gives me those chars and left alt is just a modifier key. Is there a way to switch those two?

xmodmap -pm 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)
mod1        Alt_L (0x40),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

You can easily completely remap you entire keyboard, including all "special" keys. If your Arch Linux uses Wayland, you need xkb (which requires some reading), if it uses X, play around with xmodmap, and load your layout on session login.

Google a bit, there are plenty of tutorials.

  • Yup, been there, done that. I can only find examples of switching alt & cmd or bunch of others, but for the life of me, just can't seem to figure out how to switch left & right alt. – Tuomo Syvänperä May 2 '18 at 5:25
  • It would help if you could say if which method you are using: xmodmap or xkb. Then I can add details. – dirkt May 2 '18 at 5:49
  • I've tried both, but most recently using xmodmap. I tried switching the definitions for Left Alt & Right Alt like this: keycode 64 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift keycode 108 = Alt_L Meta_L Alt_L Meta_L And I did at some point manage to map right alt as left alt, but couldn't get the special characters to work on the left alt. – Tuomo Syvänperä May 2 '18 at 11:47
  • Please edit question with output of xmodmap -pm, to see if your current setup uses really ISO_Level3_Shift, or Mode_switch, or possibly both. – dirkt May 2 '18 at 13:39
  • Edited the original question and added the outpu – Tuomo Syvänperä May 3 '18 at 16:01

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.