Search:  
Gentoo Wiki

TIP_Console:_Change_Caps_Lock_to_Control

This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other

I tried to find a simple way to change the Caps Lock key to a Control key on a regular Windows-ready keyboard, but it doesn't seem to be an option in any of the configuration files (unlike with the xorg-x11 configuration file). Here's my solution. Create an extended keymap file (I use /usr/share/keymaps/i386/include/nocaps.map):

File: /usr/share/keymaps/i386/include/nocaps.map
keycode 58 = Control

While I don't believe this to be strictly necessary, I gzip the file to match the format of the other keymaps.

cd /usr/share/keymaps/i386/include/
gzip nocaps.map

The last step is to enable the keymap in /etc/conf.d/keymaps:

File: /etc/conf.d/keymaps
EXTENDED_KEYMAPS="nocaps"

Finally, restart the /etc/init.d/keymaps script:

/etc/init.d/keymaps restart

New Author: Won't this modification be overwritten by portage whenever a new version of sys-apps/kbd is emerged? It appears that the extended keymaps now includes "ctrl" which does the job without modifying any files. i.e. use EXTENDED_KEYMAPS="ctrl"

To New Author: EXTENDED_KEYMAPS="ctrl" swaps ctrl and caps-lock. It does not allow one to use both caps-lock and ctrl as ctrl.

Retrieved from "http://www.gentoo-wiki.info/TIP_Console:_Change_Caps_Lock_to_Control"

Last modified: Fri, 05 Sep 2008 23:19:00 +0000 Hits: 10,087