At the time of this writing (2009-09-21), X keyboard configuration is moving away from xorg.conf, and is now handled by HAL/DBUS.
Anyway, if you aren't using HAL/DBUS, here is an example of xorg.conf's InputDevice section:
Both Gnome and KDE have GUIs and configurable shortcuts for multiple keyboard layouts.
Anyway, you can set a keyboard layout manually with the setxkbmap command:
setxkbmap -layout us -variant intl # AltGr and Dead keys
setxkbmap -layout us # No international keys
Here is a simple script that toggles between the 'us' and 'us intl' keyboard layouts:
(Note that this script is completely innecessary if you are using a relatively recent version of GNOME or KDE.)
#!/bin/sh# Script to toggle between 'us' (no dead keys) and 'us intl' (dead keys and AltGr+key)
# setxkbmap -print|grep xkb_symbols
# gives either:
# xkb_symbols { include "pc+us(intl)+inet(pc105)" };
#or:
# xkb_symbols { include "pc+us+inet(pc105)" };
setxkbmap -print|grep xkb_symbols | grep intl > /dev/null 2>&1
if [ $? -eq 0 ];then# 'us intl' (dead keys) was set, toggle to 'us' (no dead keys).
setxkbmap -layout us
else# 'us' (no dead keys) was set, toggle to 'us intl' (dead keys).
setxkbmap -layout us -variant intl
fi
Play around with the AltGR key (to the right of the SPACE tab) to find the keys you need to use.
To use the Dead Keys, type for example a " (double quote, displays nothing), followed by an o, which then will display an ö.