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

Adds layer implementations to examples.md #804

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

Conversation

ck-tom
Copy link

@ck-tom ck-tom commented Nov 8, 2023

This just adds some examples for people looking to implement switch/toggle/shift layer macros. I'm just doing the documentation, credit to @sezanzeb for actually figuring out how to implement layers (#91 (comment)) and layer toggle (#91 (comment)).

Just added some examples for how to implement QMK like layers. Credit @sezanzeb for figuring out how to do layers (sezanzeb#91 (comment)) and layer toggle (sezanzeb#91 (comment)).
Fix formatting
Fix phrasing
Copy link
Owner

@sezanzeb sezanzeb left a comment

Choose a reason for hiding this comment

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

Thanks a bunch! If I'm not horribly mistaken, if_eq takes the variable name with a $ in front of it, while ifeq is the old deprecated function


- `A`: `set(foo, 0)`
- `B`: `set(foo, 1)`
- `X`: `if_eq(foo, 1, hold_keys(Y), hold_keys(X))`
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
- `X`: `if_eq(foo, 1, hold_keys(Y), hold_keys(X))`
- `X`: `if_eq($foo, 1, hold_keys(Y), hold_keys(X))`

Comment on lines +213 to +216
- `H`:`ifeq(layer, 1, hold_keys(Left), hold_keys(H))`
- `J`:`ifeq(layer, 1, hold_keys(Down), hold_keys(J))`
- `K`:`ifeq(layer, 1, hold_keys(Up), hold_keys(K))`
- `L`:`ifeq(layer, 1, hold_keys(Right), hold_keys(L))`
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
- `H`:`ifeq(layer, 1, hold_keys(Left), hold_keys(H))`
- `J`:`ifeq(layer, 1, hold_keys(Down), hold_keys(J))`
- `K`:`ifeq(layer, 1, hold_keys(Up), hold_keys(K))`
- `L`:`ifeq(layer, 1, hold_keys(Right), hold_keys(L))`
- `H`:`if_eq($layer, 1, hold_keys(Left), hold_keys(H))`
- `J`:`if_eq($layer, 1, hold_keys(Down), hold_keys(J))`
- `K`:`if_eq($layer, 1, hold_keys(Up), hold_keys(K))`
- `L`:`if_eq($layer, 1, hold_keys(Right), hold_keys(L))`

We can create layer-shift macros that will enable the layer only while being held.

- `A`:`set(foo, 1).hold().set(foo, 0)`
- `X`:`if_eq(foo, 1, hold_keys(Y), hold_keys(X))`
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
- `X`:`if_eq(foo, 1, hold_keys(Y), hold_keys(X))`
- `X`:`if_eq($foo, 1, hold_keys(Y), hold_keys(X))`

Comment on lines +195 to +196
- `A`:`if_eq(foo, 1, set(foo, 0), set(foo, 1))`
- `X`:`if_eq(foo, 1, hold_keys(Y), hold_keys(X))`
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
- `A`:`if_eq(foo, 1, set(foo, 0), set(foo, 1))`
- `X`:`if_eq(foo, 1, hold_keys(Y), hold_keys(X))`
- `A`:`if_eq($foo, 1, set(foo, 0), set(foo, 1))`
- `X`:`if_eq($foo, 1, hold_keys(Y), hold_keys(X))`

@Xuerian
Copy link

Xuerian commented Dec 4, 2023

Well, after managing to find this I did finally understand how (or one way) to do layers, which I really needed.

I appreciate both input-remapper and this PR!

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.

None yet

3 participants