Add this config to ~/.config/karabiner/assets/complex_modifications/custom-capslock.json
{
"title": "Change caps_lock to Esc and Control",
"rules": [
{
"description": "Post Esc if Caps is tapped, Control if held.",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_control",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_control",
"lazy": true
}
],
"to_if_alone": [
{
"key_code": "escape"
}
]
}
]
}
]
}
and then in the GUI enable it in the Complex Modifications tab. Last you need to map "capslock" to "left_control" in the Simple Modifications tab. $ setxkbmap -option caps:ctrl_modifier
$ xcape -e 'Caps_Lock=Escape'
if that need be run multiple times (i.e. in bashrc), add a guard: pgrep xcape >/dev/null || (
setxkbmap -option caps:ctrl_modifier
xcape -e 'Caps_Lock=Escape'
)I consider it indispensable.