How to map Ctrl + Delete to Fn + Opt + Delete with Karabiner-Elements
Question
I would like to map Ctrl + Delete on a Windows keyboard to Fn + Opt + Delete on a Macbook keyboard, so it deletes the next word after the cursor.
I can't figure out how to represent Fn + Opt + Delete in the json, how would I modify the following?
{
"conditions": [{"type": "frontmost_application_unless", "bundle_identifiers": ["^com\\.sublimetext\\.3$"]}],
"from": {"key_code": "delete_forward", "modifiers": {"mandatory": ["left_control"]}},
"to": /* What should I put here? */,
"type": "basic"
}
Solution 2
Was actually quite obvious, I have no idea why I didn't try to obvious solution. Took me a couple days to figure it out. All I needed to do was add the Opt/Alt modifier.
{
"conditions": [{"type": "frontmost_application_unless", "bundle_identifiers": [
"^com\\.sublimetext\\.3$",
"^com\\.google\\.Chrome$",
"^com\\.jetbrains\\.pycharm$"
]}],
"from": {"key_code": "delete_forward", "modifiers": {"mandatory": ["left_control"]}},
"to": [{"key_code": "delete_forward", "modifiers": ["left_alt"]}],
"type": "basic"
}
OTHER TIPS
Fn is usually evaluated within the keyboard, before transmission. It doesn't generate its own event.
According to Key Codes, Fn Opt ⌥ Backspace ⌫ generates this data...
Key Down
Characters:
Unicode: 63272 / 0xf728
Keys: ⌥⌦
Key Code: 117 / 0x75
Modifiers: 8913216 / 0x880140 ⓘ
Maybe you could use that to initiate the replacement - I don't use Karabiner so can't test.
*Characters:
doesn't actually generate any printable character on my machine.