Ubuntu – Disable number keys on top-row of keyboard

keyboardkeys

I want to disable the number-part of the keys on the top-row of my keyboard. I only use the numberpad to the right of my keyboard to enter numbers. I get VERY frustrated when i want to type a symbol which appears on the top-row (e.g. 4 and $) and get "4" instead of "$". The proper answer is to take typing lessons but I'm too old to do that and totally refuse to do so. There must be a way that I can restrict my top-row to be symbols only? Answers/tips please?

Best Answer

You can easily change the keyboard mapping on X Windows based systems with xmodmap. Install the xmodmap package

sudo apt-get install xmodmap

Look at the keyboard mapping for the keys of interest (pretty near the beginning for your keys0

xmodmap -pke

Cut/paste the keys of interest into a file, called top-row-reset, (here's what mine look like):

keycode  10 = 1 exclam 1 exclam
keycode  11 = 2 at 2 at
keycode  12 = 3 numbersign 3 numbersign
keycode  13 = 4 dollar 4 dollar
keycode  14 = 5 percent 5 percent
keycode  15 = 6 asciicircum 6 asciicircum
keycode  16 = 7 ampersand 7 ampersand
keycode  17 = 8 asterisk 8 asterisk
keycode  18 = 9 parenleft 9 parenleft
keycode  19 = 0 parenright 0 parenright

This file may be used to reset any changes back to the default. Copy this file, and change the part to the right of the = sign to be what you want, either all your symbols or maybe reverse them e.g.:

keycode  10 = exclam exclam exclam exclam
keycode  11 = at at at at
keycode  12 = numbersign numbersign numbersign numbersign
keycode  13 = dollar dollar dollar dollar
keycode  14 = percent percent percent percent
keycode  15 = asciicircum asciicircum asciicircum asciicircum
keycode  16 = ampersand ampersand ampersand ampersand
keycode  17 = asterisk asterisk asterisk asterisk
keycode  18 = parenleft parenleft parenleft parenleft
keycode  19 = parenright parenright parenright parenright

or to reverse the shift make a file named mod-top-row

keycode  10 = exclam 1
keycode  11 = at 2
keycode  12 = numbersign 3
keycode  13 = dollar 4
keycode  14 = percent 5
keycode  15 = asciicircum 6
keycode  16 = ampersand 7
keycode  17 = asterisk 8
keycode  18 = parenleft 9
keycode  19 = parenright 0

Run these files with the command xmodmap mod-top-row

Related Question