-
Notifications
You must be signed in to change notification settings - Fork 163
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
base: main
Are you sure you want to change the base?
Conversation
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
There was a problem hiding this 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))` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `X`: `if_eq(foo, 1, hold_keys(Y), hold_keys(X))` | |
- `X`: `if_eq($foo, 1, hold_keys(Y), hold_keys(X))` |
- `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))` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `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))` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `X`:`if_eq(foo, 1, hold_keys(Y), hold_keys(X))` | |
- `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))` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `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))` |
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! |
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)).