I have my CapsLock mapped as a hyperkey. (See bottom of question for its configuration, if needed.)
I know it works, because I've successfully mapped HyperKey+h / j / k / l to arrows, vi-style. Here's how one of the keys are configured, for example:
{
"type": "basic",
"from": {
"key_code": "k",
"modifiers": {
"mandatory": [
"left_shift",
"control",
"option",
"command"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "up_arrow"
}
]
},
But now I'm trying to map such a combo to an arrow with a modifier, e.g. HyperKey+g / ; to Home and End, i.e. Command+Left / Right, like this:
{
"type": "basic",
"from": {
"key_code": "g",
"modifiers": {
"mandatory": [
"left_shift",
"control",
"option",
"command"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": ["command"]
}
]
},
But that doesn't work. Is it that I can no longer map to modified keys because the hyperkey setup already "consumes" all the modifier keys? Or something else? Is there a way to get this to work?
This was copied from another resource, and I've gotten it to work. This is just for reference in case one needs to see the details of the hyperkey setup.
"profiles": [
{
"complex_modifications": {
"parameters": {
"basic.simultaneous_threshold_milliseconds": 50,
"basic.to_delayed_action_delay_milliseconds": 500,
"basic.to_if_alone_timeout_milliseconds": 1000,
"basic.to_if_held_down_threshold_milliseconds": 500
},
"rules": [
{
"manipulators": [
{
"description": "Change caps_lock to command+control+option+shift.",
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_shift",
"modifiers": [
"left_command",
"left_control",
"left_option"
]
}
],
"to_if_alone": [
{
"key_code": "escape",
"modifiers": {
"optional": [
"any"
]
}
}
],
"type": "basic"
}
]
},
{
"description": "Change fn + hjkl' to arrow keys",
"manipulators": [
{
"from": {
"key_code": "k",
"modifiers": {
"mandatory": [
"left_shift",
"control",
"option",
"command"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "up_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "h",
"modifiers": {
"mandatory": [
"left_shift",
"control",
"option",
"command"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "j",
"modifiers": {
"mandatory": [
"left_shift",
"control",
"option",
"command"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "down_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "l",
"modifiers": {
"mandatory": [
"left_shift",
"control",
"option",
"command"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "right_arrow"
}
],
"type": "basic"
}
]
}
]
},
"devices": [
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 610,
"vendor_id": 1452
},
"ignore": false,
"manipulate_caps_lock_led": true,
"simple_modifications": []
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 597,
"vendor_id": 1452
},
"ignore": false,
"manipulate_caps_lock_led": true,
"simple_modifications": []
}
],
"fn_function_keys": [
{
"from": {
"key_code": "f1"
},
"to": {
"key_code": "vk_consumer_brightness_down"
}
},
{
"from": {
"key_code": "f2"
},
"to": {
"key_code": "vk_consumer_brightness_up"
}
},
{
"from": {
"key_code": "f3"
},
"to": {
"key_code": "vk_mission_control"
}
},
{
"from": {
"key_code": "f4"
},
"to": {
"key_code": "vk_launchpad"
}
},
{
"from": {
"key_code": "f5"
},
"to": {
"key_code": "vk_consumer_illumination_down"
}
},
{
"from": {
"key_code": "f6"
},
"to": {
"key_code": "vk_consumer_illumination_up"
}
},
{
"from": {
"key_code": "f7"
},
"to": {
"key_code": "vk_consumer_previous"
}
},
{
"from": {
"key_code": "f8"
},
"to": {
"key_code": "vk_consumer_play"
}
},
{
"from": {
"key_code": "f9"
},
"to": {
"key_code": "vk_consumer_next"
}
},
{
"from": {
"key_code": "f10"
},
"to": {
"key_code": "mute"
}
},
{
"from": {
"key_code": "f11"
},
"to": {
"key_code": "volume_down"
}
},
{
"from": {
"key_code": "f12"
},
"to": {
"key_code": "volume_up"
}
}
],
"name": "Default profile",
"one_to_many_mappings": {},
"selected": true,
"simple_modifications": [],
"standalone_keys": {},
"virtual_hid_keyboard": {
"caps_lock_delay_milliseconds": 0,
"country_code": 0,
"keyboard_type": "ansi",
"standalone_keys_delay_milliseconds": 200
}
},
Okay, figured it out. Here's what I was doing wrong / my misconceptions:
I wasn't sure why the mappings existed in both karabiner.json and assets/complex_modifications/my_mappings.json. The important one is the latter. When you reload Karabiner it seems to copy those mappings into karabiner.json.
I had to use semicolon
for the mapping, not ;
.