I use i3wm, and to map cap lock to escape, I run:
setxkbmap -option caps:swapescape
This works fine, but sometimes while hitting the F1 key, my pinky can accidentally hit the Escape key, which turns on CapsLock.
Gnome has a very nice way to do this, where Shift + Escape = CapsLock. Hitting Escape on its own will do nothing.
just curious: why do you like doing it?
I switched because of neovim, and got used to it. I was never the kind of guy to press caps to type capitals, always just kept shift pressed down with my pinky, so i basically never used the caps key anyway