old-www/HOWTO/Danish-HOWTO-2.html

289 lines
11 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>The Linux Danish/International HOWTO: Keyboard setup</TITLE>
<LINK HREF="Danish-HOWTO-3.html" REL=next>
<LINK HREF="Danish-HOWTO-1.html" REL=previous>
<LINK HREF="Danish-HOWTO.html#toc2" REL=contents>
</HEAD>
<BODY>
<A HREF="Danish-HOWTO-3.html">Next</A>
<A HREF="Danish-HOWTO-1.html">Previous</A>
<A HREF="Danish-HOWTO.html#toc2">Contents</A>
<HR>
<H2><A NAME="s2">2. Keyboard setup</A><!--Danish!keyboard configuration--></H2>
<H2><A NAME="loadkbd"></A> <A NAME="ss2.1">2.1 Loading a keytable</A>
<!--Danish!keytable, loading--></H2>
<P>You have two tools for configuring your keyboard. Under plain
Linux you have <CODE>loadkeys</CODE> and under X11 you have <CODE>xmodmap</CODE>.
<P>To try out <CODE>loadkeys</CODE> type one of these two commands:
<PRE>
loadkeys /usr/lib/kbd/keytables/dk.map
</PRE>
or
<PRE>
loadkeys /usr/lib/kbd/keytables/dk-latin1.map
</PRE>
<P>The difference between the two keymaps is that <CODE>dk-latin1.map</CODE>
enables `dead' keys while <CODE>dk.map</CODE> does not. Dead keys are explained
in section
<A HREF="#deadkeys">Dead keys and accented characters</A>. The
program <CODE>loadkeys</CODE> and the keymaps are part of the package
<CODE>kbd-0.??.tar.gz</CODE> which (with differing version numbers ??) is available
with all Linux distributions.
<P>Usually <CODE>loadkeys</CODE> is executed at boot-time from one of the scripts
under the directory <CODE>/etc/rc.d/</CODE>. Details vary between distributions.
<P>(Note for non-Danish readers: Support for other languages is enabled
in a similar manner. Use <CODE>es.map</CODE> for Spanish keyboards etc.)
<P>Versions of XFree86 up to and including v3.1.2 will normally follow the
keymap used by plain Linux, but you can modify keyboard behavior under X11
with <CODE>xmodmap</CODE>. Usually the X11 initialization process will run this
command automatically if you have a file called <CODE>.Xmodmap</CODE> in your
home directory.
<P>In XFree86 v3.2 and higher you should have the following <CODE>Keyboard</CODE>
section in your <CODE>/etc/XF86Config</CODE> (or <CODE>/etc/X11/XF86Config</CODE>) file
(it should be made automatically by the program <CODE>XF86Setup</CODE> if you choose
a Danish keytable):
<PRE>
Section "Keyboard"
Protocol "Standard"
XkbRules "xfree86"
XkbModel "pc101"
XkbLayout "dk"
XkbVariant "nodeadkeys"
EndSection
</PRE>
<P>The only keyboard variant available at the moment is <CODE>"nodeadkeys"</CODE>, but
dead keys can still be made to work. See section
<A HREF="#deadkeys">Dead keys and accented characters</A> for more information on this.
<P>
<H2><A NAME="ss2.2">2.2 Getting the AltGr key to work under X11</A>
<!--Danish!AltGr key--><!--Danish!X!AltGr key--></H2>
<P>For versions of XFree86 up to and including v3.1.2 you should edit the file
<CODE>/etc/XF86Config</CODE> (or <CODE>/etc/X11/XF86Config</CODE>) and make sure the
line
<PRE>
RightAlt ModeShift
</PRE>
appears in the <CODE>Keyboard</CODE> section. Usually you can do this by
uncommenting the appropriate line. In XFree86 v3.1.2 you can use
<CODE>AltGr</CODE> as an alias for <CODE>RightAlt</CODE>.
<P>The <CODE>AltGr</CODE> key should work as expected in XFree86 v3.2 and higher if you
choose Danish keyboard support.
<P>
<H3>Making {, [, ] and } work under Metro-X<!--Danish!X!Metro-X--></H3>
<P>You can't input the characters ``{'' <CODE>(&lt;AltGr&gt;&lt;7&gt;)</CODE>,
``['' <CODE>(&lt;AltGr&gt;&lt;8&gt;)</CODE>, ``]''
<CODE>(&lt;AltGr&gt;&lt;9&gt;)</CODE> and ``}'' <CODE>(&lt;AltGr&gt;&lt;0&gt;)</CODE>
under the Metro-X server. This bug has been observed under versions 3.1.5
and 3.1.8 of the server.
<P>To correct this bug you have to edit the file
<CODE>/usr/X11R6/lib/X11/xkb/symbols/dk</CODE> and change the lines
<PRE>
key &lt;AE07> { [ 7, slash ] };
key &lt;AE08> { [ 8, parenleft ] };
key &lt;AE09> { [ 9, parenright ] };
key &lt;AE10> { [ 0, equal ] };
</PRE>
to
<PRE>
key &lt;AE07> { [ 7, slash ],
[ braceleft, NoSymbol ] };
key &lt;AE08> { [ 8, parenleft ],
[ bracketleft, NoSymbol ] };
key &lt;AE09> { [ 9, parenright ],
[ bracketright, NoSymbol ] };
key &lt;AE10> { [ 0, equal ],
[ braceright, NoSymbol ] };
</PRE>
<P>
<H2><A NAME="deadkeys"></A> <A NAME="ss2.3">2.3 Dead keys and accented characters</A>
<!--Danish!dead keys--></H2>
<P>Dead keys are those that do not type anything until you hit another
key. Tildes and umlauts are like this by default under plain Linux if
you use the <CODE>dk-latin1.map</CODE> keymap. This is the default
behaviour for these keys under Microsoft Windows as well.
<P>
<H3>Removing dead key functionality<!--Danish!dead keys!removing--></H3>
<P>
<UL>
<LI>Removing dead key functionality under plain Linux and XFree86 v3.1.2
Under plain Linux type
<PRE>
loadkeys dk.map
</PRE>
</LI>
<LI>Removing dead key functionality under XFree86 v3.2 and higher
Put the following line in the <CODE>Keyboard</CODE> section of your
<CODE>/etc/XF86Config</CODE> (or <CODE>/etc/X11/XF86Config</CODE>) file:
<PRE>
XkbVariant "nodeadkeys"
</PRE>
</LI>
</UL>
<P>
<H3>Invoking dead key functionality<!--Danish!dead keys!invoking--></H3>
<P>
<UL>
<LI>Invoking dead key functionality under plain Linux
Under plain Linux type
<PRE>
loadkeys dk-latin1.map
</PRE>
</LI>
<LI>Invoking dead key functionality under X11R6 sessions
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 will work in
X11R6 applications unless these are compiled with support for accented
(8-bit) character input. An example of such an application is
<CODE>GNU emacs</CODE> version 19.30 (or higher.)
Some X11 applications still do not support this input method. Eventually
this situation might improve, but until that happens you can either hack your
applications or submit polite bug reports to the program authors. The latter
approach is often the most efficient. See section
<A HREF="Danish-HOWTO-6.html#programming">Programming tips for X11</A> for some advice on what needs to be done.
Next you will have to map a key to <CODE>Multi_key</CODE> (<CODE>Compose</CODE>.) The
<CODE>Scroll Lock</CODE> key is most likely already mapped as such if you use
XFree86 v3.1.2 (you can verify this with the program <CODE>xev</CODE>,) and it is
easy to map the right <CODE>Control</CODE> key by uncommenting the appropriate line
in the <CODE>Keyboard</CODE> section of the XFree86 configuration file (often
<CODE>/etc/XF86Config</CODE> or <CODE>/etc/X11/XF86Config</CODE>.) If you wish to use
some other key, or if you are using XFree86 v3.2 or higher and want to change
the default, you should put something like
<PRE>
keycode 78 = Multi_key
</PRE>
in your <CODE>~/.Xmodmap</CODE> file. The statement in the example defines
<CODE>Scroll Lock</CODE> as the <CODE>Compose</CODE> key. The default <CODE>Compose</CODE> key in
XFree86 v3.2 and higher is <CODE>&lt;Shift&gt;&lt;AltGr&gt;</CODE>.
XFree86 v3.2 and higher comes without support for the dead keys on the standard
Danish keyboard. To get this support you have to change a few lines in the
<CODE>xkb_symbols "basic"</CODE> section of the file
<CODE>/usr/X11R6/lib/X11/xkb/symbols/dk</CODE>. The lines
<PRE>
key &lt;AE12> { [ acute, grave ],
[ bar, dead_ogonek ] };
key &lt;AD12> { [ diaeresis, asciicircum ],
[ asciitilde, dead_macron ] };
</PRE>
should be changed to
<PRE>
key &lt;AE12> { [ dead_acute, dead_grave ],
[ bar, dead_ogonek ] };
key &lt;AD12> { [ dead_diaeresis, dead_circumflex ],
[ dead_tilde, dead_macron ] };
</PRE>
After these changes you can get support for dead keys by removing the line
<PRE>
XkbVariant "nodeadkeys"
</PRE>
from the <CODE>Keyboard</CODE> section of your <CODE>/etc/XF86Config</CODE> (or
<CODE>/etc/X11/XF86Config</CODE>) file.
(Note for non-Danish readers: There are files for many local keyboard maps in
<CODE>/usr/X11R6/lib/X11/xkb/symbols</CODE>.)
The available keystroke combinations are listed in
<CODE>/usr/X11R6/lib/X11/locale/iso8859-1/Compose</CODE>. There are some
bugs in that file you will want to fix:
<UL>
<LI>The line reading
<PRE>
&lt;dead_tilde> &lt;space> : "~" tilde
</PRE>
should be changed to
<PRE>
&lt;dead_tilde> &lt;space> : "~" asciitilde
</PRE>
</LI>
<LI>In several places <CODE>asciicircum</CODE> is misspelled as <CODE>asciicirum</CODE></LI>
</UL>
Finally make sure your shells and/or applications are set up for
ISO-8859-1 compatibility as described in section
<A HREF="Danish-HOWTO-3.html#apps">International character sets in specific applications</A> and you should
be all set.</LI>
</UL>
<P>
<H2><A NAME="ss2.4">2.4 Making $ (the dollar sign), &oslash; (oslash) and &Oslash; (Oslash) work</A>
<!--Danish!setting up $, &oslash;, &Oslash;--></H2>
<H3>$ (the dollar sign)<!--Danish!setting up $--></H3>
<P>There is a bug in the Danish keymaps causing the dollar sign to be accessed
with <CODE>&lt;Shift&gt;&lt;4&gt;</CODE> instead of <CODE>&lt;AltGr&gt;&lt;4&gt;</CODE>
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
<CODE>/etc/rc.d/</CODE> or simply by paying attention to what happens at boot-time.
On my computer the relevant keymap is called
<CODE>/usr/lib/kbd/keytables/dk-latin1.map</CODE>. You can fix the problem by
changing the line
<PRE>
keycode 5 = four dollar dollar
</PRE>
in the keymap file to
<PRE>
keycode 5 = four currency dollar
</PRE>
and then (re-)loading the keytable as described in section
<A HREF="#loadkbd">Loading a keytable</A>. Currency (dansk: ``soltegn'')
is the default <CODE>&lt;Shift&gt;&lt;4&gt;</CODE> character on a Danish keyboard.
<P>This should fix the problem for both X11 and plain Linux.
<P>
<H3>&oslash; (oslash) and &Oslash; (Oslash)<!--Danish!setting up &oslash;, &Oslash;--></H3>
<P>In some older distributions ``&oslash;'' and ``&Oslash;'' appear as cent and
yen. Find the line for keycode 40 in the keymap file and change it from
<PRE>
keycode 40 = cent yen
</PRE>
to
<PRE>
keycode 40 = +oslash +Ooblique
</PRE>
<P>This bug appears to have been fixed in <CODE>kbd-0.88.tar.gz</CODE> and newer versions.
<P>The plus signs are necessary to get <CODE>Caps Lock</CODE> working properly. ``Oslash''
can be used as an alias for ``Ooblique'' in <CODE>kbd-0.90.tar.gz</CODE> and newer
versions.
<P>You can read more about keyboard configuration at
<A HREF="http://www.ibbnet.nl/~anne/keyboard.html">this site</A>.
<P>
<HR>
<A HREF="Danish-HOWTO-3.html">Next</A>
<A HREF="Danish-HOWTO-1.html">Previous</A>
<A HREF="Danish-HOWTO.html#toc2">Contents</A>
</BODY>
</HTML>