Switching keyboard keys for better ergonomics
Swapping caps and escape
I'm using vim-style keybindings, so swapping escape and caps is a no-brainer for me.
setxkbmap -option caps:swapescape
Swapping right-windows (rwin) and right-ctrl (rctl)
I recently started using the right ctrl key a lot more, but it's too long to reach for the right-ctrl key on my keyboard, so I've swapped it with the rwin key:
setkbmap -option ctrl:swap_rwin_rctl
Permanent settings in nixos
services.xserver.xkb.options = "grp:win_space_toggle,caps:swapescape,ctrl:swap_rwin_rctl";