!!!Maintenance in Progress!!!

Remapping keys in X11

March 27, 2005

I have just figured out how to modify the X11 (X Windows) keymap. The configuration of the keys is controlled by a file which is parsed by a program called xmodmap. The file that specifies the key mappings is best edited with a graphical tool called xkeycaps. This tool has a button labelled “Write”, which saves the mappings to a file whose filename is appended with the hostname of your computer, e.g. it might be called “~/.Xmodmap-deathstar”, where “deathstar” is the hostname. What you then need to do is to make sure this file is parsed by xmodmap each time you login to your computer. You do this by putting a line in your login script that runs xmodmap. On SuSE Linux, this file is called .profile (in your home directory). xkeycaps will tell you what to put in the login script, but it will be something like “xmodmap ~/.Xmodmap-`uname -n`”, which works out what your hostname is (rather than you having to hard code it).

Below is a description of what I have remapped—so that when I screw up and need to re-do the above I can “remember” what my new keyboard looks like—you might also find inspiration for your own mapping (note: I am in the UK and we have slightly different keyboard layouts to those in the US and elsewhere):

I wonder how many bugs I will introduce as a result of these changes :-}