📜 ⬆️ ⬇️

Disable Num Lock on Linux

... or saving laptop owners. :)

It so happened that the Num Lock is located just above the backspace and just to the right of F12. Therefore, when deleting text or using hotkeys, especially in the dark, it is very easy to accidentally turn it on.

And the inclusion leads to the fact that some of the keys of the main keyboard becomes a “digital block”, giving out characters and numbers instead of the expected text. As it turned out, I'm not the only one who suffers with such a problem.
')


First we need to determine which keycode the NumLock key has. To do this, install xev (XEVents) by means of the distribution and run it:

$ xev

After that, press NumLock. In the xev output, we see something like this:

KeyRelease event, serial 34, synthetic NO, window 0x3600001,
root 0x13c, subw 0x0, time 34849337, (167,-26), root:(171,553),
state 0x0, keycode 77 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False


We are only interested in keycode - in my case, this is 77.

To disconnect, we need xmodmap (X-keymap editing utility), install it.

Block NumLock:

$ xmodmap -e "keycode 77 = """

If everything works, it remains only to make the changes permanent. Create a .Xmodmap file in the home directory (~) and type in it:

keycode 77 =

(after = - space without quotes).

And add to the file .xprofile line:

/usr/bin/xmodmap /home/%username%/.Xmodmap

Everything! NumLock problems are gone. Similarly, you can disable any other keys - CapsLock, Power, Sleep ...

Source: https://habr.com/ru/post/78151/


All Articles