I know how to use xmodmap to remap the Caps lock key so it acts as a Control key, or as an Escape key. I would like to combine both features as follows:
When I push, then release, the Caps lock key, it sends Escape.
When I hold down Caps lock and push another key (say A), it send Control-A.
Is there some combination of xkb, xmodmap and something else that could make Caps lock behave this way in X?
I'm using Ubuntu Precise on a Macbook Air 3,1.