Custom Keyboard

I find customizing the keyboard to be useful in two different ways: adding to the functionality of the keyboard, or taking away from it. In this section I will go through disabling the Insert key, so it is no longer a nuisance that might accidentally induce the overwriting of your documents. Also, I'll remap the the Caps Lock key to Control. I always use Shift instead of Caps Lock anyway, and the position of Caps Lock is much more convenient than the position of the Control key. This is particularly useful for applications like screen which rely on heavy usage of Control. In order to make these modifications to our keyboard, we'll need to use xkeycaps, which is a handy graphical tool for customizing your X keyboard (the modifications only work while you are in X). To begin, su to root. Then

cd /usr/ports/x11/xkeycaps
make install clean
exit
xkeycaps &

The above sequence includes installing and then running xkeycaps. After that you should be greeted with this:

Choose which keyboard matches yours. Mine was a 104 key. If you don't know how many keys you have, definately don't count. Look at the small keyboard picture until you find the one that matches yours. If you choose the wrong one, just click on select keyboard.

If you right click on a key you get the ability to change its options. So right click on insert and choose disable key.

Now right click on your Caps Lock key and select "Edit KeySyms of Key". We'll turn Caps Lock into another control key.

That should seem familiar in syntax to Fluxbox's keys. In fact, if you put your cursor over the windows key and alt, you will see they are Mod4 and Mod1 respectively. Anyway, now click on write changes.

You only need to write changes for the keys you changed. Then it tells you to add a line to .xinitrc, but that didn't work for me

So we'll just have to do things our own way. We'll rename the file to something less complicated, and add a slightly modified version of their line.

cd ~
ls -a
mv .xmodmap-your-domain-here .xmodmap
vi .xinitrc

After that sequence you'll be ready to add the correct line. Above all other lines, add:

xmodmap ~/.xmodmap

Since the release of Xorg 7.3, there is one additional step required to change the mapping of the Caps Lock key to control.

vi /etc/X11/xorg.conf

Now scroll down to the input section for your keyboard, and add the following line

Option "XkbOptions" "ctrl:nocaps"

As soon as you restart X, you will be able to take advantage of your modified keyboard. Although not featured in this section, I also recommend mapping all of the numpad keys such that they have the same function whether or not Num Lock is on. Of course, this is a matter of personal preference, but I find it useful.