Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

From Remap Caps Lock :

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
share|improve this answer
    
Uhm, that's my first attempt in my post. –  Maruti Apr 8 '11 at 17:45
    
Oups, missed that. Then why did it work this time? –  harrymc Apr 8 '11 at 19:24
    
I'm not sure. I think I forgot to reset the keymap after meddling with keycodes. –  Maruti Apr 8 '11 at 21:14
    
To the under-voter: this answer worked, since the poster did everything correctly (except resetting). –  harrymc Dec 20 '13 at 12:22
add comment

This may work for you.

/usr/bin/setxkbmap -option "ctrl:swapcaps"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.