X11: Replacing numeric keypad key comma with more usable dot


The numeric keypad is a big help when typing long numers or entering mathematical formulas. Especially the command line utility ‚bc‘ is much powerful in combination with the keypad.

The problem

Unfortunately there are two worlds, even in mathematics: The dot world and the comma world. In germany, the decimal separator is a comma, so an excerpt of PI would be written as 3,14159265358979323846. In the english world it’s a dot, so PI would read as 3.14159265358979323846.
The dot on the numeric keypad is on german keyboards very often mapped to a comma. This is an annoyance when dealing with english-world tools like ‚bc‘.


There are some solutions to the problem:

  • patch programs to also accept localized decimal separators
  • remap the comma-key to dot on the numeric keypad

The following shows how to remap the comma-key on the numeric keypad on a Debian Etch based system.

Creating a new XKB variant

If you’re using the german keyboard layout, you probably use the nodeadkeys variant so you have a more practical behaviour for certain keys. I’ll show how to modify an existing nodeadkeys mapping that changes the numeric keypad behaviour. First of all, open an editor and edit your keymap file, for germans this is /usr/share/X11/xkb/symbols/de. Copy the nodeadkeys section and give it a new name:

xkb_symbols "nodeadkeys-stfu" {
// modify the basic German layout to not have any dead keys
include "de(basic)"
 name[Group1]="Germany - Eliminate dead keys";
key <TLDE>  { [asciicircum,    degree,      notsign,      notsign ] };
 key <AE12>  { [     acute,      grave,      cedilla,      cedilla ] };
 key <AD11>  { [udiaeresis, Udiaeresis,    diaeresis,    diaeresis ] };
 key <AD12>  { [      plus,   asterisk,   asciitilde,       macron ] };
 key <AC10>  { [odiaeresis, Odiaeresis,  doubleacute,  doubleacute ] };
 key <AC11>  { [adiaeresis, Adiaeresis,  asciicircum,  asciicircum ] };
 key <BKSL>  { [numbersign, apostrophe,        grave,        grave ] };
 key <AB10>  { [     minus, underscore, dead_belowdot,    abovedot ] };

Now comes the interesting part. Just add the line include „keypad(dot)“ before the closing curly brace, and store the file.
You can edit your /etc/X11/xorg.conf file to use this new XKB variant permanently, or you can try your change using the command setxkbmap de nodeadkeys-stfu temporarily.