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

Layer toggle behind layer hold #665

Closed
lobre opened this issue Feb 9, 2024 · 7 comments
Closed

Layer toggle behind layer hold #665

lobre opened this issue Feb 9, 2024 · 7 comments

Comments

@lobre
Copy link

lobre commented Feb 9, 2024

I am having a hard time trying to accomplish the following.

I have the [main] layer. On this layer, I do have a layer-hold on space which leads me to a [headside] layer. To note that on [main], I also have tab which does not have any mapping assigned, so it regularly inputs a tab character.

On [headside] (while keeping space maintained), I would then like to have the tab key toggling back and forth on tap (and not hold) between another layer [tailside] and this [headside].

And so if at any moment I decide to release space, I should go back to [main] whatever if [headside] or [tailside] was active.

As an example:

  1. From [main] I hold space,
  2. Landed on [headside], I type some keys that are mapped on this layer,
  3. I single tap tab (while keeping space held) which activates [tailside],
  4. I type some keys that are mapped on [tailside],
  5. I single tap tab (while still keeping space held), which re-toggles [headside],
  6. ... <loop from 3 to 5 as long as needed>
  7. I decide to go back to [main] by releasing space.

Do you think such a behavior (mix of hold and tap) is achievable in keyd? Help would be greatly appreciated, and heads up for this awesome project!

@nsbgn
Copy link

nsbgn commented Feb 9, 2024

The following sort-of achieves what you want:

[main]
space = overload(headside, space)

[headside]
tab = swap(tailside)
a = b

[tailside]
tab = swap(headside)
a = c

However, since space is a tricky key to overload, you probably want at least space = overloadt(headside, space, 200) or lettermod(headside, space, 100, 200) instead of plain overload. Unfortunately, swap doesn't seem to work with any of these. @rvaiya, that would be a bug, right?

@lobre
Copy link
Author

lobre commented Feb 9, 2024

Thank you, at first sight, I confirm that this behavior does what I expect.

But I notice the same bug as you. It is fine with overload, but not with overloadt 😐

@lobre
Copy link
Author

lobre commented Feb 13, 2024

I read the code a little bit yesterday, and I have the feeling that overloadt (and overloadt2) should have theoretically the same behavior as overload, apart from the timeout. Am I guessing right @rvaiya?

I could not yet identify where the bug is. I need to dig more but as I am not familiar with the codebase, it is hard for me to catch it for the moment.

@matcls
Copy link

matcls commented Feb 14, 2024

changing this line
from
for (i = 0; i < CACHE_SIZE; i++)
to
for (i < 0; i <= CACHE_SIZE; i++)

makes swap work here.

@lobre
Copy link
Author

lobre commented Feb 20, 2024

@matcls , you mean this instead no?

 for (i = 0; i <= CACHE_SIZE; i++)

If so, do you understand why looping one step further is necessary? I am not sure to exactly grasp what is the purpose of this cache.

@rvaiya
Copy link
Owner

rvaiya commented Feb 21, 2024

Sorry for the slow response, I haven't had much time to triage issues lately. This was indeed a bug and should be fixed in the latest commit.

@lobre
Copy link
Author

lobre commented Feb 21, 2024

No worries, open source does not need reactivity! Thank you a lot for fixing the bug.

I just tested with the commit you introduced, and it effectively resolves my issue 🥳.

I am closing this issue.

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

4 participants