Handy Hack: Disable Caps Lock under GNOME
Posted by Alec on 5 January 2007
I have just spent far more time than I should discovering the correct way to disable my caps lock key on GNOME with Linux. So here is the secret sauce:
The command you need to run is xmodmap -e "remove lock = Caps_Lock" which you can place in your ~/.profile, which is usually run as part of the {k,g,x}dm startup scripts (although your mileage may vary depending on how your system is set up). Thanks to Peter for the tip
In Ubunto 6.10 (and above) using GNOME GDM there is a better way. Create a file called ~/.Xmodmap that contains the text remove lock = Caps_Lock and restart X. This should work in other distros using GNOME, I examined the file /etc/gdm/Xsession to locate this information, there may be a KDE equivalent. When switching from GNOME to Xfce the setting is also picked up.
Update June 2008 — tested on Hardy Heron 8.04 and works as discussed. Gnome now asks you to confirm that you want the .Xmodmap used the first time, then it’s automatic.
In MS Windows there are various registry files to accomplish the same task — just ask Google, but inspect any registry file you download in a text editor to make sure it looks like it’s only doing what it’s supposed to.
powered by performancing firefox


Peter Aldred said
For KDE:
http://anticapslock.com/articles/readarticle.php?page_id=1022&article_id=1011
Alec said
Thanks for that Peter.
Funnily enough I have just implemented this myself yesterday as I switched to KDE this weekend. I am waiting to see if it works for me, or if I need to actually disable the key completely.
Cheers
Merijn Vogel said
You do not have to restart X, after you create the .Xmodmap file in your homedir, you can execute the following in a terminal:
xmodmap .Xmodmap
Noel Verhoeven said
after you have removed the annoying caps lock functionality and if you want to supersize your shift key, you could add the following line to your .Xmodmap file:
add shift = Caps_Lock
This will give the same working for the caps lock key as the shift key.
Cheers
Simon Waters said
GNOME’s keyboard tool allows you to map Caps Lock to “compose” thus killing two birds with one stone (Lack of Compose and Caps Lock).
System > Preferences > Keyboard
Layout Options > Compose Key Position – tick “Caps Lock is Compose”
mihai said
thanks a lot, my eeepc keyboard is broken and the caps lock was locked ON. these instructions saved me from a call to asus annoying so called support service