aboutsummaryrefslogtreecommitdiff
path: root/docs/feature_leader_key.md
diff options
context:
space:
mode:
authorLeo Wzukw <leowzukw@users.noreply.github.com>2018-05-26 20:29:02 +0200
committerDrashna Jaelre <drashna@live.com>2018-05-26 11:29:02 -0700
commit3b1ddd12a53356196b565235c54d19e45bb17980 (patch)
tree0ae8ce90c3e22257489b16d28220cca514ddf859 /docs/feature_leader_key.md
parent716877b40ae77a7d354ea3a1a1ee5fb03fdb0a32 (diff)
downloadqmk_firmware-3b1ddd12a53356196b565235c54d19e45bb17980.tar.gz
qmk_firmware-3b1ddd12a53356196b565235c54d19e45bb17980.zip
Refresh & improve leader documentation page (#2990)
* Refresh & improve leader documentation page - register_code/unregister_code are not the recommanded way to do macro. - Provide some details I wish I had found when first used the leader functionality. * Add old way to use macro.
Diffstat (limited to 'docs/feature_leader_key.md')
-rw-r--r--docs/feature_leader_key.md18
1 files changed, 11 insertions, 7 deletions
diff --git a/docs/feature_leader_key.md b/docs/feature_leader_key.md
index fb74bf7c8..46633b287 100644
--- a/docs/feature_leader_key.md
+++ b/docs/feature_leader_key.md
@@ -17,14 +17,16 @@ void matrix_scan_user(void) {
17 leader_end(); 17 leader_end();
18 18
19 SEQ_ONE_KEY(KC_F) { 19 SEQ_ONE_KEY(KC_F) {
20 register_code(KC_S); 20 // Anything you can do in a macro.
21 unregister_code(KC_S); 21 SEND_STRING("QMK is awesome.");
22 } 22 }
23 SEQ_TWO_KEYS(KC_A, KC_S) { 23 SEQ_TWO_KEYS(KC_D, KC_D) {
24 register_code(KC_H); 24 SEND_STRING(SS_LCTRL("a")SS_LCTRL("c"));
25 unregister_code(KC_H);
26 } 25 }
27 SEQ_THREE_KEYS(KC_A, KC_S, KC_D) { 26 SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
27 SEND_STRING("https://start.duckduckgo.com"SS_TAP(X_ENTER));
28 }
29 SEQ_TWO_KEYS(KC_A, KC_S) {
28 register_code(KC_LGUI); 30 register_code(KC_LGUI);
29 register_code(KC_S); 31 register_code(KC_S);
30 unregister_code(KC_S); 32 unregister_code(KC_S);
@@ -34,4 +36,6 @@ void matrix_scan_user(void) {
34} 36}
35``` 37```
36 38
37As you can see, you have three function. you can use - `SEQ_ONE_KEY` for single-key sequences (Leader followed by just one key), and `SEQ_TWO_KEYS` and `SEQ_THREE_KEYS` for longer sequences. Each of these accepts one or more keycodes as arguments. This is an important point: You can use keycodes from **any layer on your keyboard**. That layer would need to be active for the leader macro to fire, obviously. 39As you can see, you have a few function. You can use `SEQ_ONE_KEY` for single-key sequences (Leader followed by just one key), and `SEQ_TWO_KEYS`, `SEQ_THREE_KEYS` up to `SEQ_FIVE_KEYS` for longer sequences.
40
41Each of these accepts one or more keycodes as arguments. This is an important point: You can use keycodes from **any layer on your keyboard**. That layer would need to be active for the leader macro to fire, obviously.