I want someone to show me how I can make it possible that when I press say "alt c" that a certain character is displayed. For example.. say I want a french "c" with the tail underneath it to be printed.. I know in my ascii table it is there (like about character 220 or something).. but I want to map it to my keyboard. Anyone know how to do this mapping?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Keymapping of the console is done with loadkeys & friends and keymaps for X are done with xmodmap. I think that if you look at the man pages for loadkeys & xmodmap you'll find out how to map the keys.
ramsayAuthor Commented:
can you help... the documentation isn't good enough. i want an example of how i could setup my keyboard so that when i hold down CTRL and C they print a special character..
ramsayAuthor Commented:
Adjusted points to 400
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

There are a few different ways you can do this (for example in Fvwm you could bind a key to whatever key sequence you like), but this may help you out:

This is a great program that was a livesaver when I needed to map my keyboard to Dvorak.
ramsayAuthor Commented:
ok, i tried that xkeycaps program.
it doesn't seem to work on my machine.. i couldn't map any of the wierd characters (like an 'e' with a hat etc) to any character.

Now, i know the characters are in my ASCII table because i whipped together a quick C program that prints my ascii table out.. But i need a way to map these to my keyboard. xkeycaps didn't work for me.. there must be another way.
I've almost got a useable example ready. Time and being able to put it in an understable form have kept me from posting it to date.
ramsayAuthor Commented:
i've got a standard red hat 5.2 setup here.. it's using whatever default keysettings come as standard for a US keyboard and setup.
Since you have a us map what you really want is dead key composition capability.

There is a way to accomplish this.

First read this discussion about dead keys:

Here is the patch:


If you have any questions about getting the patch to work, I am here to help.
In addition to my above comment:

Actually, it is a library not a patch,

The directions on the web page are pretty straight forward.

Execute nm --dynamic /usr/X11R6/lib/|grep _Xglobal_lock ;
   * If nothing is displayed, fetch libX11-XF3.3.1.tar.gz ;
   * If U _Xglobal_lock is displayed, fetch libX11-XF3.3.1-TS.tar.gz ;
Extract from the archive;
Move it into /usr/X11R6/lib/;
Execute ldconfig;
Inactivate the XKB extension. This is achieved by stating the XkbDisable option in the Keyboard section of your XF86Config file.

The library is actually called, so to make a backup do this:

cd /usr/X11R6/lib/

After adding the XkbDisable option in the Keyboard section of your XF86Config file  (should be in /etc/X11) do the startx thing to enjoy the new changes.
ramsayAuthor Commented:
Gday freesource,

I did as you recommended. Copied over my old library with the new one... made all the necessary changes no probs (very easy to setup).

Now, according to the docs I read all I need to do now his type '~' and then say 'c' and I'll get a c with a squiggly.

2 issues:

1. pressing '~' outputs a tilde :-)
2. if it did work how could I possibly modify or check what keystrokes produce what? For example, what if I wanted an e with double dots over it .. or an e with a \ over it and not a / etc.

I couldn't find enough documentation. I will look into this some more tomorrow. In the meantime I still await a solution to my problem. I'll throw in another 100 points (I got heaps :-)

ramsayAuthor Commented:
Adjusted points to 500
ramsayAuthor Commented:
I still await a solution that I can get working. I trully believe it can't be that difficult! Come on you linux gurus!
Try this, and don't have X up when you do your surgery (copying replacement library to /usr/X11R6/lib).

ldconfig -v | grep libX11

What do you see?

When you make a backup of the old, it would be a better idea to move it to another directory.

So do a

mv /backup/

Now run ldconfig.

It's possible the dependencies just weren't created correctly.  There is also a for redhat 5.0 at this site.  Give that a try, too.

Are you using XFree86 3.3.1?
Another thing ...

XkbDisable is the same thing as using the -kb option from the command line when you start X.
ramsayAuthor Commented:
ok.. i'll get some more info for you now.. what about my "issues" like how to configure etc. (see a few posts back)
Here this should help.  I found a pretty good Xmodmap here:

After you download and unzip it you will see  I found an error on line 126, you can just comment it out with an "!".  Follow the directions on the site which explains where you can put a user defined Xmodmap.  On my computer that is in


The Red Hat version of the library works great, even on XFree 3.3.5.  

The directions explaining how to use the keys in the Xmodmap ( are in French.  I recommend viewing this file with pico, with vi you will see escape codes.  And as you will discover, the same thing applies when you actually use the keys.  This won't work directly from a shell for a variety of reasons, but it does work from applications.  It even works in netscape.  

Basically, as the site explains, you use your right Alt button.  

ñ Ñ was made with Alt-n and Shift-Alt-n
¶ is made with Alt-p
¿ is made by Alt-/
½ ¡ ± ¼ µ
ã is made by Alt-1-a

I am going to work on improving this Xmodmap, but I think you get the picture.


Correction: ã is made by Alt-3-a

ramsayAuthor Commented:
ok freesource, I'll go check that out now. I'll get back to ya soon on my progress.
ramsayAuthor Commented:
ok.. at home, my 5.2 machine would load X after the changes.. here at work I use a 6.0 RH distro.. and after patching the library i get the error:

undefined symbol _xstat

any ideas? I couldn't find any mention of it.. i'm keen to get this dead key solution working.. is there another way besides dead key?
ramsayAuthor Commented:
and what's the reason for it not working in a shell? is there anyway around this? instead of modifying libraries why isn't it possible to say simple map "alt-c" to the cedilla (or whatever u call it) and say alt-1-e to e/ and alt-2-e to e\ etc.

Did you try libX11-XF3.3.1-TS.tar.gz from Thomas Quinot's site.  Also, try the other versions at Thomas Quinot's site:


And follow the directions on the other site, too.

The reason why it doesn't work in a shell from the keyboard is that shells have their own keybindings which include Alt.  The default bindings are very usefull for command line editing.
You could make custom key bindings, but that is another question.

And yes, there certainly is a way to map Alt-c to cedilla.  The Xmodmap above provides this capability, but wasn't mapped properly for my keyboard. I am going to work on changing the Xmodmap to allow that.  Basically, this file has to be customized to a person's preferences, and their own keyboard.
I also wanted to mention something about your previous question where you were asking whether it was really necessary to modify your libraries.

That all depends on what distribution you are using and whether or not they decided to include Thomas Quinot type modifications.  The best way to find out is to run a test.

Just do this:

xmodmap .Xmodmap

If you can do that pico and vi stuff .. great!  Otherwise, do the replacement.

I have discovered that there were some useless keys I overlooked and so cedilla does work:

The left useless key: çÇ

The right useless key: òùèìà

I am sure there are more.

And when in bash in xterm I discovered that by pressing Alt-p you can do this:


ramsayAuthor Commented:
i did xmodmap .Xmodmap
and it ran ok..
then I open up vi
and go into insert modem.. then
i type:

'Alt-c' (that's the right Alt) and
i do *not* get a cedilla
ramsayAuthor Commented:
on bash if i pres "right ALT-p" i get:

WOOT! thats something.. we are nearly there! don't give up on me yet freesource!!
ramsayAuthor Commented:
Adjusted points to 600
ramsayAuthor Commented:
help me to understand my .Xmodmap
i added another 100 points :-)
ramsayAuthor Commented:
Holding down the right alt and pressing all my letters did this:


the .Xmodmap I am using looks like:

keycode 9 =     Escape
keycode 67 =    F1              F11
keycode 68 =    F2              F12
keycode 69 =    F3              F13
keycode 70 =    F4              F14
keycode 71 =    F5              F15
keycode 72 =    F6              F16
keycode 73 =    F7              F17
keycode 74 =    F8              F18
keycode 75 =    F9              F19
keycode 76 =    F10             F20
keycode 95 =    F11
keycode 96 =    F12
keycode 111 =   NoSymbol
keycode 78 =    Mode_switch     XF86ModeLock
keycode 110 =   Pause
keycode 49 =    grave           asciitilde
keycode 10 =    1               exclam          exclamdown
keycode 11 =    2               at              plusminus
keycode 12 =    3               numbersign      dead_tilde
keycode 13 =    4               dollar          cent
keycode 14 =    5               percent         onequarter
keycode 15 =    6               question        mu
keycode 16 =    7               ampersand
keycode 17 =    8               asterisk
keycode 18 =    9               parenleft
keycode 19 =    0               parenright
keycode 20 =    minus           underscore      onehalf
keycode 21 =    equal           plus            threequarters
keycode 22 =    BackSpace
keycode 106 =   Insert
keycode 97 =    Home
keycode 99 =    Prior
keycode 77 =    Num_Lock
keycode 112 =   KP_Divide
keycode 63 =    KP_Multiply
keycode 82 =    KP_Subtract
keycode 23 =    Tab
keycode 24 =    q               Q               q
keycode 25 =    w               W               w
keycode 26 =    e               E               e
keycode 27 =    r               R               r
keycode 28 =    t               T               t
keycode 29 =    y               Y               y
keycode 30 =    u               U               u
keycode 31 =    i               I               i
keycode 32 =    o               O               section
keycode 33 =    p               P               paragraph
keycode 34 =    bracketleft     braceleft
keycode 35 =    braceleft       braceright
keycode 36 =    Return
keycode 107 =   Delete
keycode 103 =   End
keycode 105 =   Next
keycode 79 =    Home            KP_7
keycode 80 =    Up              KP_8
keycode 81 =    Prior           KP_9
keycode 86 =    KP_Add
keycode 66 =    Caps_Lock
keycode 38 =    a               A               a
keycode 39 =    s               S               s
keycode 40 =    d               D               d
keycode 41 =    f               F               f
keycode 42 =    g               G               g
keycode 43 =    h               H               h
keycode 44 =    j               J               j
keycode 45 =    k               K               k
keycode 46 =    l               L               l
keycode 47 =    semicolon       colon           degree
keycode 48 =    apostrophe      quotedbl
keycode 51 =    backslash       bar
keycode 83 =    Left            KP_4
keycode 84 =    dead_acute      KP_5
keycode 85 =    Right           KP_6
keycode 50 =    Shift_L
keycode 94 =    less            greater         bar
keycode 52 =    z               Z               guillemotleft
keycode 53 =    x               X               guillemotright
keycode 54 =    c               C               c
keycode 55 =    v               V               v
keycode 56 =    b               B               b
keycode 57 =    n               N               ntilde Ntilde
keycode 58 =    m               M               m
keycode 59 =    comma           less
keycode 60 =    period          greater
keycode 61 =    slash           question        questiondown
keycode 62 =    Shift_R
keycode 98 =    Up
keycode 87 =    End             KP_1
keycode 88 =    Down            KP_2
keycode 89 =    Next            KP_3
keycode 108 =   KP_Enter
keycode 37 =    Control_L
keycode 115 =   ccedilla        Ccedilla
!bracketleft     bracketright
keycode 64 =    Alt_L           Meta_L
keycode 65 =    space
keycode 113 =   Mode_switch
keycode 116 =   dead_grave      dead_acute
keycode 117 =   dead_circumflex dead_diaeresis
keycode 109 =   Multi_key       Control_R
keycode 100 =   Left
keycode 104 =   Down
keycode 102 =   Right
keycode 90 =    Insert          KP_0
keycode 91 =    Delete          KP_Decimal
clear Shift
clear Lock
clear Control
clear Mod1
clear Mod2
clear Mod3
clear Mod4
clear Mod5

add    Shift   = Shift_L Shift_R
add    Lock    = Caps_Lock
add    Control = Control_L
add    Mod1    = Alt_L
add    Mod2    = Num_Lock
add    Mod3    = Mode_switch Mode_switch
ramsayAuthor Commented:
ok.. now i'm getting somewhere. I press the left useless key and i get "ç"


the right useless key then an e gives me "è" and the other right useless key and an e gives me "ê"


now.. if only i could understand how to configure this mess

can u explain how i can better get this setup..

Great, you have useless keys!  O.k., let's take a look at .Xmodmap.  If you
start at the top and look at your keyboard you will notice that it starts
with the Escape button (Esc).  If you follow each line of the file downwards
you will notice all the keys on the keyboard from left to right down to the next keys underneath, then left to right and so on.

-------------------------------------->    Delete
-------------------------------------->    Insert    
-------------------------------------->      |
-------------------------------------->      |
----------------------- left-down-right----->|

Each line except for the lines at the very bottom start with the word
"keycode."  The keycode can be described in decimal, hex or octal.

keycode 9 =      Escape
keycode 0x09 =  Escape
keycode 011 =      Escape

If you do a dumpkeys you will notice that keycode 1 equals Escape.  Under X
keycode numbers are ofter 8 more than what you would get in a console not
being ran in X.  You can run xev (X) and showkeys (console) to confirm this.

Escape is a keysym.  "man keytables" provides a good description of what a
keysym is:

       Each  of  the keysyms represent keyboard actions, of which
       up to 256 can be bound to a single key. The actions avail-
       able  include outputting Latin1 character codes or charac-
       ter sequences, switching consoles or keymaps, booting  the
       machine etc. (The complete list can be obtained from dump-
       keys(1) by saying  dumpkeys -l .)

Note: According to the Keyboard-and-Console-HOWTO X can only have up to
      4 actions bound to a single key.

You may notice that there are sometimes more than one keysyms present.
For instance:

keycode 57 =       n      N      ntilde      Ntilde

n, N, ntilde, Ntilde each allow a different action.

For instance, just pressing n will output an n, pressing Shift-n will ouput
N, pressing RightAlt-n will output ñ, and Shift-RightAlt-n will output Ñ.

Now suppose we wanted keycode 54 to allow RightAlt to output ccedilla and

Change ..

keycode 54 =      c      C      c
By Adding ..

keycode 54 =       c      C      ccedilla      Ccedilla

Now run "xmodmap .Xmodmap" and Shift-RightAlt-c outputs Ç.

At the very bottom of .Xmodmap you will notice how the modifiers are setup
to allow these actions.

keycode 115 =   ccedilla        Ccedilla  (useless key)
keycode 113 =   Mode_switch                (RightAlt)

Note the two dead keys, if we Shift we get dead_acute and dead_diaeresis.

keycode 116 =   dead_grave      dead_acute   (useless key)
keycode 117 =   dead_circumflex dead_diaeresis  (useless key)
keycode 109 =   Multi_key       Control_R

Clear removes all entries in the modifier map for the given modifier.
For example, ``clear Lock'' will remove all any keys that  were bound to the
shift lock modifier.

clear Shift
clear Lock
clear Control
clear Mod1
clear Mod2
clear Mod3
clear Mod4
clear Mod5

Add sets up the modifier keys the way we want them.

add    Shift   = Shift_L Shift_R
add    Lock    = Caps_Lock
add    Control = Control_L
add    Mod1    = Alt_L
add    Mod2    = Num_Lock
add    Mod3    = Mode_switch Mode_switch (keycode 113 is the Mode_switch ..
the RightALt button, and we can use this in combination with Shift_L/Shift_R
or Caps_Lock.)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Addendum:  showkeys should be showkey.

This is another dead key.  Recall, you can press Alt-3, let go and then enter a or o etc..  The other two useless keys which are dead keys, you can press, let go, and then press the other key you want.  It also works all right to hold them together in order.

keycode 12 =      3      numbersign      dead_tilde


Addendum:  There is yet another dead key on the key pad, number 5.

keycode 0x54 =  dead_acute      KP_5

Addendum: Another thing, if you let go of the dead key and you want the Shift version of the key you have to press the Shift with the key.

deadkey letgo Shift-key

ramsayAuthor Commented:
ok.. I accept your great answer!
ramsayAuthor Commented:
thanx heaps freesource!
i added another 50 points as a final bonus :-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.