As Ignacio said, it cannot be done with keymaps. But it can be e.g. simply scripted using xbindkeys and xdotool.
First, strip Caps Lock of its special functionality using xmodmap (this has to be done each time X is started):
xmodmap -e 'keycode 66 = F13'
Then, add the following bindings to you .xbindkeysrc
:
"xdotool keyup Control_L; xdotool keydown Control_L"
F13
"xdotool keydown Control_L; xdotool keyup Control_L"
Control + F13
This creates a fake keypress (without release) of the Ctrl key whenever Caps Lock (now F13) is pressed. The up+down sequence is there for some technical reasons of how the fake events work.
In this version, pressing (left) Ctrl releases the lock. This could be modified (either so that both controls release it, or neither does) but it would be a little more complicated (e.g. one could create another control key (e.g. F14) and fake-press that instead of Control_L).
Thanks, at least now I know not to keep trying to do it by messing with keymappings. – MalcolmWhy – 2010-10-18T19:57:55.863