There are three ways to change a keys function:
- Create a custom keyboard layout and set that as the default.
- Use xmodmap (not a good idea, not really standard).
- Use xorg's xkb settings.
If you're using a non-graphical machine the first option is probably what you'll want to pick, but in the case of a xorg machine option 3 is much simpler and better.
You can set xkb settings either with the command line tool setxkbmap
which
could be placed in your .Xinitrc for user settings or you can set them
systemwide in your xorg config. Most modern distros split the xorg config into
various config files under /etc/X11/xorg.conf.d/
.
Disable CapsLock
To disable the use of the caps lock key you can simply create a file in /etc/X11/xorg.conf.d/ named 90-disable-caps.conf (or similar). Then place the below contents into that file.
Section "InputClass"
Identifier "keyboard defaults"
MatchIsKeyboard "on"
Option "XKbOptions" "caps:none"
EndSection
This matches "keyboards" and sets the option caps:none
A full list of possible options is located inside
/usr/share/X11/xkb/rules/base.lst
. Most of the time you'll want to swap caps
for control or similar instead of outright disabling it. ctrl:nocaps
Would
switch it to caps, but basically that file lists and explains all possible
options.