Keyboard – How to Keep NumLock Always On

keyboardnumlock

I have a standard keyboard with numerical keys on the right side (I guess it's called 104-key keyboard). I want to use the numerical keys only as numerical keys. That means I don't want the NumLock to switch on and off the numerical keys.

However, sometimes it happens (I don't know how, perhaps by me accidentally hitting the NumLock key) that the NumLock is turned off, and I have to press it again. This is extremely annoying.

Is it possible to disable switching off NumLock?

In other words: I want my numerical keys to always act as number keys, and to disable the NumLock switch.

I am using Debian and LXDE (Openbox).

UPDATE:

I have been using now for several years the solution, where I use in Openbox to execute a script when NumLock key is pressed. This script then turns NumLock on again.

<keybind key="Num_Lock">
  <action name="Execute">
    <command>numlock-on.sh</command>
  </action>
</keybind>

apart from being a dirty hack, this does not work reliably. Somehow, still it happens to me that the numlock key gets disabled on my keyboard.

I am frustrated with the idea of a numlock key. The concept of numlock and Caps Lock are pure evil.

Anyway, I tried the second solution, where I put the following into my openbox autostart script:

xmodmap -e 'keycode 77 = Escape'

but this does not work at all.

First, when I log in to openbox, everything works fine, and the numerical keys work as numerical keys.

But when I press numlock, it not only disables the numerical keys, but when I press 7 for example, I get OH, and then the numerical keys serve as arrow keys.

Pressing NumLock key again does not enable numerical keys. I have to log out and log back in again.

So the xmodmap solution did not work as expected.

How can I once and for all disable completely the satanic feature of NumLock key?

Best Answer

I have actually been able to solve this once and for all with another way:

There is a whole thread about this: https://codereview.stackexchange.com/a/147817/104270

But actually it is as easy as calling:

# the program `numlockx`  is from the package `numlockx`
# the program `setxkbmap` is from the package `x11-xkb-utils`

numlockx on
setxkbmap -option numpad:mac

after your GUI login. I myself am using it, and it's working flawlessly.

Related Question