Skip to content

After Karabiner is (re-)started, variables of type Boolean and String are not initialized unless variable of type Integer is tested/assigned a value first... #1772

@Bean200505

Description

@Bean200505

Technical Details:
macOS version: macOS 15.2.0 (Sequoia)
Karabiner version: 15.3.0
Mac hardware: M4 Pro Mac mini
Keyboard hardware: Mac mini Magic Keyboard (Apple Inc.), Vendor ID: (0x004c), Product ID: (0x0322)

If I've slipped off the beam somewhere (or this has already been reported) please point out where.

Immediately after (re-)starting Karabiner, variables of type boolean and string do not appear under "Karabiner-EventViewer" >> "Variables" unless a variable of type integer is tested or assigned a value first. I've provided an example of what doesn't appear to work and a second example that does.

The following fragment doesn't appear to work as the variable tested doesn't appear under "Karabiner-EventViewer" >> "Variables" after Karabiner is (re-)started, both shift keys are pressed together, and Karabiner has had a chance to evaluate it. This appears to be the case even if the fragment appears first under "manipulators"; I suspect it's because "conditions" isn't satisfied:
...
{ "conditions": [ { "type": "variable_if",
"name": "variable_one",
"value": false
}
],
"from": { "simultaneous": [ { "key_code": "left_shift" },
{ "key_code": "right_shift" }
],
"simultaneous_options": { "key_down_order": "insensitive" }
},
"to": [ { "key_code": "vk_none" } ],
"to_after_key_up": [ { "set_variable": { "name": "variable_one",
"value": true
}
},
{ "set_variable": { "name": "variable_two",
"value": true
}
}
],
"type": "basic"
},
...

Alternatively, the following fragment works as all three variables appear under "Karabiner-EventViewer" >> "Variables" after Karabiner is (re-)started, both shift-keys are pressed, and Karabiner has had a chance to evaluate it. After this is evaluated, the original example also works on successive presses of both shift-keys:
...
{ "conditions": [ { "type": "variable_if",
"name": "variable_three",
"value": 0
}
],
"from": { "simultaneous": [ { "key_code": "left_shift" },
{ "key_code": "right_shift" }
],
"simultaneous_options": { "key_down_order": "insensitive" }
},
"to": [ { "key_code": "vk_none" } ],
"to_after_key_up": [ { "set_variable": { "name": "variable_one",
"value": true
}
},
{ "set_variable": { "name": "variable_two",
"value": true
}
},
{ "set_variable": { "name": "variable_three",
"value": 1
}
}
],
"type": "basic"
},
...

As above, if I've slipped off the beam at some point please point out where.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions