Tips Linux Explorers   All Things Linux Forum   Great Linux Links   LinuxClues.com   Hometown   Email 



NO CAPSLOCK !


Does this happen to you ? Ever had the urge to violently remove the Cap Lock key from your keyboard because you accidentally kept hitting it ? Relax, I think we have a solution for this problem.

Linux offers you an effective way to disable Caps lock and if you want you can even add a new function to that key.

Basically the command to disable the Caps Lock key ( for the current session only ) would be:

CODE
$ xmodmap -e "remove Lock = Caps_Lock"


Now, there are a few ways to make this permanent, just pick the one that works best for you:

1). Add "remove Lock = Caps_Lock" to the /etc/X11/Xmodmap or the ~/.xmodmaprc file ( But in my Mandriva this did not help so see the next option )

2). Make a bash script called "nocapslock" with the text:

QUOTE
#!/bin/bash
xmodmap -e "remove Lock = Caps_Lock"
#End script

And make the file executable with:

CODE
$ chmod 755 nocapslock

Finally if you run KDE place the script in "/home/bruno/.kde/Autostart", if you run Gnome you can make a directory "/usr/share/gnome/autostart" and place the script in there and at next login you get a dialog that will ask you if you want to enable the script for future logins in Gnome.


This should take care of disabling the Caps Lock key.



But that is not all you can do, if you really want you could even give the Caps Lock key another function ( make it another Enter-key with "keycode 66 = Return" ) or even swap the Ctrl key with the Caps Lock key with the following script:

QUOTE
#!/bin/bash
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L
#End script

Have a look in "man xmodmap" and get creative with your keyboard.



Bruno



-- Sep 17 2006 --


Tips Linux Explorers   All Things Linux Forum   Great Linux Links   LinuxClues.com   Hometown   Email