2

I have a CentOS server (release 6.7). In order to do tmux shortcuts more quickly (ctrl-b), I thought of mapping the caps lock key as another ctrl key. How do I go about doing this?

I have looked up this up on Google and have tried adding XKBOPTIONS="ctrl:nocaps" to /etc/sysconfig/keyboard to no avail.

1 Answers1

1

I've never tried it with CentOS (or any server), but with other systems, I used xmodmap. This probably only works with xwindows running, but I'm not sure.

Using xev, you can find the keyboard codes for various keys. I believe 66 is the caps lock key.

Then, in a terminal, type these lines:

xmodmap -e 'keycode 66 = Control_L'
xmodmap -e 'clear Lock'
xmodmap -e 'add Control = Control_L'

Test it out to see if it works OK, then type:

xmodmap -pke >~/.Xmodmap

Now, any time you type xmodmap .Xmodmap, it will remap the keys. To keep from doing this on every reboot, add a line ~/.xinitrc, like so:

xmodmap .Xmodmap

There is an article on something similar here You can search for "xmodmap" to find more articles.