Activating the .Xmodmap at startup

Some distributions automatically load the ~/.Xmodmap when a user logs on in X - if yours does, consider yourself happy. One of the distris which doesn't do it is Gentoo, while SuSE does.

Here is how you get it loaded automatically: You've got to open

$KDEDIR/share/config/kdm/Xsession

and insert the following code at the beginning of the file (but after the shebang #!/bin/sh):

if [ -f $HOME/.Xmodmap ]; then
    /usr/bin/xmodmap $HOME/.Xmodmap
fi

Now save, logout and log in again. Your modmap should have been loaded now.

Using a global Xmodmap file

Xorg (at least in version 7.0) has an xinit script at /etc/X11/xinit/xinitrc that loads a global Xmodmap file for all users. The default location is /etc/X11/Xmodmap. Since KDE doesn't automatically do this, you should add it: Open the Xsession file (as described above) and add the following line:

[ -f /etc/X11/Xmodmap ] && xmodmap /etc/X11/Xmodmap