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

Force up_key events to occur after the modifier has been pressed? #231

Open
aeberts opened this issue Sep 28, 2023 · 0 comments
Open

Force up_key events to occur after the modifier has been pressed? #231

aeberts opened this issue Sep 28, 2023 · 0 comments

Comments

@aeberts
Copy link

aeberts commented Sep 28, 2023

TL;DR:

Question: Is there a way to make sure that modifiers do not send "up_key" events before the "any" portion of the modifier? Adding the option {:upwhen :all} does not seem to work. :-/

Full discussion:

Hi!
I have a rule setup to turn capslock to hyper in non-unix like apps but it appears to send "up key" event before the optional "any" key is pressed which causes problems in some apps.

Here's the rule I have in karabiner.edn:

[:##caps_lock :!CTOleft_shift [:!unix-like]]

This rule gives me a hyper key so when I press the capslock key I get "Command + Control + Option + Left_Shift" plus whatever key I type after it. This works fine in most cases. However, when I snoop on the shortcut in Karabiner event viewer, I noticed that the modifier "key_up" events are being sent before the "any" key. Example for key press "Caps Lock" + d, I get the following sequence (notice that the "up key" events for control, shift, and option are being sent before the "down_key" event for "d"):

[
  {
    "type": "down",
    "name": {"key_code":"left_command"}, ... },
  {
    "type": "down",
    "name": {"key_code":"left_control"}, ... },
  {
    "type": "down",
    "name": {"key_code":"left_option"}, ...  },
  {
    "type": "down",
    "name": {"key_code":"left_shift"}, ... },
  {
    "type": "up",
    "name": {"key_code":"left_control"},  ... },
  {
    "type": "up",
    "name": {"key_code":"left_shift"}, ... },
  {
    "type": "up",
    "name": {"key_code":"left_option"}, ...  },
  {
    "type": "down",
    "name": {"key_code":"d"},  ...  },
  {
    "type": "up",
    "name": {"key_code":"d"}, ...  },
  {
    "type": "down",
    "name": {"key_code":"left_control"},  ... },
  {
    "type": "down",
    "name": {"key_code":"left_option"},  ... },
  {
    "type": "up",
    "name": {"key_code":"left_control"}, ...  },
  {
    "type": "up",
    "name": {"key_code":"left_option"}, ... },
  {
    "type": "up",
    "name": {"key_code":"left_command"}, ...  },
 ... ]

Is there a way to force the modifiers to release before the "any" key?

I tried doing [:##caps_lock :!CTOleft_shift [:!unix-like] {:upwhen :all}] but that doesn't seem to add anything to the corresponding rule in the generated karabiner.json file.

Thanks!

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

1 participant