Modifying Control and Caps Lock keys under OpenSolaris and Linux
Since I started using Emacs, I started using the Control key more than I had used it before. That is when I started using my Caps Lock key as Control key. In the beginning, I swapped the Control key and the Caps Lock key. However while doing pair programming on my computer, my colleagues found this setup a bit unfriendly. So, I decided to give up my Caps Lock key and started using Caps Lock as an additional Control key. Under Linux, Gnome has an option to do this using the "Keyboard Preferences" application. However I was not able to find this option in OpenSolaris Gnome. So, I have to take the old xmodmap way of doing this. This works under Linux as well. I hope that this would work on all UNIX variants that uses xmodmap. But I haven't verified it personally.
To make Caps Lock key as an additional Control key, add the following to .Xmodmap file in your home directory. This configuration is automatically applied when you restart your X (Gnome) session. For the first time, you can manually apply this by running xmodmap ~/.Xmodmap.
! ! Make Caps Lock as an additional Control. ! remove Lock = Caps_Lock add Control = Caps_Lock
Please note that ! is the commenting character for xmodmap files.
But if you want to retain the Caps Lock function and swap it back to Control key, add the following to your .Xmodmap file.
! ! Swap Caps Lock and Control. ! 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