On the linux console, the loadkeys program loads a keymap. This program is part of the kbd package, and is usually invoked from an init script. Its input is a readable text file, which you can probably find if you follow the init scripts. You can also dump the keymap in this format with the dumpkeys utility.
On my Gentoo system, the keymaps are in the /usr/share/keymaps, and the default keymap is given in the /etc/rc.conf file. I've set this to my keymap which I've made by changing and existing keymap (this modified keymap predates my Gentoo system though, I have it from the time I've been using SuSE).
Here I include some relevant parts from the keymap file.
# 1=shift 2=altgr (caps really) 4=control 8=alt
keymaps 0, 1, 2, 3, 4, 5, 8, 9, 12, 13
# plain, shift, hu, hu-s, ctrl, c-s, alt, a-s, a-c
# ....
alt_is_meta
charset "iso-8859-2"
# ....
keycode 41 = grave
shift keycode 41 = asciitilde
control keycode 41 = nul
control shift keycode 41 = nul
altgr keycode 41 = +iacute
altgr shift keycode 41 = +Iacute
keycode 2 = one
shift keycode 2 = exclam
# .....
keycode 10 = nine
shift keycode 10 = parenleft
keycode 11 = zero
shift keycode 11 = parenright
altgr keycode 11 = +odiaeresis
altgr shift keycode 11 = +Odiaeresis
keycode 12 = minus
shift keycode 12 = underscore
control keycode 12 = Control_underscore
control shift keycode 12 = Control_underscore
altgr keycode 12 = +udiaeresis
altgr shift keycode 12 = +Udiaeresis
keycode 13 = equal
shift keycode 13 = plus
altgr keycode 13 = +oacute
altgr shift keycode 13 = +Oacute
keycode 14 = Delete
keycode 15 = Tab
shift keycode 15 = Tab
control keycode 15 = Caps_Lock
control shift keycode 15 = Caps_Lock
alt keycode 15 = Tab
alt shift keycode 15 = Tab
alt control keycode 15 = Caps_Lock
keycode 16 = q
# ....
keycode 26 = bracketleft
shift keycode 26 = braceleft
control keycode 26 = Escape
control shift keycode 26 = Escape
altgr keycode 26 = +odoubleacute
altgr shift keycode 26 = +Odoubleacute
keycode 27 = bracketright
shift keycode 27 = braceright
control keycode 27 = Control_bracketright
control shift keycode 27 = Control_bracketright
altgr keycode 27 = +uacute
altgr shift keycode 27 = +Uacute
keycode 28 = Return
alt keycode 28 = Meta_Control_m
keycode 58 = AltGr # <----- this is the key: we bind the caps lock key
+ to the altgr modifier
keycode 30 = a
# ....
keycode 38 = l
keycode 39 = semicolon
shift keycode 39 = colon
altgr keycode 39 = +eacute
altgr shift keycode 39 = +Eacute
keycode 40 = apostrophe
shift keycode 40 = quotedbl
control keycode 40 = Control_g
control shift keycode 40 = Control_g
altgr keycode 40 = +aacute
altgr shift keycode 40 = +Aacute
keycode 43 = backslash
shift keycode 43 = bar
control keycode 43 = Control_backslash
control shift keycode 43 = Control_backslash
altgr keycode 43 = +udoubleacute
altgr shift keycode 43 = +Udoubleacute
# ...
keycode 29 = Control
keycode 56 = Alt
keycode 57 = space
control keycode 57 = nul
control shift keycode 57 = nul
keycode 100 = Alt # right alt is Alt
keycode 97 = Control
# ....
The trickyer part is to get the keys right under X. I didn't do this part all alone, rather, I copied the configuration from a good friend and only done a couple of modifications on it. This configuration program loads a keymap with the xmodmap program (which should be on your system if you have X). I start this configuration program from my .xinitrc file so that it would start on every X session (depending on the X login manager, you may need to use a different file for this).
I show some parts of this configuration too.
HUtilde=doubleacute
HUcircumflex=doubleacute
xmodmap - <<EMAP
! ....
keycode 19 = 0 parenright odiaeresis Odiaeresis
keycode 20 = minus underscore udiaeresis Udiaeresis
keycode 21 = equal plus oacute Oacute
! ....
keycode 34 = bracketleft braceleft o$HUtilde O$HUtilde
keycode 35 = bracketright braceright uacute Uacute
! ....
keycode 47 = semicolon colon eacute Eacute
keycode 48 = apostrophe quotedbl aacute Aacute
keycode 49 = grave asciitilde iacute Iacute
keycode 50 = Shift_L
keycode 51 = backslash bar u$HUcircumflex U$HUcircumflex
! ....
keycode 64 = Alt_L Meta_L
keycode 66 = Mode_switch
! ^ the above is the key line: we bind the caps lock key
! ....
keycode 113 = Alt_L Meta_R
! ...
! I have no idea what these mean:
add shift = Shift_L Shift_R
add control = Control_L Control_R Caps_Lock
add mod1 = Alt_L Meta_L
add mod2 = Mode_switch
add mod2 = Num_Lock
! ...
EMAP
(There are some other tricky details needed to set up X correctly to use national characters, but they aren't quite relevant to the caps-lock hack, so I won't show them here.)
For further information, see the manpages of the above mentioned utilities, and also
http://www.inf.bme.hu/~pts/pts-console-hu-latest.tar.gz;
http://www.madore.org/~david/linux/.
If anyone needs them, I can upload a copy of the exact config files I use.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.