For example, I map caps_lock+J to left_arrow.
caps_lock sets a var=1, and var is a condition for J.
Now I've tried for three hours to make
shift+caps_lock+J => shift+left_arrow
, but it seems there is no way.
I could do explicit mappings for all modifier combos (caps+J, shift+caps+J, shift+control+caps+J etc etc), but that would be a huge config.
It works when I map caps_lock to fn - but if I understand correctly, this is old school.
If it helps you read it, here is part of my config.
Can I somehow apply the optional modifiers of caps_lock (shift, control, alt) to the resulting to: keycode of 'J' ?
"manipulators": [
{
"from": {
"key_code": "caps_lock"
},
"to": [
{
"set_variable": {
"name": "cl_down",
"value": 1
}
}
],
"to_after_key_up": [
{
"set_variable": {
"name": "cl_down",
"value": 0
}
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "cl_down",
"type": "variable_if",
"value": 1
}
],
"description": "cursor left",
"from": {
"key_code": "j"
},
"to": [
{
"key_code": "left_arrow"
}
],
"type": "basic"
}
Try this:
```"manipulators": [
{
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"left_shift","right_shift"
]
}
},
"to": [
{
"set_variable": {
"name": "cl_down",
"value": 1
}
}
],
"to_after_key_up": [
{
"set_variable": {
"name": "cl_down",
"value": 0
}
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "cl_down",
"type": "variable_if",
"value": 1
}
],
"description": "cursor left",
"from": {
"key_code": "j",
"modifiers": {
"optional": [
"left_shift","right_shift"
]
}
},
"to": [
{
"key_code": "left_arrow"
}
],
"type": "basic"
}
]
Woohoo it works!! Thanks!
I was sure I've tried this variant before, but obviously not correctly.
Note: it also works with the 'any' modifier, which is exactly what I wanted.
YES! I have not used my MBA since Sierra came out, because my special layout is hardwired into my fingers. Editing JSON with broken cursor control was like... typing with your nose.
I'm 10x faster now that Karabiner is back.
And thank you Tekezo-San, you rock!
Just for the record: this is how you map
CapsLock + J (+ any modifier) to
CursorLeft (+any modifier that is currently pressed) :
"manipulators": [
{
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"set_variable": {
"name": "cl_down",
"value": 1
}
}
],
"to_after_key_up": [
{
"set_variable": {
"name": "cl_down",
"value": 0
}
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "cl_down",
"type": "variable_if",
"value": 1
}
],
"description": "CURSOR_LEFT",
"from": {
"key_code": "j",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_arrow"
}
],
"type": "basic"
}
Most helpful comment
Just for the record: this is how you map
CapsLock + J (+ any modifier) to
CursorLeft (+any modifier that is currently pressed) :