Access to German special characters on English keyboards

If you are working with X and an English keyboard you don't need to copy and paste special characters like "ß" into your documents. There is an easy way to type them using a special key combination. In this example we use the pesky "CapsLock" key (and also the "Menu" key alternatively) for creating special characters.
  1. Create a hidden file named .xmodmaprc in your home directory containing the following lines:
    keycode 66 = Mode_switch Multi_key
    keycode 117 = Mode_switch Multi_key
    keycode 39 = s S ssharp
    keycode 38 = a A adiaeresis Adiaeresis
    keycode 30 = u U udiaeresis Udiaeresis
    keycode 32 = o O odiaeresis Odiaeresis
  2. Activate the new key map by executing the command xmodmap ~/.xmodmaprc
  3. Now press [CapsLock] and [a] at the same time to type an "ä" or press [Shift] additionally to create an "Ä". You can use [u], [o] and [s] instead of [a] to type the corresponding special characters.
Feel free to customize the file .xmodmaprc to get access to all kinds of special characters. You can find a lot of key symbols (and a German documentation) at http://www.chemie.fu-berlin.de/chemnet/use/xmodmap.html
If you'd like to use some other keys for creating special characters, the tool xev aids you determining the needed key code. After running xev from a command line window a new window with a quadrat symbol will appear on your desktop. As long as this window is active all keystrokes will be reported in the corresponding command line window. To end this program simply close the window with the quadrat symbol.

To make your modifications permanent you will have to add an entry in a special folder.
  1. Move into the hidden KDE autostart directory by typing cd ~/.kde/Autostart on the command line or enter file:/~/.kde/Autostart in Konqueror's location toolbar.
    Remember that path names are case sensitive and don't miss the dot. smile
  2. Create a new file named xmodmap.sh with your favored text editor and enter the following two lines:
    #!/bin/bash
    [[ -r ~/.xmodmaprc ]] && xmodmap ~/.xmodmaprc
  3. Make the new file executable by typing chmod +x xmodmap.sh or right click the file icon in Konqueror, choose "Properties", click on the tab "Permissions", and check "Is executable".

-- StefanHaller - 16 Jan 2007
Topic revision: r4 - 2007-12-10, ThomasRoth