Karabiner-elements: Map fn + numbers to numpad

Created on 26 Feb 2018  路  5Comments  路  Source: pqrs-org/Karabiner-Elements

Hi!
I'm trying to map my numbers to the numpad by simultaneously holding down the fn key. It actually works but I always get an error message in the Log and don't understand what the issue is. Can someone pls help me ?

 <%
    remap_source_keys = [
        '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'
    ];
    remap_dest_keys = [
        'keypad_1', 'keypad_2', 'keypad_3', 'keypad_4', 'keypad_5', 'keypad_6', 'keypad_7', 'keypad_8', 'keypad_9', 'keypad_0'
    ];
    manipulators = each_key(
        source_keys_list: remap_source_keys,
        dest_keys_list: remap_dest_keys,
        from_mandatory_modifiers: ["fn"],
        from_optional_modifiers: ["any"],
        as_json: true
    );
    manipulators_fn = each_key(
        source_keys_list: remap_source_keys,
        dest_keys_list: remap_dest_keys,
        from_mandatory_modifiers: ["fn"],
        from_optional_modifiers: ["any"],
        to_modifiers: ["fn"],
        as_json: true
    );
%>
{
    "title": "Map fn + number keys to numpad",
    "rules": [
        {
            "description": "Map fn + number keys to numpad",
            "manipulators": <%= manipulators_fn %>
        }

    ]
}

error

Most helpful comment

All 5 comments

@KarlKaos not sure what the problem with your erb is.

It looks very similar to the fn-plus-numbers->f-keys one on the complex modifications github (note that you can probably drop that top manipulators block, since it's not used anymore, only manipulators_fn).

AFAIK the erb isn't really a karabiner thing anyway so much as how the complex modifications site generates files for import. What you want to look at is the generated JSON file that comes out the other side of the make process.

The "null" getting inserted isn't valid JSON, which is the issue. I have no idea where it's coming from though, assuming this is the erb you actually used to generate it. My guesses would have been unequal numbers of src/dest arrays (but they're equal) or a trailing comma (but there's none).

However, you can go edit the generated JSON directly and at least fix your own problem. Since you've already imported what you made, it'll be added to your ~/.config/karabiner.json already. Search for "null" in there.

My guess is the manipulator containing it can be deleted entirely, since you say stuff is otherwise working. It might also give you a clue as to which portion of the erb caused it to be generated.

Thank you for replying! Yes, I copied that preset over and changed it up a little with the limited programming knowledge I have. Gonna try to incorporate your recommendations tomorrow it's already 4 AM

I got it to work with help of a friend. Apparantly the file had some unneccessary remains from the preset I copy pasted. We removed the remains and now it works perfectly. Thank you very much for your help.

@KarlKaos Could you give us the modified script you got working?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rkusa picture rkusa  路  3Comments

Ox0400 picture Ox0400  路  3Comments

aniude picture aniude  路  3Comments

impala75 picture impala75  路  3Comments

baurmatt picture baurmatt  路  3Comments