0

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?

Aaron Esau
  • 101
  • 3

1 Answers1

0

I was finally able to find a solution thanks to some help from a friend. You'll need to install https://github.com/alols/xcape, remove your attempts at solving this from .Xmodmap, then add this to your .xinitrc:

setxkbmap -option caps:super
xcape -e 'Super_L=Escape;Caps_Lock=Escape'
Aaron Esau
  • 101
  • 3