Skip to content

Remap caps lock to a control key

2010/06/18

For keyboard shortcuts, sometimes it’s helpful to have Caps Lock act as a control key. Here’s how:

#!/bin/bash
# from http://www.paganini.net/index.cgi/linux/nocaps.html
if [ $DISPLAY ]
then
  # remap capslock to control
  xmodmap -e 'remove Lock'
  xmodmap -e 'keysym Caps_Lock = Control_L'
  xmodmap -e 'add Control = Control_L'
fi

This is one of the most useful things I’ve ever learned, and it has made me more productive in my daily computer use.

UPDATE – 2010/07/22:
There’s an easier way to do this, if you’re using Ubuntu.
Fire up your handy Keyboard Shortcut settings, found under the
“System > Keyboard” preferences menu, as shown here:

How to open the Keyboard Preferences dialog

Then, navigate to the “Layouts” tab and click on your current layout (mine is “USA”,) and click “Options.”  Then, expand the “Ctrl key position” tree, and click “Make CapsLock an additional Ctrl” like this,

Ctrl key position options for your current keyboard layout

Upon clicking “Close” at the bottom right of that dialog, and again at the bottom right of the “Keyboard Preferences” dialog, you should be able to open and close browser tabs (Ctrl+T, Ctrl+W) and use text editor keyboard shortcuts to cut, copy and paste (Ctrl+X, Ctrl+C, Ctrl+V) without taking your hands off the home row, and you’ll be productive like a boss!

These screenies are from a Ubuntu system, but this SHOULD work on any X11 environment (Linux system) where Gnome is the Desktop Environment.

Windows users, there are ways to do this.  I hope that you will look for them.  However, I worked long and hard to get away from Microsoft products, so you will not find them here.

Enjoy!

Advertisements
Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: