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

release-key releases both sides of a mod and not just one, e.g. lctl and rctl or lmet and rmet #1106

Closed
1 task done
newsve opened this issue Jun 11, 2024 · 7 comments
Closed
1 task done
Assignees
Labels
bug Something isn't working by-design/obsolete llhook Pertains to the standard version of Kanata on Windows windows Issue pertains to Windows only

Comments

@newsve
Copy link

newsve commented Jun 11, 2024

Requirements

Describe the bug

release-key releases both sides of a mod and not just one.

In following example, I want to use ; as rctl except for hjkl where is should act as cursor keys, hence releasing rtcl when pressed. But if these are pressed together with a which acts as lctl I'd like to have C-arrows (to jump between words). In other words, rtcl should be released while lctl is being held.

Problem is that release-key release both sides.

Relevant kanata config

(defsrc a h j k l ;)

(defalias
  a (tap-hold-release 0 200 a lctl)
  ; (tap-hold-release 0 200 ; (multi rctl (layer-toggle two)))
  left (multi (release-key rctl) left)
  down (multi (release-key rctl) down)
  up (multi (release-key rctl) up)
  right (multi (release-key rctl) right)
)

(deflayer one @a h j k l @;)

(deflayer two _ @left @down @up @right _)

(This is the Windows and Linux version, not macOS because jumping words there is done with alt., which I override with the meta keys, hence release-key should also release only one side of the meta keys and so on)

To Reproduce

  1. Try to jump between words by holding a and ; and pressing h or l

Expected behavior

release-key should only release the specified side of a mod, e.g. lctl or rctl in our example but not both. Then jumping words with holding a and ; while pressing h and l would work.

Kanata version

v1.7.0-prerelease

Debug logs

No response

Operating system

tested on Windows 11

Additional context

No response

@newsve newsve added the bug Something isn't working label Jun 11, 2024
@jtroo
Copy link
Owner

jtroo commented Jun 11, 2024

Can add the logs from running with --debug while reproducing the issue?

Knowing the implementation of release-key, my first guess would be an OS issue, but not a guarantee.

@newsve
Copy link
Author

newsve commented Jun 11, 2024

Sure, and what I did: held a and ; tapped 3x h (for jumping three words to the left) and 3x l (for jumping three
words to the right). What is interesting, sometimes it only works with the first held of a and ; and then never again.

08:24:00.7422 [DEBUG] (1) kanata_state_machine::kanata::windows::llhook: event loop: KeyEvent { code: KEY_A, value: Press }
08:24:00.7439 [DEBUG] (2) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_A, value: Press }
08:24:00.9673 [DEBUG] (2) kanata_state_machine::kanata: key press     LCtrl
08:24:01.3216 [DEBUG] (1) kanata_state_machine::kanata::windows::llhook: event loop: KeyEvent { code: KEY_SEMICOLON, value: Press }
08:24:01.3226 [DEBUG] (2) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_SEMICOLON, value: Press }
08:24:01.5460 [DEBUG] (2) kanata_state_machine::kanata: key press     RCtrl
08:24:01.9708 [DEBUG] (1) kanata_state_machine::kanata::windows::llhook: event loop: KeyEvent { code: KEY_SEMICOLON, value: Press }
08:24:01.9728 [DEBUG] (2) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_SEMICOLON, value: Repeat }
08:24:01.9735 [DEBUG] (2) kanata_state_machine::kanata::key_repeat: key outs for active layer-while-held: [KEY_LEFTSHIFT, KEY_SEMICOLON];
08:24:01.9741 [DEBUG] (2) kanata_state_machine::kanata::key_repeat: key outs for active layer-while-held: [KEY_BACKSPACE, KEY_RIGHTCTRL, KEY_LEFTSHIFT, KEY_SEMICOLON];
08:24:01.9748 [DEBUG] (2) kanata_state_machine::kanata::key_repeat: repeat    RCtrl
08:24:01.9793 [DEBUG] (1) kanata_state_machine::kanata::windows::llhook: event loop: KeyEvent { code: KEY_H, value: Press }
08:24:01.9801 [DEBUG] (2) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_H, value: Press }
08:24:02.0410 [DEBUG] (2) kanata_state_machine::kanata: key release   RCtrl
08:24:02.0422 [DEBUG] (2) kanata_state_machine::kanata: key press     Left
08:24:02.1334 [DEBUG] (1) kanata_state_machine::kanata::windows::llhook: event loop: KeyEvent { code: KEY_H, value: Release }
08:24:02.1350 [DEBUG] (2) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_H, value: Release }
08:24:02.1355 [DEBUG] (2) kanata_state_machine::kanata: key release   Left
08:24:02.4340 [DEBUG] (1) kanata_state_machine::kanata::windows::llhook: event loop: KeyEvent { code: KEY_H, value: Press }
08:24:02.4349 [DEBUG] (2) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_H, value: Press }
08:24:02.4965 [DEBUG] (2) kanata_state_machine::kanata: key press     Left
08:24:02.5495 [DEBUG] (1) kanata_state_machine::kanata::windows::llhook: event loop: KeyEvent { code: KEY_H, value: Release }
08:24:02.5503 [DEBUG] (2) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_H, value: Release }
08:24:02.5507 [DEBUG] (2) kanata_state_machine::kanata: key release   Left
08:24:02.8322 [DEBUG] (1) kanata_state_machine::kanata::windows::llhook: event loop: KeyEvent { code: KEY_H, value: Press }
08:24:02.8342 [DEBUG] (2) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_H, value: Press }
08:24:02.8952 [DEBUG] (2) kanata_state_machine::kanata: key press     Left
08:24:02.9678 [DEBUG] (1) kanata_state_machine::kanata::windows::llhook: event loop: KeyEvent { code: KEY_H, value: Release }
08:24:02.9695 [DEBUG] (2) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_H, value: Release }
08:24:02.9699 [DEBUG] (2) kanata_state_machine::kanata: key release   Left
08:24:03.4541 [DEBUG] (1) kanata_state_machine::kanata::windows::llhook: event loop: KeyEvent { code: KEY_L, value: Press }
08:24:03.4552 [DEBUG] (2) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_L, value: Press }
08:24:03.5168 [DEBUG] (2) kanata_state_machine::kanata: key press     Right
08:24:03.5928 [DEBUG] (1) kanata_state_machine::kanata::windows::llhook: event loop: KeyEvent { code: KEY_L, value: Release }
08:24:03.5940 [DEBUG] (2) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_L, value: Release }
08:24:03.5944 [DEBUG] (2) kanata_state_machine::kanata: key release   Right
08:24:03.8146 [DEBUG] (1) kanata_state_machine::kanata::windows::llhook: event loop: KeyEvent { code: KEY_L, value: Press }
08:24:03.8162 [DEBUG] (2) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_L, value: Press }
08:24:03.8772 [DEBUG] (2) kanata_state_machine::kanata: key press     Right
08:24:03.9001 [DEBUG] (1) kanata_state_machine::kanata::windows::llhook: event loop: KeyEvent { code: KEY_L, value: Release }
08:24:03.9009 [DEBUG] (2) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_L, value: Release }
08:24:03.9012 [DEBUG] (2) kanata_state_machine::kanata: key release   Right
08:24:04.1497 [DEBUG] (1) kanata_state_machine::kanata::windows::llhook: event loop: KeyEvent { code: KEY_L, value: Press }
08:24:04.1517 [DEBUG] (2) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_L, value: Press }
08:24:04.2123 [DEBUG] (2) kanata_state_machine::kanata: key press     Right
08:24:04.2586 [DEBUG] (1) kanata_state_machine::kanata::windows::llhook: event loop: KeyEvent { code: KEY_L, value: Release }
08:24:04.2600 [DEBUG] (2) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_L, value: Release }
08:24:04.2605 [DEBUG] (2) kanata_state_machine::kanata: key release   Right
08:24:04.3852 [DEBUG] (1) kanata_state_machine::kanata::windows::llhook: event loop: KeyEvent { code: KEY_SEMICOLON, value: Release }
08:24:04.3867 [DEBUG] (2) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_SEMICOLON, value: Release }
08:24:04.4417 [DEBUG] (1) kanata_state_machine::kanata::windows::llhook: event loop: KeyEvent { code: KEY_A, value: Release }
08:24:04.4432 [DEBUG] (2) kanata_state_machine::kanata: process recv ev KeyEvent { code: KEY_A, value: Release }
08:24:04.4437 [DEBUG] (2) kanata_state_machine::kanata: key release   LCtrl

@jtroo
Copy link
Owner

jtroo commented Jun 11, 2024

My guess was correct; you should use either the winiov2 or the send scancodes variant.

Or if compiling from source, use --features win_sendinput_send_scancodes or win_sendinput_send_scancodes,win_llhook_read_scancodes.

@jtroo jtroo added windows Issue pertains to Windows only by-design/obsolete llhook Pertains to the standard version of Kanata on Windows labels Jun 11, 2024
@jtroo
Copy link
Owner

jtroo commented Jun 11, 2024

Closing since SendInput vkey output has known issues+workarounds. But happy to reopen if I'm mistaken about the problem and solution.

@jtroo jtroo closed this as not planned Won't fix, can't repro, duplicate, stale Jun 11, 2024
@newsve
Copy link
Author

newsve commented Jun 11, 2024

Recompiled just with the first flag, --features win_sendinput_send_scancodes, and it works like a charm, thanks! 😊

@newsve
Copy link
Author

newsve commented Jun 11, 2024

Stupid question but what about making this feature flag the default or is it too experimental?

@jtroo
Copy link
Owner

jtroo commented Jun 11, 2024

A PR is already open for this 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working by-design/obsolete llhook Pertains to the standard version of Kanata on Windows windows Issue pertains to Windows only
Projects
None yet
Development

No branches or pull requests

2 participants