Make Caps Lock Control
I have to say that ever since I switched to Emacs, I haven't used the Caps Lock as a normal key. Since Emacs uses Ctrl as a prominent key in their system, I had to made Caps Lock, my Ctrl key. And it's simple to do, but not in every case.
I had problem with my bluetooth keyboard, since when it turns off automatically to save battery, it also resets some of the keyboard settings, i.e. Caps Lock as Ctrl, which resulted that I had to enable it every time, when my keyboard disconnected.
I used setkbmap for months, then I looked around and found a permanent solution to it. I don't know why I haven't started with this originally, but I am glad I found a solution with Xmodmap.
Switch Caps Lock and Ctrl
The file ~/.Xmodmap is in your HOME directory and hidden (that's the dot in front of the file name). You can also use your ~/.config directory for that, like I do in ~/.config/X11/xmodmap.
In any case, fire up your favorite text editor and open or create the file. Then copy and paste the lines below. In this file, you can comment out lines with the exclamation point:
! ! Swap Caps_Lock and Control_L ! remove Lock = Caps_Lock remove Control = Control_L remove Lock = Control_L remove Control = Caps_Lock keysym Control_L = Caps_Lock keysym Caps_Lock = Control_L add Lock = Caps_Lock add Control = Control_L
And disable Caps Lock completely
The solution above swithes the Ctrl key with Caps Lock. If you want to disable Caps Lock altogether, you need to remove the following line:
keysym Control_L = Caps_Lock
Automate
If you are using modern display managers, you don't have to do anything, the system will automically see the ~/.Xmodmap file. If you are using startx via ~/.xinitrc, then you need to add the following line to it:
xmodmap ~/.Xmodmap