I am always looking for ways of making my "computing environment" better and more efficient. A friend of mine (Ryan Doom) pointed out how rarely we used the Caps Lock key suggesting that I should assign the backspace key to it. This sounded like a good idea because right now I have to reach so far out to get to the backspace key (top-…….-right-……-hand corner…) so I decided to give it a try… In order to assign the backspace key to the caps lock key in Microsoft Windows you have to modify a registry key. Don’t worry because SharpKeys can make this a breeze, with SharpKeys you don’t have to know either the key codes nor the HKEY_BLAH/BLAH/BLAH…

By now I have been using my keyboard with the new assignment for a few months and got really used to it. I had to revisit this a few days ago when I decided to try out linux much more thorougly than I had before. Doing this assignment in linux was a little more work because I had to modify the keyboard layout file for console and then do another reassignment for X. Below is what I did to accomplish these two tasks; I am using Arch Linux with the default QWERTY layout so you might have to do a few things differently depending on the distro that you prefer…

To change the default keyboard layout

  1. cd to /usr/share/kdb/keymaps/i386/qwerty
  2. Copy the us.map.gz to a new file myus.map.gz
  3. Edit myus.map.gz using your favorite editor and change the line keycode 58 = Caps_Lock to keycode 58 = BackSpace
  4. Change the default keyboard layout file that will be used by editing /etc/rc.conf and changing the line that says KEYMAP=us to KEYMAP=myus

This will change the default layout for consoles, you can load the new layout immediately by running the command loadkeys myus otherwise the default layout will be loaded when you restart the computer. Now to change the layout in X

  1. Create a file called .xmodmap in your home directory with the following code
  2. ! Swap Caps lock and backspace.
    remove lock = Caps_Lock
    keysym Caps_Lock = BackSpace

  3. If you are already in X then just run xmodmap ~/.xmodmap. If not then start your favorite desktop environment and run that command.

I presonally prefer KDE and am still working on finding the best way to automatically run the xmodmap command when KDE starts. So far I have created a file that runs this command in the ~/.kde/Autostart but that didn’t seem to work. I will do some more research and post an update once I get it figured out.

2005-04-28: You can easily install the keymap in debian using the install-keymap command.

Back to blog...