LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Linux Answers > Hardware
User Name
Password

Notices

By GAVollink at 2007-04-05 09:03
Vitals:

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

------------
Introduction:

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.

-------
Console:

Update /etc/console/boottime.kmap.gz

First make a backup, then uncompress and edit the file...

Code:
.# 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 
.# vi /etc/console/test.kmap

Find the Caps_Lock entry, which should be:

Code:
keycode 58 = Caps_Lock
Then replace it with Control

Code:
keycode 58 = Control
--- Option:

If you want to swap the Caps Lock and left Ctrl keys,
find the left control entry, which should be:

Code:
keycode 29 = Control
Then replace it with Caps_Lock

Code:
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'.

--- End Option

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


Code:
gzip /etc/console/test.kmap

Finally, because you are tampering with your console keymap, do 'test' the test...


Code:
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).

----
Xorg:

Edit /etc/X11/xorg.conf


Code:
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.
EndSection


I found the valid XkbOptions lines in the "*.lst" files at /etc/X11/xkb/rules/
Another valid xkbOption is:

Code:
...
    Option "XkbOptions" "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

Code:
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:

Code:
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,\
 00,00,00,00

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.

by wjevans_7d1@yahoo.co on Tue, 2007-04-17 16:12
I don't want to start a religious war, but:

Show of hands out there of those who've just pried the damn caps lock key outta there? Over the years, it's cost me far, far, more than it's ever saved.

by bewst on Fri, 2009-01-16 15:46
Quote:
Originally Posted by wjevans_7d1@yahoo.co View Post
I don't want to start a religious war, but:

Show of hands out there of those who've just pried the damn caps lock key outta there? Over the years, it's cost me far, far, more than it's ever saved.
Too busy enjoying **typing** on my caps-lock-less system to raise hand . I had to build a heavy fix to make it work on Ubuntu, though: http://wiki.github.com/techarcana/ubuntu-config/home


  



All times are GMT -5. The time now is 10:42 PM.

Main Menu

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