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: lock a momentary layer #1984

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

ecstatic-morse
Copy link

@ecstatic-morse ecstatic-morse commented Nov 2, 2023

Resolves #1299.
Resolves #1771.

This adds a momentary layer lock behavior (&molock ) which causes all active momentary layers not to become deactivated on release. If no layers are active, &molock triggers a customizable fallback behavior, which defaults to &to 0.

See the newly added docs for a more complete description.

@ecstatic-morse

This comment was marked as outdated.

@ecstatic-morse ecstatic-morse marked this pull request as ready for review November 6, 2023 22:58
@ecstatic-morse ecstatic-morse requested a review from a team as a code owner November 6, 2023 22:58
@ecstatic-morse
Copy link
Author

ecstatic-morse commented Nov 6, 2023

This PR is now feature complete, so I've marked it as ready for review. It would be nice to allow custom momentary layer lock behaviors to accept an arbitrary arguments, but I didn't see any prior art for that and I'm still not too proficient with devicetree/Zephyr, so for now you need to specify all the arguments when the behavior is defined.

@ecstatic-morse

This comment was marked as resolved.

Copy link
Contributor

@caksoylar caksoylar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from docs POV.

I wasn't sure if a QMK-like dual mode approach where we have "default" layers and regular layers was needed (where such a behavior could convert a layer from normal to default), but this seems to cover the use cases well enough with a simple design.

docs/docs/config/behaviors.md Outdated Show resolved Hide resolved
@ecstatic-morse ecstatic-morse force-pushed the molock branch 2 times, most recently from e8ce540 to f3162a0 Compare February 13, 2024 01:53
Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
@ecstatic-morse
Copy link
Author

ecstatic-morse commented Feb 13, 2024

Thanks @caksoylar. The rebased version seems to be working fine (I've been running it since last night).

I've been using this for a few months now and still find it useful as part of my keymap, mostly for locking the navigation layer. I noticed the old documentation was a bit spartan so I added the example. It would be nice to get it upstreamed, but seeing as I'm the only user that seems a bit premature. Maybe I'll ask around on the Discord to see if anyone else wants to try it out...

@Dom324
Copy link

Dom324 commented May 22, 2024

Any progress on this? :)
Does the layer lock work also with &lt?

@Townk
Copy link

Townk commented Jun 18, 2024

I've been using this feature for some time now, and I think this design is simple, and achieves everything one might need to keep a momentary layer toggled.

BTW, this works with &mo and &lt.

@alternateved
Copy link

Great change. I've also been using this for some time and it really works well.

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.

Feature Request: Layer Lock Key Feature Request: New &df layer behaviour
5 participants