Sunday, May 21, 2017

Killing the CAPS LOCK key

For some time, I have been interested in disabling the CAPS LOCK key. I frequently press it accidentally and it is a continuing aggravation. The old way of doing it no longer worked. I just set the task aside for later.

This will work. (Skip to the last Update below for a workable solution.)

Find the file in /etc/X11/xorg/conf.d that contains the "InputClass" section. Into that section, add

Option "XkbOptions" "caps:none"
Option "XkbOptions" "shift:both_capslock"

At the command line:

$ setxkbmap -option "caps:none"

$ setxkbmap -option "shift:both_capslock"

But that will not survive a reboot; the file edit above will or you can add it to rc.local.

Update: I have been unsuccessful using this in rc.local, so I created an entry in ~/.config/autostart that had both commands after EXEC= and that failed. It was not until I created two .desktop files, k1 and k2, that executed the commands in the proper order that didn't always work so well.

Update: I have not had a consistent experience using rc.local or the .desktop files in this manner, but since I use the LXDE desktop, I have some better options.

In /etc/lxdm there are several files that provide the opportunity to set options system wide. In the PostLogin file, I added the following two lines:

setxkbmap -option "caps:none"
setxkbmap -option "shift:both_capslock"

Now, capslock is disabled every time I log in. The information was found in the well-maintained ArchLinux Wiki.

SOURCES 
https://www.linux.com/learn/hacking-your-linux-keyboard-xkb

ArchLinux Wiki - LXDE

No comments: