I want xmodmap to make the Caps Lock key act as if I were pressing the Escape key if I only press and release it, but to act as an i3 mod key if I hold it and press another key.
This would allow me to use the Caps Lock key in both vim and for controlling i3.
I tried this configuration:
clear Lock
keycode 66 = Hyper_L
add mod4 = Hyper_L
keycode 66 = Escape
It almost accomplishes the desired behavior, but not quite. With this configuration, the Caps Lock key works as a mod key all the time, but it also presses Escape every time.
I only want it to press Escape if I do not press another key while holding Caps Lock down.
Is this possible in xmodmap? If not, are there any alternatives / recommendations you have?