NumLock is completely useless, and I want to disable it completely on Linux

30

12

Forget all the rants about Caps Lock, Num Lock is the most useless key of them all. It's never, ever useful. You don't want to use your numpad as an arrowpad, since the arrows are 1cm away from it. Ever.

There was a time when some keyboards had a numpad but no dedicated arrow keys. They don't exist anymore. You can find keyboards with no numpad but with arrow keys, but not the opposite.

Therefore, Num Lock is useless, and it only serves to aggravate me and, I presume, others. Please note that I do not want to know how to turn Num Lock on at startup, I do not want to know how to tear the key off, I want to disable it so that it stays on all the time and can't be turned off by mistake. Any idea how to do that?

Ideally I'd like to be able to reclaim the key for another use, such as a modifier that allows me to type hex on the numpad.

Additionally I'd love to know how to turn off the equally useless mouse emulation triggered by Shift + Num Lock.

niXar

Posted 2009-11-17T13:19:38.127

Reputation: 756

This person begs to differ – flarn2006 – 2016-10-13T22:23:33.740

2There is one case in which laptop manufacturers override regular alpha characters for a number pad but thats a specific usecase. – wag2639 – 2011-04-16T05:12:31.393

And how do you get the nice key cap style in MarkDown? Couldn't find it! – niXar – 2009-11-17T13:23:03.057

It's <kbd></kbd> – John T – 2009-11-17T13:24:16.907

1The <kbd> tag is not a feature of MarkDown! It has been around since HTML 3.2. – eleven81 – 2009-11-17T13:34:58.347

1+1 I admire your passion, it reflects my feelings on CapsLock vs Ctrl. – kmarsh – 2009-11-17T13:57:54.510

low tech solution: lever the key off the keyboard – Rich Seller – 2009-11-17T15:26:43.500

1@rich: I said I didn't want to hear about that, and it doesn't solve the problem, since if for some reason numlock turns off, you can't turn it back on. – niXar – 2009-11-17T17:15:44.903

I'd advise editing out the rant; there are inevitably some uses that your experience doesn't come across, such as uses that Mad Fish pointed out. From the FAQ: Avoid asking questions that are subjective, argumentative, or require extended discussion. This is not a discussion board, this is a place for questions that can be answered! – Kevin M – 2009-11-18T13:48:54.590

@Kevin: and what are those uses? I haven't found one in the last 20 years. – niXar – 2009-12-12T15:19:50.867

Answers

19

Well for your first question, you can remap it to nothing with xmodmap:

xmodmap -e "keycode # = """

where # is the scan code of NumLock. You can find the scan code using xev. Instead of nothing you can remap it to any key you'd like.

John T

Posted 2009-11-17T13:19:38.127

Reputation: 149 037

3Well thank you very much, that answered my question. I did xmodmap -e 'keycode 77 = ISO_Level3_Shift Num_Lock', so that I can turn the thing on if it goes off, and use the key itself as a modifier. – niXar – 2009-11-17T13:48:27.563

Nice idea, well done :) – John T – 2009-11-17T13:49:53.740

3

I noticed this was tagged "Gnome", however for those who ended up here and are using KDE, it is really easy to make the numpad always print numbers.

In System settings > Hardware > Input devices > Keyboard > Advanced

Check "Configure keyboard options" then check "Miscellanous compatibilty options" > "Numeric keypad always enter digits (as in Mac OS)"

Click apply and it works directly.

"Miscellanous compatibilty options" > "Toggle PonterKeys with Shift + NumLock" Will turn on/off mouse emulation by Shift + NumLock, however this is off by default.

JKAbrams

Posted 2009-11-17T13:19:38.127

Reputation: 39

Works for me: on Linux Mint 18.2: Keyboard > Layouts > Options... > "Miscellanous compatibilty options" > "Numeric keypad always enter digits (as in Mac OS)" – Tim Kuipers – 2018-06-08T10:02:52.087

I've noticed that for 25% of all my applications the numeric keys on the keypad behave always as if num lock is off. KDevelop and Cura have their num lock behavior inverted after the above fix. – Tim Kuipers – 2018-06-13T11:49:43.867

2

Well I know for sure that if you run this as root, it will enable Num Lock, and at least on my machine I cannot turn it off,

echo /etc/rc.local >> 'for tty in /dev/tty?; do /usr/bin/setleds -D +num < "$tty"; done'

I am using Arch Linux, so you might want to find the appropriate file for your particular flavour of *nix... but this should enable Num Lock at boot, and leave the actual key open to be remapped. I love the idea of using it as a modifer to type in Hex, I hadn't thought of that.

ring_zero

Posted 2009-11-17T13:19:38.127

Reputation: 21

1

Following John and niXar's answer above, for a standard keyboard, this should be added to your .xprofile or a similar file:

xmodmap -e 'keycode 77 = NoSymbol Num_Lock'

Explanation:

  • xmodmap is a "utility for modifying keymaps and pointer button mappings in Xorg".
  • -e evaluates a xmodmap command.
  • keycode is a command to assign keycodes (physical keys) to keysyms ("encoding of a symbol on the cap of a key", see below.)
  • Keycode 77 is the NumLock key.
  • The first keysym, NoSymbol is the key press output when no modifiers are pressed with this key.
  • The second keysym, Num_Lock is the key press output when the shift modifier is pressed with this key.

Udi

Posted 2009-11-17T13:19:38.127

Reputation: 212

1

For Ubuntu 16.04 - xmodmap is not a permanent solution. Instead, install "Gnome Tweak Tools", navigate to Typing-->Miscellaneous Compatibility Options, and select "Numeric keypad keys always enter digits".

user3294195

Posted 2009-11-17T13:19:38.127

Reputation: 111

Same for Fedora – edmondscommerce – 2018-06-20T10:41:17.173

1

For further reading, check out the loadkeys command, it can alter the keyboard for console logins, too.

NVRAM

Posted 2009-11-17T13:19:38.127

Reputation: 778