How do I remap cap lock to make other keys act different?

Detailed Answer

There are a few steps to doing this:

  1. Use xmodmap to remove the caps lock behavior on the caps lock key. Then use xmodmap to remap keycode 66 (caps lock keycode) to a modifier key you don't use. I chose Hyper_L because it is not on normal keyboards. For example from my ~/.Xmodmap config file (where I remap caps lock to Left Hyper key):
clear lock
keycode 66 = Hyper_L
  1. Step 1 makes arch interpret caps lock as Hyper_L. Modifier keys basically turn on xmodmap mod levels when you press down the key. These mod levels (as opposed to the literal keyboard key) are used by applications to determine which modifiers are being used. Run xmodmap command and the output should look like this. Short answer is to remap Hyper_L to control mod3 because it is unused by default on arch. Do this with these lines in your .xmodmap.
remove mod4 = Hyper_L
add mod3 = Hyper_L

Note: run xmodmap ~/.Xmodmap for changes to take effect without reboot


3. Lastly you can use a program like sxhkd that remaps keystrokes to shell commands to add the functions you would like to specific combinations of your new modifier key. For example in my sxhkdrc I have something similar to:

hyper + {c,e,f,t,6}
    st -e {chromium,neomutt,lf,vit,top} 

I use this to map caps lock to launch new windows of various applications.

TLDR

Install dependencies:

sudo pacman -Sy xorg-xmodmap sxhkd

Configure xmodmap - in ~/.Xmodmap (XDG compliant if $XDG_CONFIG is set):

! remap caps_lock to Hyper_l/mod3
clear lock
keycode 66 = Hyper_L

remove mod4 = Hyper_L
add mod3 = Hyper_L

Run xmodmap ~/.Xmodmap for changes to take effect.
Last, configure sxhkd in ~/.config/sxhkdrc by referring to the github