change CAPSLOCK to Ctrl Archlinux command line

2019-07-01 09:56发布

问题:

I have Tmux setup on my iMac so that CAPS and Ctrl are swapped and C-a is the prefix. On my old laptop I have archlinux without Xwindows and I can't figure out how to remap those keys. On Mac it was straightforward. How do I do it on my barebones linux setup?

回答1:

Create a file ctrl-caps-swap.map:

keymaps 0-127
keycode 29 = Caps_Lock
keycode 58 = Control

And load it under root as loadkeys ./ctrl-caps-swap.map. You can read more about custom key mappings on Arch wiki.