Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
Have you seen this answer ? How do I remap certain keys? –  NikTh Oct 30 '12 at 14:35
    
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. –  Huckle Oct 30 '12 at 15:39
    
@NikTh I have seen this answer, however when I change the keyboard layout the changes are vanished (as mentioned in my question). –  pl1nk Oct 30 '12 at 16:23
    
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. –  user76204 Nov 3 '12 at 17:14
    
@Mik - The Xmodmap are being called by a startup script, which is working until changing keyboard layout where Xmodmap settings are being reset. –  pl1nk Nov 4 '12 at 21:47

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
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? –  Sina May 14 at 19:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.