man xmodmap shows how to swap the left control key and the CapsLock key:
! ! Swap Caps_Lock and Control_L ! remove Lock = Caps_Lock remove Control = Control_L keysym Control_L = Caps_Lock keysym Caps_Lock = Control_L add Lock = Caps_Lock add Control = Control_L
Essas keysym
linhas são importantes, pois são elas que estão mapeando os códigos de tecla para as teclas opostas, ou seja, o código para Capslock vai para Control L e vice versa.
trecho da página do manual do xmodmap *
keysym KEYSYMNAME = KEYSYMNAME ...
The KEYSYMNAME on the left hand side is translated into matching
keycodes used to perform the corresponding set of keycode
expressions. Note that if the same keysym is bound to multiple
keys, the expression is executed for each matching keycode.
Vendo o efeito
Você pode usar a ferramenta xev
para ver que as chaves foram literalmente remapeadas. Então Capslock agora envia o scancode para Control L .
Exemplo
Pressionar Capslock envia Controle L .
$ xev
KeyPress event, serial 36, synthetic NO, window 0x3e00001,
root 0x86, subw 0x0, time 890946390, (803,237), root:(804,294),
state 0x2, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x3e00001,
root 0x86, subw 0x0, time 890946462, (803,237), root:(804,294),
state 0x6, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
Pressionando Control L envia Capslock .
$ xev
KeyPress event, serial 36, synthetic NO, window 0x3e00001,
root 0x86, subw 0x0, time 891083183, (793,9), root:(794,66),
state 0x0, keycode 37 (keysym 0xffe5, Caps_Lock), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x3e00001,
root 0x86, subw 0x0, time 891083302, (793,9), root:(794,66),
state 0x2, keycode 37 (keysym 0xffe5, Caps_Lock), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False