Can't swap Caps Lock and Esc keys using Seil
I'm using Seil to remap the Caps Lock button.
Following by instruction I've deactivated Caps Lock by setting it to ‘No Action’ in System Preferences → Keyboard → Modifier Keys.
Then went to Seil's ‘Change the caps lock key’ and set the keycode to 53. Now it works as Esc key and it's functional.
Now I want to make the Esc key work as Caps Lock.
In Karabiner in ‘Change Escape Key’ section I've checked ‘Escape to CapsLock’ checkbox. However it works in completely the wrong way. By pressing Esc button it changes capitalisation, but as well as by pressing Shift+Esc buttons. Also in that mode the Caps Lock button works as a usual button by changing capitalisation.
But if I change it to ‘Shift-Escape to CapsLock’ box then everything works except for one thing, I have to press Shift+Esc to change capitalisation.
So it's not actually a swap between the Esc and Caps Lock buttons.
Am I missing something? How do I fix this problem?
Solution 1:
The problem is that you are setting up a recursive key binding.
-
Seil changes
caps lock -> esc
-
Karabiner changes
esc -> caps lock
So in the end when you hit caps lock
or esc
you will still get caps lock
.
caps lock -> esc -> caps lock
When using Seil and Karbiner together you must follow the Input Even Modification Chain to determine the key press outcome (see Example 2 and Plural settings in Karabiner from the link). You have to pay attention to the input event order.
- Seil propagates to...
- System Preferences > Keyboard > Modifier Keys... which propagates to...
- Karabine
In other words, you CAN’T swap just two keys with the Seil & Karabin method you are trying. It will always create a caps lock
key press recursion issue.
Rather, you should try to remap both keys with Karbiner only to create a private XML mapping file. This is because Karabiner by itself does not allow you to create recursive event modifications.
I hope this makes logical sense and helps.
Solution 2:
I was having a similar problem and I fixed it by changing both settings in Seil itself, as Karbine can't modify the caps-lock key and says to do it from Seil for modifying it.