Estou tentando remapear o Caps Lock para Control. Antes de modificar qualquer coisa, xev
relata o seguinte para um pressionamento / liberação de Caps Lock:
KeyPress event, serial 73, synthetic NO, window 0x2600001,
root 0x290, subw 0x0, time 50243576, (82,130), root:(1365,612),
state 0x0, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
PropertyNotify event, serial 73, synthetic NO, window 0x2600001,
atom 0x17c (XKLAVIER_STATE), time 50243577, state PropertyNewValue
PropertyNotify event, serial 73, synthetic NO, window 0x2600001,
atom 0x17c (XKLAVIER_STATE), time 50243579, state PropertyNewValue
KeyRelease event, serial 73, synthetic NO, window 0x2600001,
root 0x290, subw 0x0, time 50243680, (82,130), root:(1365,612),
state 0x2, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
Eu corro o seguinte para remapear:
xmodmap -e 'remove Lock = Caps_Lock'
xmodmap -e 'keysym Caps_Lock = Control_L'
xmodmap -e 'add Lock = Caps_Lock'
xmodmap -e 'clear Lock'
xmodmap -e 'keycode 66 = Control_L'
Agora, para uma impressão / liberação no Caps Lock, xev
relatórios:
KeyPress event, serial 80, synthetic NO, window 0x2600001,
root 0x290, subw 0x0, time 50785441, (11,140), root:(1294,622),
state 0x0, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,
XKeysymToKeycode returns keycode: 37
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 80, synthetic NO, window 0x2600001,
root 0x290, subw 0x0, time 50785521, (11,140), root:(1294,622),
state 0x0, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,
XKeysymToKeycode returns keycode: 37
XLookupString gives 0 bytes:
XFilterEvent returns: False
Isso parece bom, mas a chave ainda funciona como Caps Lock em todos os outros aplicativos. Eu notei que quando pressiono a tecla de controle esquerda 'real' não há XKeysymToKeycode
, mas não tenho idéia do que isso significa.
Aqui estão os eventos para a tecla Ctrl pressionada / liberada:
KeyPress event, serial 37, synthetic NO, window 0x2600001,
root 0x290, subw 0x0, time 57111640, (176,176), root:(188,272),
state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 37, synthetic NO, window 0x2600001,
root 0x290, subw 0x0, time 57111736, (176,176), root:(188,272),
state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False