Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detect_key_down_uninterruptedly significantly delays input #4031

Open
caillou opened this issue Nov 26, 2024 · 3 comments
Open

detect_key_down_uninterruptedly significantly delays input #4031

caillou opened this issue Nov 26, 2024 · 3 comments

Comments

@caillou
Copy link

caillou commented Nov 26, 2024

As always, first things first: I love this project! Thanks for the effort going into this!

I an very well aware, that my issue is an edge-case. But I thought you still might want to know.

The input of my implementation of SpaceFN + i -> up_arrow is significantly delayed.

This delay appears as soon as I add detect_key_down_uninterruptedly.

The reason I added detect_key_down_uninterruptedly, is that modifier keys seem to interrupt the simultaneous input of space + i.

Is there another way to avoid that modifier keys interrupt the simultaneous input?

{
  "description": "SpaceFN",
  "manipulators": [
    {
      "conditions": [
        {
          "name": "SpaceFN",
          "type": "variable_if",
          "value": 0
        }
      ],
      "from": {
        "modifiers": {"optional": ["any"]},
        "simultaneous": [
          { "key_code": "spacebar" },
          { "key_code": "i" }
        ],
        "simultaneous_options": {
          "key_down_order": "strict",
          "key_up_order": "strict_inverse",
          "detect_key_down_uninterruptedly": true,
          "to_after_key_up": [{
              "set_variable": {
                "name": "SpaceFN",
                "value": 0
              }
            }]
        }
      },
      "parameters": {
        "basic.simultaneous_threshold_milliseconds": 10000
      },
      "to": [
        {
          "set_variable": {
            "name": "SpaceFN",
            "value": 1
          }
        },
        {
          "key_code": "up_arrow"
        }
      ],
      "type": "basic"
    },
    {
      "conditions": [
        {
          "name": "SpaceFN",
          "type": "variable_if",
          "value": 1
        }
      ],
      "from": {
        "key_code": "i",
        "modifiers": {
          "optional": ["any"]
        }
      },
      "to": [ { "key_code": "up_arrow" } ],
      "type": "basic"
    }
  ]
}
@tekezo
Copy link
Member

tekezo commented Nov 27, 2024

With detect_key_down_uninterruptedly enabled, all key events, even those unrelated to simultaneous, must be delayed uniformly, so this behavior is intentional.
If a specific key is causing the issue, try adding a version of simultaneous that includes that key in addition to your existing rules.

@caillou
Copy link
Author

caillou commented Nov 27, 2024

Thanks for your quick response.

I understand that keypresses other than the ones registered a simultaneous need to be buffered.

What I was wondering is, if there is a reason for massive delay happening when just pressing the keys that are intended to be simultaneous (and strict in order), e.g. just pressing space + i.

@tekezo
Copy link
Member

tekezo commented Nov 27, 2024

This parameter controls the delay, so the optimal value is the smallest one at which you can reliably perform simultaneous key presses.

        "basic.simultaneous_threshold_milliseconds": 50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants