Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've been trying to swap CAPS LOCK key with Tab key. So the CAPS LOCK key shouldn't turn on the CAPS anymore, instead, act as the Tab key. Some people told me that I should create a .Xmodmap file in the ~/ directory. But I have no idea what's next.

Any suggestions?

share|improve this question

2 Answers 2

up vote 7 down vote accepted

First list your current settings with

xmodmap -pke|egrep  -e '(Tab|Caps)'

I get this output

keycode  23 = Tab ISO_Left_Tab Tab ISO_Left_Tab
keycode  66 = Caps_Lock NoSymbol Caps_Lock

So, temporarily set your keymap

xmodmap -e "keycode  66 = Tab ISO_Left_Tab Tab ISO_Left_Tab"
xmodmap -e "keycode  23 = Caps_Lock NoSymbol Caps_Lock"

Assuming that works, add those lines to ~/.Xmodmap

keycode  66 = Tab ISO_Left_Tab Tab ISO_Left_Tab
keycode  23 = Caps_Lock NoSymbol Caps_Lock

You can then either log out and back in or

xmodmap ~/.Xmodmap
share|improve this answer
    
Thanks a lot. Just one question: what did you mean by 'temporarily set your keymap? ' Running these lines in the terminal? –  janoChen Jan 11 '12 at 5:56
    
yes, you can test the settings out in a terminal by running those commands. –  bodhi.zazen Jan 11 '12 at 5:58
    
Hey it worked but the Caps Lock still turning on and off. What can be causing this? –  janoChen Jan 11 '12 at 8:15
    
You may need to clear your setting first in ~/.Xmodmap (I did not need to do this). See wiki.archlinux.org/index.php/Xmodmap and manpages.ubuntu.com/manpages/precise/man1/xmodmap.1.html –  bodhi.zazen Jan 11 '12 at 16:08
1  
alt-capslock doesn't work like alt-tab when you do this. –  pwned May 26 '13 at 4:33

For alt-capslock: in your .Xmodmap file, add clear Mod1 at the beginning and add Mod1 = Alt_L Alt_R at the end.

share|improve this answer
    
You sure? It says Alt Right and Alt Left there. –  Braiam Sep 13 '13 at 11:34

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.