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

feat(behaviors): &key_repeat behavior + tests. #1034

Merged
merged 2 commits into from
Jan 31, 2022

Conversation

petejohanson
Copy link
Contributor

  • Add new &key_repeat behavior that captures and re-sends
    the most recently triggered keycode.

@petejohanson
Copy link
Contributor Author

Closes #853

@dxmh
Copy link
Collaborator

dxmh commented Nov 29, 2021

Nice @petejohanson!

I have noticed that it doesn't currently repeat keys with modifiers applied:

  • alt+left will only repeat left
  • cmd+space will only repeat space
  • shift+t will only repeat a lowercase t, etc.

However, it does repeat modified keys when modifier functions are used:

  • tap &kp LG(V) and it will repeat cmd+v (paste)
  • hold &kp LGUI, tap &kp V and it will only repeat v
  • tap &sk LGUI, tap &kp V and it will only repeat v

Is this intentional with the current implementation? My initial expectation was that all three of the above scenarios would repeat cmd+v (paste).

@jcmkk3
Copy link

jcmkk3 commented Nov 29, 2021

Nice @petejohanson!

I have noticed that it doesn't currently repeat keys with modifiers applied:

  • alt+left will only repeat left
  • cmd+space will only repeat space
  • shift+t will only repeat a lowercase t, etc.

However, it does repeat modified keys when modifier functions are used:

  • tap &kp LG(V) and it will repeat cmd+v (paste)
  • hold &kp LGUI, tap &kp V and it will only repeat v
  • tap &sk LGUI, tap &kp V and it will only repeat v

Is this intentional with the current implementation? My initial expectation was that all three of the above scenarios would repeat cmd+v (paste).

This is a good callout. I was wondering if it would be applied this way or not. One of the reasons that it has always been desirable is to help repeating some mod-based shortcuts that can be a pain to repeat using callum-style mods or at the very least require planning to know that you're going to repeat it. ctrl-d for multiple cursors or ctrl-s for progressing to the next search candidate in emacs are examples of where I could see using it. I will probably start by putting it on my nav layer, but may later try to incorporate it into the alphas somehow.

@petejohanson
Copy link
Contributor Author

@dxmh @jcmkk3 Please pull the latest and try again. Added code to capture the current mods, along w/ corresponding test case.

* Add new `&key_repeat` behavior that captures and re-sends
  the most recently triggered keycode.

Closes: zmkfirmware#853
* When tracking the last keycode, also capture the currently held
  explicit modifiers to use when replaying the key later.
@petejohanson petejohanson merged commit 52b1fd5 into zmkfirmware:main Jan 31, 2022
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

Successfully merging this pull request may close these issues.

3 participants