pqrs-org/Karabiner-archived

How to turn caps lock + W/S/A/D into Arrow Keys

weiweihuanghuang opened this issue · 2 comments

Hi, thanks again for maintaining this app!

I tried the following, but what happens is that it works but I can't hold down caps lock and w and make it persist as up arrow, it works once then goes back to w.

{
                      "description": "Change Caps Lock + W/S/A/D to Arrow Keys",
                      "manipulators": [
                        {
                          "type": "basic",
                          "from": {
                            "key_code": "w",
                            "modifiers": {
                              "mandatory": [
                                "caps_lock"
                              ],
                              "optional": [
                                "any"
                              ]
                            }
                          },
                          "to": [
                            {
                              "key_code": "up_arrow"
                            }
                          ]
                        },
                        {
                          "type": "basic",
                          "from": {
                            "key_code": "a",
                            "modifiers": {
                              "mandatory": [
                                "caps_lock"
                              ],
                              "optional": [
                                "any"
                              ]
                            }
                          },
                          "to": [
                            {
                              "key_code": "left_arrow"
                            }
                          ]
                        },
                        {
                          "type": "basic",
                          "from": {
                            "key_code": "s",
                            "modifiers": {
                              "mandatory": [
                                "caps_lock"
                              ],
                              "optional": [
                                "any"
                              ]
                            }
                          },
                          "to": [
                            {
                              "key_code": "down_arrow"
                            }
                          ]
                        },
                        {
                          "type": "basic",
                          "from": {
                            "key_code": "d",
                            "modifiers": {
                              "mandatory": [
                                "caps_lock"
                              ],
                              "optional": [
                                "any"
                              ]
                            }
                          },
                          "to": [
                            {
                              "key_code": "right_arrow"
                            }
                          ]
                        }
                      ]
                    },

Here is the EventViewer

eventType:key_down        code:0x39       name:caps_lock       misc:
eventType:key_up          code:0x39       name:caps_lock       misc:
eventType:key_down        code:0x50       name:left_arrow      misc:
eventType:key_down        code:0x39       name:caps_lock       misc:
eventType:key_up          code:0x50       name:left_arrow      misc:
eventType:key_down        code:0x4        name:a               misc:
eventType:key_up          code:0x4        name:a               misc:
eventType:key_down        code:0x4        name:a               misc:
eventType:key_up          code:0x4        name:a               misc:
eventType:key_up          code:0x39       name:caps_lock       misc:

Any possibility here?

@weiweihuanghuang I've run into the same problem: when used as a mandatory modifier, caps_lock is not being removed from the to event definition, creating problem when keeping it pressed down for multiple command sequences.

I've been able to work around this problem by using a "virtual modifier" as described in https://pqrs.org/osx/karabiner/json.html#virtual-modifier.

Just for reference, this is my commit that fixed my definitions for +0 to +9

jandubois/karabiner@7b57fab