You have two tools for configuring your keyboard. Under plain
Linux you have loadkeys
and under X11 you have xmodmap
.
To try out loadkeys
type one of these two commands:
loadkeys /usr/lib/kbd/keytables/dk.map
loadkeys /usr/lib/kbd/keytables/dk-latin1.map
The difference between the two keymaps is that dk-latin1.map
enables `dead' keys while dk.map
doesn't. Dead keys are explained
in section
Dead keys and accented characters. The
program loadkeys
and the keymaps are part of the package
kbd-0.??.tar.gz
which (with differing version numbers ??) is available
with all Linux distributions.
Usually loadkeys
is executed at boot-time from one of the scripts
under the directory /etc/rc.d/
. Details vary between distributions.
(Note for non-Danish readers: Support for other languages is enabled
in a similar manner. Use es.map
for Spanish keyboards etc.)
X11 will normally follow the keymap used by plain Linux, but you can
modify keyboard behavior under X11 with xmodmap
. Usually the X11
initialization process will run this command automatically if you have
a file called .Xmodmap
in your home directory.
For versions of XFree86 up to and including v3.1.2 you should edit the file
/etc/X11/XF86Config
(or possibly /etc/XF86Config
) and make
sure the line
RightAlt ModeShift
appears in the Keyboard
section. Usually you can do this by
uncommenting the appropriate line. In XFree86 v3.1.2 you can use
AltGr
as an alias for RightAlt
.
In XFree86 v3.2 you should have the following Keyboard
section in your
/etc/XF86Config
file (it is made automatically by the program
XF86Setup
if you choose a Danish keytable):
Section "Keyboard"
Protocol "Standard"
XkbRules "xfree86"
XkbModel "pc101"
XkbLayout "dk"
XkbVariant "nodeadkeys"
EndSection
The only available keyboard variant at the moment is ``nodeadkeys'', but the dead keys can still be made to work. See section Dead keys and accented characters for more information on this.
Dead keys are those which don't type anything until you hit another
key. Tildes and umlauts are like this by default under plain Linux if
you use the dk-latin1.map
keymap. This is the default
behaviour for these keys under Microsoft Windows as well.
Under plain Linux type
loadkeys dk.map
Under plain Linux type
loadkeys dk-latin1.map
First you must make sure you are running XFree86 v3.1.2 or
higher. Download and install everything related to the newest release if
you have a lower version number. Neither compose nor dead keys won't work in
X11R6 applications unless these are compiled with support for this input
method. A useful example of such an application is GNU emacs
version
19.30 (or higher).
Next you'll have to map a key to Compose
or (equivalently)
Multi_key
. The Scroll Lock
key is most likely already
mapped as such if you use XFree86 v3.1.2 (you can verify this with the program
xev
), and it is easy to map the right Control
key by uncommenting the
appropriate line in the Keyboard
section of the XFree86 configuration
file (often /etc/X11/XF86Config
). If you wish to use some other key,
or if you are using XFree86 v3.2 and want to change the default, you should
put something like
keycode 78 = Multi_key
in your ~/.Xmodmap
file. The default Compose
key in
XFree86 v3.2 is <Shift><AltGr>
.
XFree86 v3.2 comes without support for the dead keys on the standard Danish
keyboard. You can get this support by adding the following lines to your
~/.Xmodmap
file (or changing the lines if they are already
there):
keycode 21 = dead_acute dead_grave bar
keycode 35 = dead_diaeresis dead_circumflex dead_tilde
Finally make sure your shell and/or application is set up for
ISO-8859-1 compatibility as described in section
International character sets in specific applications and you should
be all set. You can e.g. get ã by typing
<Compose><a><~>
. If dead keys work under
plain Linux they should also work under X11 now.
The available keystroke combinations are compiled in
/usr/X11R6/lib/X11/locale/iso8859-1/Compose
. There are some
bugs in this table you will want to fix:
<dead_tilde> <space> : "~" tilde
should be changed to
<dead_tilde> <space> : "~" asciitilde
asciicircum
is misspelled as asciicirum
Some X applications does not support this general input method. Eventually this situation might improve, but until then you can either hack your applications or submit polite bug reports to their authors. The latter method is often the most efficient. See section Programming tips for X11 for some advice on what needs to be done.
There's a bug in the Danish keymaps causing the dollar sign to be accessed
with <Shift><4>
instead of <AltGr><4>
by default. If this is a problem for you, determine what keymap you load at
boot-time. You can find it by looking around in the directory
/etc/rc.d/
or simply by paying attention to what happens at boot-time.
On my computer the relevant keymap is called
/usr/lib/kbd/keytables/dk-latin1.map
. You can fix the problem by
changing the line
keycode 5 = four dollar dollar
in the keymap file to
keycode 5 = four currency dollar
and then loading the keytable as described in section
Loading a keytable. Currency (Dansk: ``soltegn'')
is the default <Shift><4>
character on a Danish keyboard.
This fixes the problem for both X11 and plain Linux.
On some older distributions ø and Ø appear as cent and yen. Find the line for keycode 40 in the keymap file and change it from
keycode 40 = cent yen
to
keycode 40 = +oslash +Ooblique
Note: This bug appears to have been fixed in kbd-0.88.tar.gz
and newer
versions.
The plus signs are necessary to get Caps Lock
working properly. Oslash
can be used as an alias for Ooblique in kbd-0.90.tar.gz
and newer
versions.