How to change decimal comma to decimal period in numpad?

22,982

Solution 1

I think the problem is that you are mixing xmodmap commands with setxkbmap commands (whether on the command-line or by using the graphical settings menus). As you have observed, the setxkbmap commands will override the xmodmap commands when you change your keyboard layout. The logical solution would therefore be to use setxkbmap to change both your layout and the keypad comma to a decimal period.

When you use setxkbmap to change your layout any specified customisations will also be applied: the full list of options is available at /usr/share/X11/xkb/rules/evdev.lst. I don't know which language layouts you use, so I have placed just two examples at the end of the following command, which you can use to switch layouts with ALt+Shift. If you have any more key mappings or bindings you want to activate, simply add them to the command:

setxkbmap -option '' -option kpdl:dot -option grp:switch,grp:alt_shift_toggle gb,nl

The first command switch (-option '') clears any current settings, as when new settings are given they are added to and do not replace any existing ones unless this option is used. The second (-option kpdl:dot) makes sure that the appropriate keypad key is a dot or period; the third command switch (-option grp:switch,grp:alt_shift_toggle) sets up your ability to switch the layouts with ALt+Shift, and the last (gb,nl) specifies the layouts to switch to.

To check your settings, you can enter

setxkbmap -query

which results in:

rules:      evdev
model:      pc105
layout:     gb,nl
options:    kpdl:dot,grp:switch,grp:alt_shift_toggle

Add the full setxkbmap line further above as a startup item to make sure it is activated and available for you to use.

More information on setxkbmap is available by entering man setxkbmap or by viewing the Ubuntu manpages online.

Solution 2

In Ubuntu 14.04 LTS, there are at least two ways to do this. Assumptions:

  1. You want to do this for Unity (graphical environment).
  2. The goal is just to change comma to dot, not to change the whole layout or other options.

Option 1: GUI (dconf-editor)

Run (Alt+F2) "dconf-editor", navigate in the tree to schema "org.gnome.desktop.input-sources" and set the key "xkb-options" to value that you want, e.g. "['kpdl:comma']" or "['kpdl:dot']".

Values are defined in xkeyboard-config help:

man xkeyboard-config

This is what I found there:

Numeric keypad delete key behaviour
   ┌─────────────────────────────────────────────────────────────────┐
   │Option               Description                                 │
   ├─────────────────────────────────────────────────────────────────┤
   │kpdl:dot             Legacy key with dot                         │
   │kpdl:comma           Legacy key with comma                       │
   │kpdl:dotoss          Four-level key with dot                     │
   │kpdl:dotoss_latin9   Four-level key with dot, Latin-9 only       │
   │kpdl:commaoss        Four-level key with comma                   │
   │kpdl:momayyezoss     Four-level key with momayyez                │
   │kpdl:kposs           Four-level key with abstract separators     │
   │kpdl:semi            Semicolon on third level                    │
   └─────────────────────────────────────────────────────────────────┘

Option 2: Command line (gsettings)

You can also use command line instead of dconf-editor GUI to accomplish the same. Like this:

gsettings set org.gnome.desktop.input-sources xkb-options "['kpdl:comma']"
Share:
22,982

Related videos on Youtube

pl1nk
Author by

pl1nk

pl1nk

Updated on September 18, 2022

Comments

  • pl1nk
    pl1nk almost 2 years

    How to change the decimal comma ',' to decimal period '.' in the numeric pad of the keyboard?

    I have used xmodmap but every time that I change my keyboard layout the changes (by xmodmap) are being reset.

    • NickTux
      NickTux over 11 years
      Have you seen this answer ? How do I remap certain keys?
    • Huckle
      Huckle over 11 years
      I imagine that this would be part of the keyboard layout, no? If it is a US-style keyboard you may be able to switch to a European-style where that key would likely be a comma. You'll have to suffer the consequences of having a Pound (curreny) sign instead of a pound (hash) on the Shift-3 however.
    • Admin
      Admin over 11 years
      How are you saving the settings? Putting them in ~/.Xmodmap and then putting xmodmap ~/.Xmodmap in ~/.xinitrc usually works. Alternatively, you could add the command xmodmap ~/.Xmodmap as a startup item.
    • pl1nk
      pl1nk over 11 years
      @Mik - The Xmodmap are being called by a startup script, which is working until changing keyboard layout where Xmodmap settings are being reset.
  • kanu
    kanu about 10 years
    I have the same problem again. However in Ubuntu 14.04 I switch layouts with Super + Space. What kind of command must I use in this case?
  • HelloGoodbye
    HelloGoodbye over 6 years
    I don't have any program called "dconf-editor".
  • okolnost
    okolnost over 6 years
    I am not sure if it is installed by default. It depends on what distribution you have. It should be part of Gnome-based Ubuntu distributions (i.e. not Kubuntu for example). wiki.gnome.org/action/show/Projects/dconf
  • okolnost
    okolnost over 6 years
    If you want to install it, simply run "sudo apt-get install dconf-editor".
  • sdlins
    sdlins about 6 years
    It should be the accepted answer. Worked for me in Ubuntu 18.04 beta (after sudo apt install dconf-editor). Thank you!