Remap Win, Ctrl and Alt keys on Linux

Additionally to and possibly easier than using xmodmap might be to check in the keyboard layout options given by setxkbmap. These options implement common xmodmap changes, so they might well contain what you want.

For example, I like -option ctrl:nocaps which adds me another control where the caps lock was. Consider the file /usr/share/X11/xkb/rules/base.lst for a list of the standard options.

However, neither xmodmap nor setxkbmap include keyboard settings for the text-only tty terminals (non-X).


xmodmap is the place to start, keeping in mind that X knows nothing about Hyper or Meta, so you have to investigate to see which numbered modifier (mod4, mod5, etc), emacs uses for these modifiers.

Here are a few useful links:

  • XModMap
  • How to separate alt and meta keys in emacs
  • MetaKeyProblems
  • Emacs does not use swapped alt&win after xmodmap runs? (GUI emacs)