How to swap ctrl and caps lock using xmodmap

Posted by Maruti on Super User See other posts from Super User or by Maruti
Published on 2011-04-08T11:57:58Z Indexed on 2012/06/12 16:43 UTC
Read the original article Hit count: 304

Or any other tool, but I prefer xmodmap. I tried this:

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

I also tried this:

xmodmap -e "keycode 66 = Control_L"

But neither seem to fully work. Here's the event log for pressing caps lock:

KeyPress event, serial 28, synthetic NO, window 0x1a00001,
root 0x12d, subw 0x0, time 914826, (679,342), root:(680,362),
state 0x12, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,
XKeysymToKeycode returns keycode: 37 // 37 is the control key code
XLookupString gives 0 bytes: 
XmbLookupString gives 0 bytes: 
XFilterEvent returns: False

I'm running Ubuntu 10.10 with awesome window manager.

© Super User or respective owner

Related posts about keyboard

Related posts about ubuntu-10.10