Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Desktop
User Name
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.


Closed Thread
  Search this Thread
Old 04-04-2007, 01:12 PM   #1
Registered: Apr 2002
Location: St. Paul, Minnesota
Distribution: UbuntuStudio, Ubuntu
Posts: 357

Rep: Reputation: 31
Lightbulb Getting Control on Caps Lock - A How To

a/k/a Caps Lock as Another Control
a/k/a Swap Caps Lock and Control


Debian (unstable)
kernel, 2.6.18-4-686
Xorg 7.1.1


If you've ever had the pleasure of using a 'Sun' keyboard, you'll note
that the Caps Lock and Control keys are swapped. If you use your keyboard
a lot, you probably use the Ctrl key a lot, and probably don't use the
Caps Lock very often, if ever (UNLESS YOU'RE INTO YELLING). So, why force
the awkward pinky reach down to the Ctrl?

This is in two parts, mostly because the Console terminals, the virtual
terminals that don't have an X display, use a different keyboard mapping
than the X window system.


Update /etc/console/boottime.kmap.gz

First make a backup, then uncompress and edit the file...
mv /etc/console/boottime.kmap.gz /etc/console/boottime.kmap.orig.gz
cp /etc/console/boottime.kmap.orig.gz /etc/console/boottime.kmap.gz
cp /etc/console/boottime.kmap.orig.gz /etc/console/test.kmap.gz
gzip -d /etc/console/test.kmap.gz
vim /etc/console/test.kmap
Find the Caps_Lock entry, which should be:

keycode  58 = Caps_Lock
Then replace it with Control
keycode  58 = Control

Finally, If you want to swap the Caps Lock and left Ctrl keys,
find the left control entry, which should be:
keycode  29 = Control
Then replace it with Caps_Lock
keycode  29 = Caps_Lock
Human Compatability Note:
I did use the swapped mapping for a short while, but my wife was NOT
happy with the resulting layout. She kept on struggling to remember
the new location of 'Ctrl'.


Remember to re-zip the keymap when you are done.

gzip /etc/console/test.kmap
Finally, because you are tampering with your console keymap,
do 'test' the test...

loadkeys test.kmap.gz
Make sure the keyboard does everything you expect that it should do. Only then
should you copy the test.kmap.gz over the boottime.kmap.gz (technically, I should
be telling the boot process to load an alternate keymap, instead of overwriting
the default, this is easier).


Edit /etc/X11/xorg.conf

Section "InputDevice"
    Identifier "Generic Keyboard"
    Driver "kbd"
    Option "CoreKeyboard"
    Option "XkbRules" "xorg"
    Option "XkbModel" "pc104" # Your model may be different here.
    Option "XkbLayout" "us" # This is the only one I tested.
    Option "XkbOptions" "ctrl:nocaps" # This is the new line.
I found the valid XkbOptions lines in the "*.lst" files at
Another valid xkbOption is "ctrl:swapcaps".

M$ Win XP:

Because we sometimes have to use it...

The following are contents of loadable 'keymap.reg' files...

Just set Caps Lock as another Control
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00
Swap Ctrl and Caps Lock:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,1d,00,3a,00,3a,00,1d,e0,\
NOTE: This works for XP using 'US' keyboard layouts. Your results could vary.
Screwing with the Windows registry is dangerous.

Thank you, I hope this helps someone besides me.
Old 04-04-2007, 03:44 PM   #2
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 472Reputation: 472Reputation: 472Reputation: 472Reputation: 472
I would suggest that you repost this in the Tutorials section. Leaving it here will just see the thread being pushed down the forums and lost.
Old 04-04-2007, 03:57 PM   #3
LQ Guru
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 75
Closed because of the reasons mentioned above.

Closed Thread

debian, keyboard, keymapping

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Caps Lock & Scroll Lock Flashing thedug Linux - General 6 06-07-2008 10:43 PM
map control key to caps lock in Xemacs gandalf3 Linux - Software 0 12-19-2006 11:05 AM
Caps Lock and Num Lock leds dont work! npc Linux - Hardware 2 11-08-2005 11:40 AM
RedHat 9.0 freezes with blinking Caps lock and Scroll lock queen-bee Linux - Software 0 07-30-2004 11:40 PM
switch caps lock and left control rgiggs Slackware 1 07-13-2004 01:14 PM > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 03:29 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration