summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2023-02-13 03:19:02 +1100
committerGitHub <noreply@github.com>2023-02-13 03:19:02 +1100
commitbbf7a20b33de2d203518687cb5cd1aa85005ea27 (patch)
treeee1a5c412a02021d085c81a26321c3424eca7022
parentd10350cd2ceb2b9d80522cdec3ea908118f7fd35 (diff)
Refactor Leader key feature (#19632)
Co-authored-by: Drashna Jaelre <drashna@live.com>
-rw-r--r--docs/feature_leader_key.md338
-rw-r--r--keyboards/7c8/framework/keymaps/steven/keymap.c55
-rw-r--r--keyboards/dz60/keymaps/jdelkins/keymap.c86
-rw-r--r--keyboards/dztech/dz65rgb/keymaps/drootz/keymap.c159
-rw-r--r--keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_dictionary.c14
-rw-r--r--keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_setup.c1
-rw-r--r--keyboards/ergodox_ez/keymaps/hacker_dvorak/user/matrix_scan_user.c16
-rw-r--r--keyboards/ergodox_ez/keymaps/stamm/keymap.c52
-rw-r--r--keyboards/handwired/co60/keymaps/jmdaly_hhkb_split_space/keymap.c148
-rw-r--r--keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c22
-rw-r--r--keyboards/ibnuda/squiggle/keymaps/rick-complicated/keymap.c13
-rw-r--r--keyboards/input_club/ergodox_infinity/keymaps/not-quite-neo/keymap.c51
-rw-r--r--keyboards/keebio/iris/keymaps/omgvee/keymap.c3
-rw-r--r--keyboards/keychron/q1/iso/keymaps/victorsavu3/keymap.c110
-rw-r--r--keyboards/kprepublic/bm65hsrgb_iso/keymaps/p4yne/keymap.c35
-rw-r--r--keyboards/kprepublic/bm65hsrgb_iso/rev1/keymaps/deadolus/keymap.c39
-rw-r--r--keyboards/massdrop/alt/keymaps/jdelkins/keymap.c100
-rw-r--r--keyboards/maxr1998/phoebe/keymaps/default/keymap.c19
-rw-r--r--keyboards/mechkeys/mechmini/v2/keymaps/wsturgiss/keymap.c29
-rw-r--r--keyboards/planck/keymaps/copface/keymap.c78
-rw-r--r--keyboards/planck/keymaps/experimental/keymap.c61
-rw-r--r--keyboards/planck/keymaps/jdelkins/keymap.c120
-rw-r--r--keyboards/planck/keymaps/jweickm/keymap.c21
-rw-r--r--keyboards/planck/keymaps/rootiest/keymap.c154
-rw-r--r--keyboards/planck/keymaps/yhaliaw/keymap.c44
-rw-r--r--keyboards/preonic/keymaps/brauner/keymap.c43
-rw-r--r--keyboards/preonic/keymaps/pcurt854/keymap.c193
-rw-r--r--keyboards/preonic/keymaps/yhaliaw/keymap.c44
-rw-r--r--keyboards/signum/3_0/keymaps/sgurenkov/keymap.c70
-rw-r--r--keyboards/splitkb/kyria/keymaps/asapjockey/keymap.c13
-rw-r--r--keyboards/splitkb/kyria/keymaps/cjuniet/keymap.c31
-rw-r--r--keyboards/splitkb/kyria/keymaps/corodiak/keymap.c65
-rw-r--r--keyboards/splitkb/kyria/keymaps/mattir/keymap.c23
-rw-r--r--keyboards/splitkb/kyria/keymaps/mattir2/keymap.c19
-rw-r--r--keyboards/splitkb/kyria/keymaps/plattfot/keymap.c142
-rw-r--r--keyboards/splitkb/kyria/keymaps/thomasbaart/keymap.c94
-rwxr-xr-xkeyboards/tada68/keymaps/laas/keymap.c2
-rw-r--r--quantum/keyboard.c7
-rw-r--r--quantum/leader.c101
-rw-r--r--quantum/leader.h119
-rw-r--r--quantum/process_keycode/process_leader.c77
-rw-r--r--quantum/process_keycode/process_leader.h24
-rw-r--r--quantum/quantum.h1
-rw-r--r--tests/leader/config.h6
-rw-r--r--tests/leader/leader_no_initial_timeout/config.h8
-rw-r--r--tests/leader/leader_no_initial_timeout/test.mk7
-rw-r--r--tests/leader/leader_no_initial_timeout/test_leader_no_initial_timeout.cpp48
-rw-r--r--tests/leader/leader_per_key_timeout/config.h5
-rw-r--r--tests/leader/leader_per_key_timeout/test.mk7
-rw-r--r--tests/leader/leader_per_key_timeout/test_leader_per_key_timeout.cpp40
-rw-r--r--tests/leader/leader_sequences.c26
-rw-r--r--tests/leader/leader_strict_key_processing/config.h8
-rw-r--r--tests/leader/leader_strict_key_processing/test.mk7
-rw-r--r--tests/leader/leader_strict_key_processing/test_leader_strict_key_processing.cpp45
-rw-r--r--tests/leader/test.mk7
-rw-r--r--tests/leader/test_leader.cpp224
-rw-r--r--users/alfrdmalr/alfrdmalr.c16
-rw-r--r--users/arkag/arkag.c257
-rw-r--r--users/curry/leader.c24
-rw-r--r--users/curry/leader_user.c31
-rw-r--r--users/curry/leader_user.h (renamed from users/curry/leader.h)0
-rw-r--r--users/curry/rules.mk2
-rw-r--r--users/danielo515/danielo515.c171
-rw-r--r--users/jjerrell/jjerrell.c65
-rw-r--r--users/kuatsure/kuatsure.c141
-rw-r--r--users/kuchosauronad0/leader.c116
-rw-r--r--users/kuchosauronad0/leader_user.c113
-rw-r--r--users/kuchosauronad0/leader_user.h (renamed from users/kuchosauronad0/leader.h)2
-rw-r--r--users/kuchosauronad0/readme.md4
-rw-r--r--users/kuchosauronad0/rgblight_user.c2
-rw-r--r--users/kuchosauronad0/rules.mk2
-rw-r--r--users/sigma/sigma.c33
-rw-r--r--users/uqs/uqs.c45
-rw-r--r--users/yet-another-developer/leader.c46
-rw-r--r--users/yet-another-developer/leader_user.c41
-rw-r--r--users/yet-another-developer/leader_user.h (renamed from users/yet-another-developer/leader.h)2
-rw-r--r--users/yet-another-developer/rules.mk2
77 files changed, 2439 insertions, 1950 deletions
diff --git a/docs/feature_leader_key.md b/docs/feature_leader_key.md
index d3dc9a56db..72a6818dd1 100644
--- a/docs/feature_leader_key.md
+++ b/docs/feature_leader_key.md
@@ -1,165 +1,297 @@
1# The Leader Key: A New Kind of Modifier 1# The Leader Key: A New Kind of Modifier :id=the-leader-key
2 2
3If you've ever used Vim, you know what a Leader key is. If not, you're about to discover a wonderful concept. :) Instead of hitting Alt+Shift+W for example (holding down three keys at the same time), what if you could hit a _sequence_ of keys instead? So you'd hit our special modifier (the Leader key), followed by W and then C (just a rapid succession of keys), and something would happen. 3If you're a Vim user, you probably know what a Leader key is. In contrast to [Combos](feature_combo.md), the Leader key allows you to hit a *sequence* of up to five keys instead, which triggers some custom functionality once complete.
4 4
5That's what `QK_LEAD` does. Here's an example: 5## Usage :id=usage
6 6
71. Pick a key on your keyboard you want to use as the Leader key. Assign it the keycode `QK_LEAD`. This key would be dedicated just for this -- it's a single action key, can't be used for anything else. 7Add the following to your `rules.mk`:
82. Include the line `#define LEADER_TIMEOUT 300` in your `config.h`. This sets the timeout for the `QK_LEAD` key. Specifically, when you press the `QK_LEAD` key, you only have a certain amount of time to complete the Leader Key sequence. The `300` here sets that to 300ms, and you can increase this value to give you more time to hit the sequence. But any keys pressed during this timeout are intercepted and not sent, so you may want to keep this value low.
9 * By default, this timeout is how long after pressing `QK_LEAD` to complete your entire sequence. This may be very low for some people. So you may want to increase this timeout. Optionally, you may want to enable the `LEADER_PER_KEY_TIMING` option, which resets the timeout after each key is tapped. This allows you to maintain a low value here, but still be able to use the longer sequences. To enable this option, add `#define LEADER_PER_KEY_TIMING` to your `config.h`.
103. Within your `matrix_scan_user` function, add something like this:
11 8
12```c 9```make
13LEADER_EXTERNS(); 10LEADER_ENABLE = yes
14
15void matrix_scan_user(void) {
16 LEADER_DICTIONARY() {
17 leading = false;
18 leader_end();
19
20 SEQ_ONE_KEY(KC_F) {
21 // Anything you can do in a macro.
22 SEND_STRING("QMK is awesome.");
23 }
24 SEQ_TWO_KEYS(KC_D, KC_D) {
25 SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
26 }
27 SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
28 SEND_STRING("https://start.duckduckgo.com\n");
29 }
30 SEQ_TWO_KEYS(KC_A, KC_S) {
31 register_code(KC_LGUI);
32 register_code(KC_S);
33 unregister_code(KC_S);
34 unregister_code(KC_LGUI);
35 }
36 }
37}
38``` 11```
39 12
40As you can see, you have a few functions. 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. 13Then add the `QK_LEAD` keycode to your keymap.
41 14
42Each 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. 15## Callbacks :id=callbacks
43 16
44## Adding Leader Key Support 17These callbacks are invoked when the leader sequence begins and ends. In the latter you can implement your custom functionality based on the contents of the sequence buffer.
45 18
46To enable Leader Key, add the following line to your keymap's `rules.mk`: 19```c
20void leader_start_user(void) {
21 // Do something when the leader key is pressed
22}
47 23
48```make 24void leader_end_user(void) {
49LEADER_ENABLE = yes 25 if (leader_sequence_one_key(KC_F)) {
26 // Leader, f => Types the below string
27 SEND_STRING("QMK is awesome.");
28 } else if (leader_sequence_two_keys(KC_D, KC_D)) {
29 // Leader, d, d => Ctrl+A, Ctrl+C
30 SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
31 } else if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
32 // Leader, d, d, s => Types the below string
33 SEND_STRING("https://start.duckduckgo.com\n");
34 } else if (leader_sequence_two_keys(KC_A, KC_S)) {
35 // Leader, a, s => GUI+S
36 tap_code16(LGUI(KC_S));
37 }
38}
50``` 39```
51 40
52Place the following macro in your `keymap.c` or user space source file, before any functional code. It handles declaration of external variables that will be referenced by Leader Key codes that follows: 41## Basic Configuration :id=basic-configuration
42
43### Timeout :id=timeout
44
45This is the amount of time you have to complete a sequence once the leader key has been pressed. The default value is 300 milliseconds, but you can change this by adding the following to your `config.h`:
53 46
54```c 47```c
55LEADER_EXTERNS(); 48#define LEADER_TIMEOUT 350
56``` 49```
57 50
58## Per Key Timing on Leader keys 51### Per-Key Timeout :id=per-key-timeout
59 52
60Rather than relying on an incredibly high timeout for long leader key strings or those of us without 200wpm typing skills, we can enable per key timing to ensure that each key pressed provides us with more time to finish our stroke. This is incredibly helpful with leader key emulation of tap dance (read: multiple taps of the same key like C, C, C). 53Rather than relying on an incredibly high timeout for long leader key strings or those of us without 200 wpm typing skills, you can enable per-key timing to ensure that each key pressed provides you with more time to finish the sequence. This is incredibly helpful with leader key emulation of tap dance (such as multiple taps of the same key like C, C, C).
54
55To enable this, add the following to your `config.h`:
61 56
62In order to enable this, place this in your `config.h`:
63```c 57```c
64#define LEADER_PER_KEY_TIMING 58#define LEADER_PER_KEY_TIMING
65``` 59```
66 60
67After this, it's recommended that you lower your `LEADER_TIMEOUT` to something less that 300ms. 61After this, it's recommended that you lower your timeout below 300 ms:
68 62
69```c 63```c
70#define LEADER_TIMEOUT 250 64#define LEADER_TIMEOUT 250
71``` 65```
72 66
73Now, something like this won't seem impossible to do without a 1000MS leader key timeout: 67Now, something like this won't seem impossible to do without a 1000 millisecond timeout:
74 68
75```c 69```c
76SEQ_THREE_KEYS(KC_C, KC_C, KC_C) { 70if (leader_sequence_three_keys(KC_C, KC_C, KC_C)) {
77 SEND_STRING("Per key timing is great!!!"); 71 SEND_STRING("Per key timing is great!!!");
78} 72}
79``` 73```
80 74
81## Infinite Leader key timeout 75### Disabling Initial Timeout :id=disabling-initial-timeout
76
77Sometimes your leader key may be too far away from the rest of the keys in the sequence. Imagine that your leader key is one of your outer top right keys - you may need to reposition your hand just to reach your leader key. This can make typing the entire sequence on time hard difficult if you are able to type most of the sequence fast. For example, if your sequence is `Leader + asd`, typing `asd` fast is very easy once you have your hands in your home row, but starting the sequence in time after moving your hand out of the home row to reach the leader key and back is not.
82 78
83Sometimes your leader key is not on a comfortable place as the rest of keys on your sequence. Imagine that your leader key is one of your outer top right keys, you may need to reposition your hand just to reach your leader key. 79To remove the stress this situation produces to your hands, you can disable the timeout just for the leader key. Add the following to your `config.h`:
84This can make typing the entire sequence on time hard even if you are able to type most of the sequence fast. For example, if your sequence is `Leader + asd` typing `asd` fast is very easy once you have your hands in your home row. However starting the sequence in time after moving your hand out of the home row to reach the leader key and back is not.
85To remove the stress this situation produces to your hands you can enable an infinite timeout just for the leader key. This means that after you hit the leader key you will have an infinite amount of time to start the rest of the sequence, allowing you to proper position your hands on the best position to type the rest of the sequence comfortably.
86This infinite timeout only affects the leader key, so in our previous example of `Leader + asd` you will have an infinite amount of time between `Leader` and `a`, but once you start the sequence the timeout you have configured (global or per key) will work normally.
87This way you can configure a very short `LEADER_TIMEOUT` but still have plenty of time to position your hands.
88 80
89In order to enable this, place this in your `config.h`:
90```c 81```c
91#define LEADER_NO_TIMEOUT 82#define LEADER_NO_TIMEOUT
92``` 83```
93 84
94## Strict Key Processing 85Now, after you hit the leader key, you will have an infinite amount of time to start the rest of the sequence, allowing you to properly position your hands to type the rest of the sequence comfortably. This way you can configure a very short `LEADER_TIMEOUT`, but still have plenty of time to position your hands.
95
96By default, the Leader Key feature will filter the keycode out of [`Mod-Tap`](mod_tap.md) and [`Layer Tap`](feature_layers.md#switching-and-toggling-layers) functions when checking for the Leader sequences. That means if you're using `LT(3, KC_A)`, it will pick this up as `KC_A` for the sequence, rather than `LT(3, KC_A)`, giving a more expected behavior for newer users.
97 86
98While, this may be fine for most, if you want to specify the whole keycode (eg, `LT(3, KC_A)` from the example above) in the sequence, you can enable this by adding `#define LEADER_KEY_STRICT_KEY_PROCESSING` to your `config.h` file. This will then disable the filtering, and you'll need to specify the whole keycode. 87### Strict Key Processing :id=strict-key-processing
99 88
100## Customization 89By default, only the "tap keycode" portions of [Mod-Taps](mod_tap.md) and [Layer Taps](feature_layers.md#switching-and-toggling-layers) are added to the sequence buffer. This means if you press eg. `LT(3, KC_A)` as part of a sequence, `KC_A` will be added to the buffer, rather than the entire `LT(3, KC_A)` keycode.
101 90
102The Leader Key feature has some additional customization to how the Leader Key feature works. It has two functions that can be called at certain parts of the process. Namely `leader_start_user()` and `leader_end_user()`. 91This gives a more expected behaviour for most users, however you may want to change this.
103 92
104The `leader_start_user()` function is called when you tap the `QK_LEAD` key, and the `leader_end_user()` function is called when either the leader sequence is completed, or the leader timeout is hit. 93To enable this, add the following to your `config.h`:
105
106You can add these functions to your code (`keymap.c` usually) to add feedback to the Leader sequences (such as beeping or playing music).
107 94
108```c 95```c
109void leader_start_user(void) { 96#define LEADER_KEY_STRICT_KEY_PROCESSING
110 // sequence started
111}
112
113void leader_end_user(void) {
114 // sequence ended (no success/failure detection)
115}
116``` 97```
117 98
118### Example 99## Example :id=example
119 100
120This example will play the Mario "One Up" sound when you hit `QK_LEAD` to start the Leader Sequence, and will play "All Star" if it completes successfully or "Rick Roll" you if it fails. 101This example will play the Mario "One Up" sound when you hit `QK_LEAD` to start the leader sequence. When the sequence ends, it will play "All Star" if it completes successfully or "Rick Roll" you if it fails (in other words, no sequence matched).
121 102
122```c 103```c
123bool did_leader_succeed;
124#ifdef AUDIO_ENABLE 104#ifdef AUDIO_ENABLE
125float leader_start[][2] = SONG(ONE_UP_SOUND ); 105float leader_start_song[][2] = SONG(ONE_UP_SOUND);
126float leader_succeed[][2] = SONG(ALL_STAR); 106float leader_succeed_song[][2] = SONG(ALL_STAR);
127float leader_fail[][2] = SONG(RICK_ROLL); 107float leader_fail_song[][2] = SONG(RICK_ROLL);
128#endif 108#endif
129LEADER_EXTERNS();
130
131void matrix_scan_user(void) {
132 LEADER_DICTIONARY() {
133 did_leader_succeed = leading = false;
134
135 SEQ_ONE_KEY(KC_E) {
136 // Anything you can do in a macro.
137 SEND_STRING(SS_LCTL(SS_LSFT("t")));
138 did_leader_succeed = true;
139 } else
140 SEQ_TWO_KEYS(KC_E, KC_D) {
141 SEND_STRING(SS_LGUI("r") "cmd\n" SS_LCTL("c"));
142 did_leader_succeed = true;
143 }
144 leader_end();
145 }
146}
147 109
148void leader_start_user(void) { 110void leader_start_user(void) {
149#ifdef AUDIO_ENABLE 111#ifdef AUDIO_ENABLE
150 PLAY_SONG(leader_start); 112 PLAY_SONG(leader_start_song);
151#endif 113#endif
152} 114}
153 115
154void leader_end_user(void) { 116void leader_end_user(void) {
155 if (did_leader_succeed) { 117 bool did_leader_succeed = false;
156#ifdef AUDIO_ENABLE 118
157 PLAY_SONG(leader_succeed); 119 if (leader_sequence_one_key(KC_E)) {
158#endif 120 SEND_STRING(SS_LCTL(SS_LSFT("t")));
159 } else { 121 did_leader_succeed = true;
122 } else if (leader_sequence_two_keys(KC_E, KC_D)) {
123 SEND_STRING(SS_LGUI("r") "cmd\n" SS_LCTL("c"));
124 did_leader_succeed = true;
125 }
126
160#ifdef AUDIO_ENABLE 127#ifdef AUDIO_ENABLE
161 PLAY_SONG(leader_fail); 128 if (did_leader_succeed) {
129 PLAY_SONG(leader_succeed_song);
130 } else {
131 PLAY_SONG(leader_fail_song);
132 }
162#endif 133#endif
163 }
164} 134}
165``` 135```
136
137## Keycodes :id=keycodes
138
139|Key |Aliases |Description |
140|-----------------------|---------|-------------------------|
141|`QK_LEADER` |`QK_LEAD`|Begin the leader sequence|
142
143## API :id=api
144
145### `void leader_start_user(void)` :id=api-leader-start-user
146
147User callback, invoked when the leader sequence begins.
148
149---
150
151### `void leader_end_user(void)` :id=api-leader-end-user
152
153User callback, invoked when the leader sequence ends.
154
155---
156
157### `void leader_start(void)` :id=api-leader-start
158
159Begin the leader sequence, resetting the buffer and timer.
160
161---
162
163### `void leader_end(void)` :id=api-leader-end
164
165End the leader sequence.
166
167---
168
169### `bool leader_sequence_active(void)` :id=api-leader-sequence-active
170
171Whether the leader sequence is active.
172
173---
174
175### `bool leader_sequence_add(uint16_t keycode)` :id=api-leader-sequence-add
176
177Add the given keycode to the sequence buffer.
178
179If `LEADER_NO_TIMEOUT` is defined, the timer is reset if the buffer is empty.
180
181#### Arguments :id=api-leader-sequence-add-arguments
182
183 - `uint16_t keycode`
184 The keycode to add.
185
186#### Return Value :id=api-leader-sequence-add-return
187
188`true` if the keycode was added, `false` if the buffer is full.
189
190---
191
192### `bool leader_sequence_timed_out(void)` :id=api-leader-sequence-timed-out
193
194Whether the leader sequence has reached the timeout.
195
196If `LEADER_NO_TIMEOUT` is defined, the buffer must also contain at least one key.
197
198---
199
200### `bool leader_reset_timer(void)` :id=api-leader-reset-timer
201
202Reset the leader sequence timer.
203
204---
205
206### `bool leader_sequence_one_key(uint16_t kc)` :id=api-leader-sequence-one-key
207
208Check the sequence buffer for the given keycode.
209
210#### Arguments :id=api-leader-sequence-one-key-arguments
211
212 - `uint16_t kc`
213 The keycode to check.
214
215#### Return Value :id=api-leader-sequence-one-key-return
216
217`true` if the sequence buffer matches.
218
219---
220
221### `bool leader_sequence_two_keys(uint16_t kc1, uint16_t kc2)` :id=api-leader-sequence-two-keys
222
223Check the sequence buffer for the given keycodes.
224
225#### Arguments :id=api-leader-sequence-two-keys-arguments
226
227 - `uint16_t kc1`
228 The first keycode to check.
229 - `uint16_t kc2`
230 The second keycode to check.
231
232#### Return Value :id=api-leader-sequence-two-keys-return
233
234`true` if the sequence buffer matches.
235
236---
237
238### `bool leader_sequence_three_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3)` :id=api-leader-sequence-three-keys
239
240Check the sequence buffer for the given keycodes.
241
242#### Arguments :id=api-leader-sequence-three-keys-arguments
243
244 - `uint16_t kc1`
245 The first keycode to check.
246 - `uint16_t kc2`
247 The second keycode to check.
248 - `uint16_t kc3`
249 The third keycode to check.
250
251#### Return Value :id=api-leader-sequence-three-keys-return
252
253`true` if the sequence buffer matches.
254
255---
256
257### `bool leader_sequence_four_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3, uint16_t kc4)` :id=api-leader-sequence-four-keys
258
259Check the sequence buffer for the given keycodes.
260
261#### Arguments :id=api-leader-sequence-four-keys-arguments
262
263 - `uint16_t kc1`
264 The first keycode to check.
265 - `uint16_t kc2`
266 The second keycode to check.
267 - `uint16_t kc3`
268 The third keycode to check.
269 - `uint16_t kc4`
270 The fourth keycode to check.
271
272#### Return Value :id=api-leader-sequence-four-keys-return
273
274`true` if the sequence buffer matches.
275
276---
277
278### `bool leader_sequence_five_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3, uint16_t kc4, uint16_t kc5)` :id=api-leader-sequence-five-keys
279
280Check the sequence buffer for the given keycodes.
281
282#### Arguments :id=api-leader-sequence-five-keys-arguments
283
284 - `uint16_t kc1`
285 The first keycode to check.
286 - `uint16_t kc2`
287 The second keycode to check.
288 - `uint16_t kc3`
289 The third keycode to check.
290 - `uint16_t kc4`
291 The fourth keycode to check.
292 - `uint16_t kc5`
293 The fifth keycode to check.
294
295#### Return Value :id=api-leader-sequence-five-keys-return
296
297`true` if the sequence buffer matches.
diff --git a/keyboards/7c8/framework/keymaps/steven/keymap.c b/keyboards/7c8/framework/keymaps/steven/keymap.c
index f39be10c2d..5cba63e0fa 100644
--- a/keyboards/7c8/framework/keymaps/steven/keymap.c
+++ b/keyboards/7c8/framework/keymaps/steven/keymap.c
@@ -78,42 +78,35 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
78) 78)
79}; 79};
80 80
81LEADER_EXTERNS(); 81void leader_end_user(void) {
82 82 // qq, alt+f4 close window
83void matrix_scan_user(void) { 83 if (leader_sequence_two_keys(KC_Q, KC_Q)) {
84 LEADER_DICTIONARY() { 84 tap_code16(A(KC_F4));
85 leading = false; 85 }
86 leader_end();
87
88 // qq, alt+f4 close window
89 SEQ_TWO_KEYS(KC_Q, KC_Q) {
90 tap_code16(A(KC_F4));
91 }
92 86
93 // ee, open explorer 87 // ee, open explorer
94 SEQ_TWO_KEYS(KC_E, KC_E) { 88 if (leader_sequence_two_keys(KC_E, KC_E)) {
95 tap_code16(G(KC_E)); 89 tap_code16(G(KC_E));
96 } 90 }
97 91
98 // rr, windows run prompt 92 // rr, windows run prompt
99 SEQ_TWO_KEYS(KC_R, KC_R) { 93 if (leader_sequence_two_keys(KC_R, KC_R)) {
100 tap_code16(G(KC_R)); 94 tap_code16(G(KC_R));
101 } 95 }
102 96
103 // ww, maximize window 97 // ww, maximize window
104 SEQ_TWO_KEYS(KC_W, KC_W) { 98 if (leader_sequence_two_keys(KC_W, KC_W)) {
105 tap_code16(G(KC_UP)); 99 tap_code16(G(KC_UP));
106 } 100 }
107 101
108 // ss, minimize window 102 // ss, minimize window
109 SEQ_TWO_KEYS(KC_S, KC_S) { 103 if (leader_sequence_two_keys(KC_S, KC_S)) {
110 tap_code16(G(KC_DOWN)); 104 tap_code16(G(KC_DOWN));
111 } 105 }
112 106
113 // <space><space>, toggle desktop 107 // <space><space>, toggle desktop
114 SEQ_TWO_KEYS(KC_SPC, KC_SPC) { 108 if (leader_sequence_two_keys(KC_SPC, KC_SPC)) {
115 tap_code16(G(KC_D)); 109 tap_code16(G(KC_D));
116 }
117 } 110 }
118} 111}
119 112
diff --git a/keyboards/dz60/keymaps/jdelkins/keymap.c b/keyboards/dz60/keymaps/jdelkins/keymap.c
index 5555a0113f..2a989fe545 100644
--- a/keyboards/dz60/keymaps/jdelkins/keymap.c
+++ b/keyboards/dz60/keymaps/jdelkins/keymap.c
@@ -229,7 +229,47 @@ void keyboard_post_init_keymap(void) {
229 bspc_timer = 0; 229 bspc_timer = 0;
230} 230}
231 231
232LEADER_EXTERNS(); 232void leader_end_user(void) {
233 // layer navigation
234 if (leader_sequence_one_key(KC_R)) { layer_invert(_RPT); }
235 if (leader_sequence_one_key(KC_G)) { layer_invert(_GAME); }
236 if (leader_sequence_one_key(KC_K)) { layer_invert(_KP); }
237 if (leader_sequence_one_key(KC_KP_5)) { layer_invert(_KP); }
238
239 // tmux navigation
240 if (leader_sequence_one_key(KC_L)) { SEND_STRING(SS_LCTL("a") "n"); }
241 if (leader_sequence_one_key(KC_H)) { SEND_STRING(SS_LCTL("a") "p"); }
242 if (leader_sequence_one_key(KC_N)) { SEND_STRING(SS_LCTL("a") "c"); }
243 if (leader_sequence_one_key(KC_W)) { SEND_STRING(SS_LCTL("a") "x"); }
244 if (leader_sequence_one_key(KC_MINS)) { SEND_STRING(SS_LCTL("a") "-"); }
245 if (leader_sequence_one_key(KC_QUOT)) { SEND_STRING(SS_LCTL("a") "\""); }
246 if (leader_sequence_one_key(KC_1)) { SEND_STRING(SS_LCTL("a") "1"); }
247 if (leader_sequence_one_key(KC_2)) { SEND_STRING(SS_LCTL("a") "2"); }
248 if (leader_sequence_one_key(KC_3)) { SEND_STRING(SS_LCTL("a") "3"); }
249 if (leader_sequence_one_key(KC_4)) { SEND_STRING(SS_LCTL("a") "4"); }
250 if (leader_sequence_one_key(KC_5)) { SEND_STRING(SS_LCTL("a") "5"); }
251 if (leader_sequence_one_key(KC_6)) { SEND_STRING(SS_LCTL("a") "6"); }
252 if (leader_sequence_one_key(KC_7)) { SEND_STRING(SS_LCTL("a") "7"); }
253 if (leader_sequence_one_key(KC_8)) { SEND_STRING(SS_LCTL("a") "8"); }
254 if (leader_sequence_one_key(KC_9)) { SEND_STRING(SS_LCTL("a") "9"); }
255
256 // secrets
257 if (leader_sequence_two_keys(KC_SCLN, KC_M)) { send_secret_string(0); }
258 if (leader_sequence_two_keys(KC_SCLN, KC_COMM)) { send_secret_string(1); }
259 if (leader_sequence_two_keys(KC_SCLN, KC_DOT)) { send_secret_string(2); }
260 if (leader_sequence_two_keys(KC_SCLN, KC_J)) { send_secret_string(3); }
261 if (leader_sequence_two_keys(KC_SCLN, KC_K)) { send_secret_string(4); }
262 if (leader_sequence_two_keys(KC_SCLN, KC_L)) { send_secret_string(5); }
263
264 // fast control-C
265 if (leader_sequence_one_key(KC_C)) { tap_code16(C(KC_C)); }
266
267 // neovim: terminal escape
268 if (leader_sequence_one_key(KC_BSLS)) {
269 tap_code16(C(KC_BSLS));
270 tap_code16(C(KC_N));
271 }
272}
233 273
234void matrix_scan_keymap(void) { 274void matrix_scan_keymap(void) {
235 if (rgblight_is_enabled() && timer_elapsed(rgb_timer) > 1000) { 275 if (rgblight_is_enabled() && timer_elapsed(rgb_timer) > 1000) {
@@ -248,50 +288,6 @@ void matrix_scan_keymap(void) {
248 bspc_timer = 0; 288 bspc_timer = 0;
249 register_code(KC_BSPC); 289 register_code(KC_BSPC);
250 } 290 }
251 LEADER_DICTIONARY() {
252 leading = false;
253 leader_end();
254
255 // layer navigation
256 SEQ_ONE_KEY(KC_R) { layer_invert(_RPT); }
257 SEQ_ONE_KEY(KC_G) { layer_invert(_GAME); }
258 SEQ_ONE_KEY(KC_K) { layer_invert(_KP); }
259 SEQ_ONE_KEY(KC_KP_5) { layer_invert(_KP); }
260
261 // tmux navigation
262 SEQ_ONE_KEY(KC_L) { SEND_STRING(SS_LCTL("a") "n"); }
263 SEQ_ONE_KEY(KC_H) { SEND_STRING(SS_LCTL("a") "p"); }
264 SEQ_ONE_KEY(KC_N) { SEND_STRING(SS_LCTL("a") "c"); }
265 SEQ_ONE_KEY(KC_W) { SEND_STRING(SS_LCTL("a") "x"); }
266 SEQ_ONE_KEY(KC_MINS) { SEND_STRING(SS_LCTL("a") "-"); }
267 SEQ_ONE_KEY(KC_QUOT) { SEND_STRING(SS_LCTL("a") "\""); }
268 SEQ_ONE_KEY(KC_1) { SEND_STRING(SS_LCTL("a") "1"); }
269 SEQ_ONE_KEY(KC_2) { SEND_STRING(SS_LCTL("a") "2"); }
270 SEQ_ONE_KEY(KC_3) { SEND_STRING(SS_LCTL("a") "3"); }
271 SEQ_ONE_KEY(KC_4) { SEND_STRING(SS_LCTL("a") "4"); }
272 SEQ_ONE_KEY(KC_5) { SEND_STRING(SS_LCTL("a") "5"); }
273 SEQ_ONE_KEY(KC_6) { SEND_STRING(SS_LCTL("a") "6"); }
274 SEQ_ONE_KEY(KC_7) { SEND_STRING(SS_LCTL("a") "7"); }
275 SEQ_ONE_KEY(KC_8) { SEND_STRING(SS_LCTL("a") "8"); }
276 SEQ_ONE_KEY(KC_9) { SEND_STRING(SS_LCTL("a") "9"); }
277
278 // secrets
279 SEQ_TWO_KEYS(KC_SCLN, KC_M) { send_secret_string(0); }
280 SEQ_TWO_KEYS(KC_SCLN, KC_COMM) { send_secret_string(1); }
281 SEQ_TWO_KEYS(KC_SCLN, KC_DOT) { send_secret_string(2); }
282 SEQ_TWO_KEYS(KC_SCLN, KC_J) { send_secret_string(3); }
283 SEQ_TWO_KEYS(KC_SCLN, KC_K) { send_secret_string(4); }
284 SEQ_TWO_KEYS(KC_SCLN, KC_L) { send_secret_string(5); }
285
286 // fast control-C
287 SEQ_ONE_KEY(KC_C) { tap_code16(C(KC_C)); }
288
289 // neovim: terminal escape
290 SEQ_ONE_KEY(KC_BSLS) {
291 tap_code16(C(KC_BSLS));
292 tap_code16(C(KC_N));
293 }
294 }
295} 291}
296 292
297bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { 293bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
diff --git a/keyboards/dztech/dz65rgb/keymaps/drootz/keymap.c b/keyboards/dztech/dz65rgb/keymaps/drootz/keymap.c
index f98873f3df..3870c6aae3 100644
--- a/keyboards/dztech/dz65rgb/keymaps/drootz/keymap.c
+++ b/keyboards/dztech/dz65rgb/keymaps/drootz/keymap.c
@@ -418,54 +418,52 @@ void ldrkey_send_curlybrace_wrap_selection(void) {
418 onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_X)) "{}" SS_TAP(X_LEFT) SS_LGUI(SS_TAP(X_V)) SS_TAP(X_RIGHT)) : SEND_STRING(SS_LCTL(SS_TAP(X_X)) "{}" SS_TAP(X_LEFT) SS_LCTL(SS_TAP(X_V)) SS_TAP(X_RIGHT)); 418 onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_X)) "{}" SS_TAP(X_LEFT) SS_LGUI(SS_TAP(X_V)) SS_TAP(X_RIGHT)) : SEND_STRING(SS_LCTL(SS_TAP(X_X)) "{}" SS_TAP(X_LEFT) SS_LCTL(SS_TAP(X_V)) SS_TAP(X_RIGHT));
419} 419}
420 420
421LEADER_EXTERNS(); 421void leader_start_user(void) {
422 isLeader = true;
423}
422 424
423void matrix_scan_user(void) 425void leader_end_user(void) {
424{ 426 isLeader = false;
425 LEADER_DICTIONARY()
426 {
427 leading = false;
428 leader_end();
429 427
430 /* Sequences on layer _MAIN & _MAC */ 428 /* Sequences on layer _MAIN & _MAC */
431 /* éÉ => LdrKey > / */ 429 /* éÉ => LdrKey > / */
432 SEQ_ONE_KEY(KC_SLSH) { 430 if (leader_sequence_one_key(KC_SLSH)) {
433 send_french_accent(_E, _ACUTE); 431 send_french_accent(_E, _ACUTE);
434 } 432 }
435 /* àÀ => LdrKey > A */ 433 /* àÀ => LdrKey > A */
436 SEQ_ONE_KEY(KC_A) { 434 if (leader_sequence_one_key(KC_A)) {
437 send_french_accent(_A, _GRAVE); 435 send_french_accent(_A, _GRAVE);
438 } 436 }
439 /* èÈ => LdrKey > E */ 437 /* èÈ => LdrKey > E */
440 SEQ_ONE_KEY(KC_E) { 438 if (leader_sequence_one_key(KC_E)) {
441 send_french_accent(_E, _GRAVE); 439 send_french_accent(_E, _GRAVE);
442 } 440 }
443 /* ùÙ => LdrKey > U */ 441 /* ùÙ => LdrKey > U */
444 SEQ_ONE_KEY(KC_U) { 442 if (leader_sequence_one_key(KC_U)) {
445 send_french_accent(_U, _GRAVE); 443 send_french_accent(_U, _GRAVE);
446 } 444 }
447 /* â => LdrKey > A > A */ 445 /* â => LdrKey > A > A */
448 SEQ_TWO_KEYS(KC_A, KC_A) { 446 if (leader_sequence_two_keys(KC_A, KC_A)) {
449 send_french_accent(_A, _CIRCUMFLEX); 447 send_french_accent(_A, _CIRCUMFLEX);
450 } 448 }
451 /* êÊ => LdrKey > E > E */ 449 /* êÊ => LdrKey > E > E */
452 SEQ_TWO_KEYS(KC_E, KC_E) { 450 if (leader_sequence_two_keys(KC_E, KC_E)) {
453 send_french_accent(_E, _CIRCUMFLEX); 451 send_french_accent(_E, _CIRCUMFLEX);
454 } 452 }
455 /* îÎ => LdrKey > I > I */ 453 /* îÎ => LdrKey > I > I */
456 SEQ_TWO_KEYS(KC_I, KC_I) { 454 if (leader_sequence_two_keys(KC_I, KC_I)) {
457 send_french_accent(_I, _CIRCUMFLEX); 455 send_french_accent(_I, _CIRCUMFLEX);
458 } 456 }
459 /* ôÔ => LdrKey > O > O */ 457 /* ôÔ => LdrKey > O > O */
460 SEQ_TWO_KEYS(KC_O, KC_O) { 458 if (leader_sequence_two_keys(KC_O, KC_O)) {
461 send_french_accent(_O, _CIRCUMFLEX); 459 send_french_accent(_O, _CIRCUMFLEX);
462 } 460 }
463 /* ûÛ => LdrKey > U > U */ 461 /* ûÛ => LdrKey > U > U */
464 SEQ_TWO_KEYS(KC_U, KC_U) { 462 if (leader_sequence_two_keys(KC_U, KC_U)) {
465 send_french_accent(_U, _CIRCUMFLEX); 463 send_french_accent(_U, _CIRCUMFLEX);
466 } 464 }
467 /* çÇ => LdrKey > C */ 465 /* çÇ => LdrKey > C */
468 SEQ_ONE_KEY(KC_C) { 466 if (leader_sequence_one_key(KC_C)) {
469 if (onMac) { 467 if (onMac) {
470 SEND_STRING(SS_LALT("c")); 468 SEND_STRING(SS_LALT("c"));
471 } else { 469 } else {
@@ -473,247 +471,238 @@ void matrix_scan_user(void)
473 } 471 }
474 } 472 }
475 /* CapsLock */ 473 /* CapsLock */
476 SEQ_ONE_KEY(QK_LEAD) { 474 if (leader_sequence_one_key(QK_LEAD)) {
477 tap_code(KC_CAPS); 475 tap_code(KC_CAPS);
478 } 476 }
479 /* ± => LdrKey > = > - */ 477 /* ± => LdrKey > = > - */
480 SEQ_TWO_KEYS(KC_EQL, KC_MINS) { 478 if (leader_sequence_two_keys(KC_EQL, KC_MINS)) {
481 onMac ? SEND_STRING(SS_LALT(SS_LSFT(SS_TAP(X_EQL)))) : SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P2) SS_TAP(X_P4) SS_TAP(X_P1) SS_UP(X_LALT)); 479 onMac ? SEND_STRING(SS_LALT(SS_LSFT(SS_TAP(X_EQL)))) : SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P2) SS_TAP(X_P4) SS_TAP(X_P1) SS_UP(X_LALT));
482 } 480 }
483 /* ≤ => LdrKey > - > = */ 481 /* ≤ => LdrKey > - > = */
484 SEQ_TWO_KEYS(KC_MINS, KC_EQL) { 482 if (leader_sequence_two_keys(KC_MINS, KC_EQL)) {
485 onMac ? SEND_STRING(SS_LALT(SS_TAP(X_COMM))) : SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P2) SS_TAP(X_P4) SS_TAP(X_P3) SS_UP(X_LALT)); 483 onMac ? SEND_STRING(SS_LALT(SS_TAP(X_COMM))) : SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P2) SS_TAP(X_P4) SS_TAP(X_P3) SS_UP(X_LALT));
486 } 484 }
487 /* ≥ => LdrKey > = > = */ 485 /* ≥ => LdrKey > = > = */
488 SEQ_TWO_KEYS(KC_EQL, KC_EQL) { 486 if (leader_sequence_two_keys(KC_EQL, KC_EQL)) {
489 onMac ? SEND_STRING(SS_LALT(SS_TAP(X_DOT))) : SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P2) SS_TAP(X_P4) SS_TAP(X_P2) SS_UP(X_LALT)); 487 onMac ? SEND_STRING(SS_LALT(SS_TAP(X_DOT))) : SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_P2) SS_TAP(X_P4) SS_TAP(X_P2) SS_UP(X_LALT));
490 } 488 }
491 /* <= => LdrKey > , > , */ 489 /* <= => LdrKey > , > , */
492 SEQ_TWO_KEYS(KC_COMM, KC_COMM) { 490 if (leader_sequence_two_keys(KC_COMM, KC_COMM)) {
493 SEND_STRING(SS_LSFT(SS_TAP(X_COMM)) SS_TAP(X_SPC) SS_TAP(X_EQL) SS_TAP(X_LEFT) SS_TAP(X_BSPC) SS_TAP(X_RIGHT)); 491 SEND_STRING(SS_LSFT(SS_TAP(X_COMM)) SS_TAP(X_SPC) SS_TAP(X_EQL) SS_TAP(X_LEFT) SS_TAP(X_BSPC) SS_TAP(X_RIGHT));
494 } 492 }
495 /* => => LdrKey > . > . */ 493 /* => => LdrKey > . > . */
496 SEQ_TWO_KEYS(KC_DOT, KC_DOT) { 494 if (leader_sequence_two_keys(KC_DOT, KC_DOT)) {
497 SEND_STRING("=>"); 495 SEND_STRING("=>");
498 } 496 }
499 /* ", " => LdrKey > " " */ 497 /* ", " => LdrKey > " " */
500 SEQ_ONE_KEY(KC_SPC) { 498 if (leader_sequence_one_key(KC_SPC)) {
501 SEND_STRING(", "); 499 SEND_STRING(", ");
502 } 500 }
503 /* ". " => LdrKey > " " > " " */ 501 /* ". " => LdrKey > " " > " " */
504 SEQ_TWO_KEYS(KC_SPC, KC_SPC) { 502 if (leader_sequence_two_keys(KC_SPC, KC_SPC)) {
505 SEND_STRING(". "); 503 SEND_STRING(". ");
506 } 504 }
507 /* Backward delete current word (on cursor) */ 505 /* Backward delete current word (on cursor) */
508 SEQ_TWO_KEYS(KC_BSPC, KC_BSPC) { 506 if (leader_sequence_two_keys(KC_BSPC, KC_BSPC)) {
509 onMac ? SEND_STRING(SS_LALT(SS_TAP(X_RIGHT)) SS_LALT(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC)) : SEND_STRING(SS_LCTL(SS_TAP(X_RIGHT)) SS_LCTL(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC)); 507 onMac ? SEND_STRING(SS_LALT(SS_TAP(X_RIGHT)) SS_LALT(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC)) : SEND_STRING(SS_LCTL(SS_TAP(X_RIGHT)) SS_LCTL(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC));
510 } 508 }
511 /* Previous word delete */ 509 /* Previous word delete */
512 SEQ_ONE_KEY(KC_BSPC) { 510 if (leader_sequence_one_key(KC_BSPC)) {
513 onMac ? SEND_STRING(SS_LALT(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC)) : SEND_STRING(SS_LCTL(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC)); 511 onMac ? SEND_STRING(SS_LALT(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC)) : SEND_STRING(SS_LCTL(SS_LSFT(SS_TAP(X_LEFT))) SS_TAP(X_BSPC));
514 } 512 }
515 /* Forward delete current word (on cursor) */ 513 /* Forward delete current word (on cursor) */
516 SEQ_TWO_KEYS(KC_DEL, KC_DEL) { 514 if (leader_sequence_two_keys(KC_DEL, KC_DEL)) {
517 515
518 onMac ? SEND_STRING(SS_LALT(SS_TAP(X_LEFT)) SS_LALT(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL)) : SEND_STRING(SS_LCTL(SS_TAP(X_LEFT)) SS_LCTL(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL)); 516 onMac ? SEND_STRING(SS_LALT(SS_TAP(X_LEFT)) SS_LALT(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL)) : SEND_STRING(SS_LCTL(SS_TAP(X_LEFT)) SS_LCTL(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL));
519 } 517 }
520 /* Next word delete */ 518 /* Next word delete */
521 SEQ_ONE_KEY(KC_DEL) { 519 if (leader_sequence_one_key(KC_DEL)) {
522 onMac ? SEND_STRING(SS_LALT(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL)): SEND_STRING(SS_LCTL(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL)); 520 onMac ? SEND_STRING(SS_LALT(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL)): SEND_STRING(SS_LCTL(SS_LSFT(SS_TAP(X_RIGHT))) SS_TAP(X_DEL));
523 } 521 }
524 /* ` => LdrKey > Escape */ 522 /* ` => LdrKey > Escape */
525 SEQ_ONE_KEY(QK_GESC) { 523 if (leader_sequence_one_key(QK_GESC)) {
526 SEND_STRING("`"); 524 SEND_STRING("`");
527 } 525 }
528 /* ``` => LdrKey > Escape > Escape > Escape */ 526 /* ``` => LdrKey > Escape > Escape > Escape */
529 SEQ_THREE_KEYS(QK_GESC, QK_GESC, QK_GESC) { 527 if (leader_sequence_three_keys(QK_GESC, QK_GESC, QK_GESC)) {
530 SEND_STRING("```"); 528 SEND_STRING("```");
531 } 529 }
532 /* Printscreen => LdrKey > Insert */ 530 /* Printscreen => LdrKey > Insert */
533 SEQ_ONE_KEY(KC_INS) { 531 if (leader_sequence_one_key(KC_INS)) {
534 onMac ? SEND_STRING(SS_LGUI(SS_LSFT(SS_TAP(X_4)))) : SEND_STRING(SS_TAP(X_PSCR)); 532 onMac ? SEND_STRING(SS_LGUI(SS_LSFT(SS_TAP(X_4)))) : SEND_STRING(SS_TAP(X_PSCR));
535 } 533 }
536 /* Home => LdrKey > Page Up */ 534 /* Home => LdrKey > Page Up */
537 SEQ_ONE_KEY(KC_PGUP) { 535 if (leader_sequence_one_key(KC_PGUP)) {
538 onMac ? SEND_STRING(SS_TAP(X_HOME)) : SEND_STRING(SS_LCTL(SS_TAP(X_HOME))); 536 onMac ? SEND_STRING(SS_TAP(X_HOME)) : SEND_STRING(SS_LCTL(SS_TAP(X_HOME)));
539 } 537 }
540 /* End => LdrKey > Page Down */ 538 /* End => LdrKey > Page Down */
541 SEQ_ONE_KEY(KC_PGDN) { 539 if (leader_sequence_one_key(KC_PGDN)) {
542 onMac ? SEND_STRING(SS_TAP(X_END)) : SEND_STRING(SS_LCTL(SS_TAP(X_END))); 540 onMac ? SEND_STRING(SS_TAP(X_END)) : SEND_STRING(SS_LCTL(SS_TAP(X_END)));
543 } 541 }
544 /* Close Curernt File/Tab => LdrKey > W */ 542 /* Close Curernt File/Tab => LdrKey > W */
545 SEQ_ONE_KEY(KC_W) { 543 if (leader_sequence_one_key(KC_W)) {
546 onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_W))) : SEND_STRING(SS_LCTL(SS_TAP(X_W))); 544 onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_W))) : SEND_STRING(SS_LCTL(SS_TAP(X_W)));
547 } 545 }
548 /* Close Current App => LdrKey > Q */ 546 /* Close Current App => LdrKey > Q */
549 SEQ_ONE_KEY(KC_Q) { 547 if (leader_sequence_one_key(KC_Q)) {
550 onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_Q))) : SEND_STRING(SS_LALT(SS_TAP(X_F4))); 548 onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_Q))) : SEND_STRING(SS_LALT(SS_TAP(X_F4)));
551 } 549 }
552 /* " => LdrKey > ' */ 550 /* " => LdrKey > ' */
553 SEQ_ONE_KEY(KC_QUOT) { 551 if (leader_sequence_one_key(KC_QUOT)) {
554 SEND_STRING("\""); 552 SEND_STRING("\"");
555 } 553 }
556 /* "|" => LdrKey > ' > ' */ 554 /* "|" => LdrKey > ' > ' */
557 SEQ_TWO_KEYS(KC_QUOT, KC_QUOT) { 555 if (leader_sequence_two_keys(KC_QUOT, KC_QUOT)) {
558 SEND_STRING("\"\"" SS_TAP(X_LEFT)); 556 SEND_STRING("\"\"" SS_TAP(X_LEFT));
559 } 557 }
560 /* "X" wrap => LdrKey > ' > ' > ' */ 558 /* "X" wrap => LdrKey > ' > ' > ' */
561 SEQ_THREE_KEYS(KC_QUOT, KC_QUOT, KC_QUOT) { 559 if (leader_sequence_three_keys(KC_QUOT, KC_QUOT, KC_QUOT)) {
562 onMac ? SEND_STRING(SS_LALT(SS_TAP(X_LEFT)) "\"" SS_LALT(SS_TAP(X_RIGHT)) "\"") : SEND_STRING(SS_LCTL(SS_TAP(X_LEFT)) "\"" SS_LCTL(SS_TAP(X_RIGHT)) "\""); 560 onMac ? SEND_STRING(SS_LALT(SS_TAP(X_LEFT)) "\"" SS_LALT(SS_TAP(X_RIGHT)) "\"") : SEND_STRING(SS_LCTL(SS_TAP(X_LEFT)) "\"" SS_LCTL(SS_TAP(X_RIGHT)) "\"");
563 } 561 }
564 /* ( => LdrKey > Left Shift */ 562 /* ( => LdrKey > Left Shift */
565 SEQ_ONE_KEY(KC_LSFT) { 563 if (leader_sequence_one_key(KC_LSFT)) {
566 SEND_STRING("("); 564 SEND_STRING("(");
567 } 565 }
568 /* ) => LdrKey > Right Shift */ 566 /* ) => LdrKey > Right Shift */
569 SEQ_ONE_KEY(KC_RSFT) { 567 if (leader_sequence_one_key(KC_RSFT)) {
570 SEND_STRING(")"); 568 SEND_STRING(")");
571 } 569 }
572 /* (|) => LdrKey > Left Shift > Left Shift */ 570 /* (|) => LdrKey > Left Shift > Left Shift */
573 SEQ_TWO_KEYS(KC_LSFT, KC_LSFT) { 571 if (leader_sequence_two_keys(KC_LSFT, KC_LSFT)) {
574 ldrkey_send_paranthesis_wrap_ini(); 572 ldrkey_send_paranthesis_wrap_ini();
575 } 573 }
576 /* (|) => LdrKey > Right Shift > Right Shift */ 574 /* (|) => LdrKey > Right Shift > Right Shift */
577 SEQ_TWO_KEYS(KC_RSFT, KC_RSFT) { 575 if (leader_sequence_two_keys(KC_RSFT, KC_RSFT)) {
578 ldrkey_send_paranthesis_wrap_ini(); 576 ldrkey_send_paranthesis_wrap_ini();
579 } 577 }
580 /* (X) wrap => LdrKey > Left Shift > W */ 578 /* (X) wrap => LdrKey > Left Shift > W */
581 SEQ_TWO_KEYS(KC_LSFT, KC_W) { 579 if (leader_sequence_two_keys(KC_LSFT, KC_W)) {
582 ldrkey_send_paranthesis_wrap_word(); 580 ldrkey_send_paranthesis_wrap_word();
583 } 581 }
584 /* (X) wrap => LdrKey > Right Shift > W */ 582 /* (X) wrap => LdrKey > Right Shift > W */
585 SEQ_TWO_KEYS(KC_RSFT, KC_W) { 583 if (leader_sequence_two_keys(KC_RSFT, KC_W)) {
586 ldrkey_send_paranthesis_wrap_word(); 584 ldrkey_send_paranthesis_wrap_word();
587 } 585 }
588 /* (X) wrap selection => LdrKey > Left Shift > W > W */ 586 /* (X) wrap selection => LdrKey > Left Shift > W > W */
589 SEQ_THREE_KEYS(KC_LSFT, KC_W, KC_W) { 587 if (leader_sequence_three_keys(KC_LSFT, KC_W, KC_W)) {
590 ldrkey_send_paranthesis_wrap_selection(); 588 ldrkey_send_paranthesis_wrap_selection();
591 } 589 }
592 /* (X) wrap selection => LdrKey > Right Shift > W > W */ 590 /* (X) wrap selection => LdrKey > Right Shift > W > W */
593 SEQ_THREE_KEYS(KC_RSFT, KC_W, KC_W) { 591 if (leader_sequence_three_keys(KC_RSFT, KC_W, KC_W)) {
594 ldrkey_send_paranthesis_wrap_selection(); 592 ldrkey_send_paranthesis_wrap_selection();
595 } 593 }
596 /* [ => LdrKey > Left CTL */ 594 /* [ => LdrKey > Left CTL */
597 SEQ_ONE_KEY(KC_LCTL) { 595 if (leader_sequence_one_key(KC_LCTL)) {
598 SEND_STRING("["); 596 SEND_STRING("[");
599 } 597 }
600 /* ] => LdrKey > Right CTL */ 598 /* ] => LdrKey > Right CTL */
601 SEQ_ONE_KEY(KC_RCTL) { 599 if (leader_sequence_one_key(KC_RCTL)) {
602 SEND_STRING("]"); 600 SEND_STRING("]");
603 } 601 }
604 /* [|] => LdrKey > Left CTL > Left CTL */ 602 /* [|] => LdrKey > Left CTL > Left CTL */
605 SEQ_TWO_KEYS(KC_LCTL, KC_LCTL) { 603 if (leader_sequence_two_keys(KC_LCTL, KC_LCTL)) {
606 ldrkey_send_bracket_wrap_ini(); 604 ldrkey_send_bracket_wrap_ini();
607 } 605 }
608 /* [|] => LdrKey > Right CTL > Right CTL */ 606 /* [|] => LdrKey > Right CTL > Right CTL */
609 SEQ_TWO_KEYS(KC_RCTL, KC_RCTL) { 607 if (leader_sequence_two_keys(KC_RCTL, KC_RCTL)) {
610 ldrkey_send_bracket_wrap_ini(); 608 ldrkey_send_bracket_wrap_ini();
611 } 609 }
612 /* [X] wrap => LdrKey > Left CTL > W */ 610 /* [X] wrap => LdrKey > Left CTL > W */
613 SEQ_TWO_KEYS(KC_LCTL, KC_W) { 611 if (leader_sequence_two_keys(KC_LCTL, KC_W)) {
614 ldrkey_send_bracket_wrap_word(); 612 ldrkey_send_bracket_wrap_word();
615 } 613 }
616 /* [X] wrap => LdrKey > Right CTL > W */ 614 /* [X] wrap => LdrKey > Right CTL > W */
617 SEQ_TWO_KEYS(KC_RCTL, KC_W) { 615 if (leader_sequence_two_keys(KC_RCTL, KC_W)) {
618 ldrkey_send_bracket_wrap_word(); 616 ldrkey_send_bracket_wrap_word();
619 } 617 }
620 /* [X] wrap selection => LdrKey > Left CTL > W > W */ 618 /* [X] wrap selection => LdrKey > Left CTL > W > W */
621 SEQ_THREE_KEYS(KC_LCTL, KC_W, KC_W) { 619 if (leader_sequence_three_keys(KC_LCTL, KC_W, KC_W)) {
622 ldrkey_send_bracket_wrap_selection(); 620 ldrkey_send_bracket_wrap_selection();
623 } 621 }
624 /* [X] wrap selection => LdrKey > Right CTL > W > W */ 622 /* [X] wrap selection => LdrKey > Right CTL > W > W */
625 SEQ_THREE_KEYS(KC_RCTL, KC_W, KC_W) { 623 if (leader_sequence_three_keys(KC_RCTL, KC_W, KC_W)) {
626 ldrkey_send_bracket_wrap_selection(); 624 ldrkey_send_bracket_wrap_selection();
627 } 625 }
628 /* { => LdrKey > Left ALT */ 626 /* { => LdrKey > Left ALT */
629 SEQ_ONE_KEY(KC_LALT) { 627 if (leader_sequence_one_key(KC_LALT)) {
630 SEND_STRING("{"); 628 SEND_STRING("{");
631 } 629 }
632 /* } => LdrKey > Right ALT */ 630 /* } => LdrKey > Right ALT */
633 SEQ_ONE_KEY(KC_RALT) { 631 if (leader_sequence_one_key(KC_RALT)) {
634 SEND_STRING("}"); 632 SEND_STRING("}");
635 } 633 }
636 /* {|} => LdrKey > Left ALT > Left ALT */ 634 /* {|} => LdrKey > Left ALT > Left ALT */
637 SEQ_TWO_KEYS(KC_LALT, KC_LALT) { 635 if (leader_sequence_two_keys(KC_LALT, KC_LALT)) {
638 ldrkey_send_curlybrace_wrap_ini(); 636 ldrkey_send_curlybrace_wrap_ini();
639 } 637 }
640 /* {|} => LdrKey > Right ALT > Right ALT */ 638 /* {|} => LdrKey > Right ALT > Right ALT */
641 SEQ_TWO_KEYS(KC_RALT, KC_RALT) { 639 if (leader_sequence_two_keys(KC_RALT, KC_RALT)) {
642 ldrkey_send_curlybrace_wrap_ini(); 640 ldrkey_send_curlybrace_wrap_ini();
643 } 641 }
644 /* {X} wrap => LdrKey > Left ALT > W */ 642 /* {X} wrap => LdrKey > Left ALT > W */
645 SEQ_TWO_KEYS(KC_LALT, KC_W) { 643 if (leader_sequence_two_keys(KC_LALT, KC_W)) {
646 ldrkey_send_curlybrace_wrap_word(); 644 ldrkey_send_curlybrace_wrap_word();
647 } 645 }
648 /* {X} wrap => LdrKey > Right ALT > W */ 646 /* {X} wrap => LdrKey > Right ALT > W */
649 SEQ_TWO_KEYS(KC_RALT, KC_W) { 647 if (leader_sequence_two_keys(KC_RALT, KC_W)) {
650 ldrkey_send_curlybrace_wrap_word(); 648 ldrkey_send_curlybrace_wrap_word();
651 } 649 }
652 /* {X} wrap selection => LdrKey > Left ALT > W > W */ 650 /* {X} wrap selection => LdrKey > Left ALT > W > W */
653 SEQ_THREE_KEYS(KC_LALT, KC_W, KC_W) { 651 if (leader_sequence_three_keys(KC_LALT, KC_W, KC_W)) {
654 ldrkey_send_curlybrace_wrap_selection(); 652 ldrkey_send_curlybrace_wrap_selection();
655 } 653 }
656 /* {X} wrap selection => LdrKey > Right ALT > W > W */ 654 /* {X} wrap selection => LdrKey > Right ALT > W > W */
657 SEQ_THREE_KEYS(KC_RALT, KC_W, KC_W) { 655 if (leader_sequence_three_keys(KC_RALT, KC_W, KC_W)) {
658 ldrkey_send_curlybrace_wrap_selection(); 656 ldrkey_send_curlybrace_wrap_selection();
659 } 657 }
660 /* Select everything on this line before cursor => LdrKey > Left */ 658 /* Select everything on this line before cursor => LdrKey > Left */
661 SEQ_ONE_KEY(KC_LEFT) { 659 if (leader_sequence_one_key(KC_LEFT)) {
662 onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_LEFT)))) : SEND_STRING(SS_LSFT(SS_TAP(X_HOME))); 660 onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_LEFT)))) : SEND_STRING(SS_LSFT(SS_TAP(X_HOME)));
663 } 661 }
664 /* Select everything on this line after cursor => LdrKey > Right */ 662 /* Select everything on this line after cursor => LdrKey > Right */
665 SEQ_ONE_KEY(KC_RIGHT) { 663 if (leader_sequence_one_key(KC_RIGHT)) {
666 onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_RIGHT)))) : SEND_STRING(SS_LSFT(SS_TAP(X_END))); 664 onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_RIGHT)))) : SEND_STRING(SS_LSFT(SS_TAP(X_END)));
667 } 665 }
668 /* Select everything on this line before cursor and bring on previous line => LdrKey > Left > Left */ 666 /* Select everything on this line before cursor and bring on previous line => LdrKey > Left > Left */
669 SEQ_TWO_KEYS(KC_LEFT, KC_LEFT) { 667 if (leader_sequence_two_keys(KC_LEFT, KC_LEFT)) {
670 onMac ? SEND_STRING(SS_LSFT(SS_TAP(X_UP) SS_LGUI(SS_TAP(X_RIGHT)))) : SEND_STRING(SS_LSFT(SS_TAP(X_UP) SS_TAP(X_END))); 668 onMac ? SEND_STRING(SS_LSFT(SS_TAP(X_UP) SS_LGUI(SS_TAP(X_RIGHT)))) : SEND_STRING(SS_LSFT(SS_TAP(X_UP) SS_TAP(X_END)));
671 } 669 }
672 /* Select everything on this line => LdrKey > Right > Left */ 670 /* Select everything on this line => LdrKey > Right > Left */
673 SEQ_TWO_KEYS(KC_RIGHT, KC_LEFT) { 671 if (leader_sequence_two_keys(KC_RIGHT, KC_LEFT)) {
674 onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_RIGHT) SS_LSFT(SS_LGUI(SS_TAP(X_LEFT))))) : SEND_STRING(SS_TAP(X_END) SS_LSFT(SS_TAP(X_HOME))); 672 onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_RIGHT) SS_LSFT(SS_LGUI(SS_TAP(X_LEFT))))) : SEND_STRING(SS_TAP(X_END) SS_LSFT(SS_TAP(X_HOME)));
675 } 673 }
676 /* Select 1x Page Up on the page before the cursor => LdrKey > Up */ 674 /* Select 1x Page Up on the page before the cursor => LdrKey > Up */
677 SEQ_ONE_KEY(KC_UP) { 675 if (leader_sequence_one_key(KC_UP)) {
678 SEND_STRING(SS_LSFT(SS_TAP(X_PGUP))); 676 SEND_STRING(SS_LSFT(SS_TAP(X_PGUP)));
679 } 677 }
680 /* Select 1x Page Down on the page after the cursor => LdrKey > Down */ 678 /* Select 1x Page Down on the page after the cursor => LdrKey > Down */
681 SEQ_ONE_KEY(KC_DOWN) { 679 if (leader_sequence_one_key(KC_DOWN)) {
682 SEND_STRING(SS_LSFT(SS_TAP(X_PGDN))); 680 SEND_STRING(SS_LSFT(SS_TAP(X_PGDN)));
683 } 681 }
684 /* Select everything on the page before the cursor => LdrKey > Up > Up */ 682 /* Select everything on the page before the cursor => LdrKey > Up > Up */
685 SEQ_TWO_KEYS(KC_UP, KC_UP) { 683 if (leader_sequence_two_keys(KC_UP, KC_UP)) {
686 onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_UP)))) : SEND_STRING(SS_LSFT(SS_LCTL(SS_TAP(X_HOME)))); 684 onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_UP)))) : SEND_STRING(SS_LSFT(SS_LCTL(SS_TAP(X_HOME))));
687 } 685 }
688 /* Select everything on the page after the cursor => LdrKey > Down > Down */ 686 /* Select everything on the page after the cursor => LdrKey > Down > Down */
689 SEQ_TWO_KEYS(KC_DOWN, KC_DOWN) { 687 if (leader_sequence_two_keys(KC_DOWN, KC_DOWN)) {
690 onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_DOWN)))) : SEND_STRING(SS_LSFT(SS_LCTL(SS_TAP(X_END)))); 688 onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_DOWN)))) : SEND_STRING(SS_LSFT(SS_LCTL(SS_TAP(X_END))));
691 } 689 }
692 /* HELPER => spit out the url of the layout description page on github */ 690 /* HELPER => spit out the url of the layout description page on github */
693 SEQ_FIVE_KEYS(QK_GESC, QK_GESC, QK_GESC, QK_GESC, QK_GESC) { 691 if (leader_sequence_five_keys(QK_GESC, QK_GESC, QK_GESC, QK_GESC, QK_GESC)) {
694 SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/keyboards/dztech/dz65rgb/keymaps/drootz"); 692 SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/keyboards/dztech/dz65rgb/keymaps/drootz");
695 } 693 }
696 /* google.ca => LdrKey > G > G */ 694 /* google.ca => LdrKey > G > G */
697 SEQ_TWO_KEYS(KC_G, KC_G) { 695 if (leader_sequence_two_keys(KC_G, KC_G)) {
698 SEND_STRING("https://google.ca" SS_TAP(X_ENT)); 696 SEND_STRING("https://google.ca" SS_TAP(X_ENT));
699 } 697 }
700 /* @gmail => LdrKey > M > L > T */ 698 /* @gmail => LdrKey > M > L > T */
701 SEQ_THREE_KEYS(KC_M, KC_L, KC_T) { 699 if (leader_sequence_three_keys(KC_M, KC_L, KC_T)) {
702 SEND_STRING("mailto." SS_TAP(X_D) SS_TAP(X_A) SS_TAP(X_N) SS_TAP(X_I) SS_TAP(X_E) SS_TAP(X_L) SS_TAP(X_R) SS_TAP(X_A) SS_TAP(X_C) SS_TAP(X_I) SS_TAP(X_N) SS_TAP(X_E) "@gmail.com"); 700 SEND_STRING("mailto." SS_TAP(X_D) SS_TAP(X_A) SS_TAP(X_N) SS_TAP(X_I) SS_TAP(X_E) SS_TAP(X_L) SS_TAP(X_R) SS_TAP(X_A) SS_TAP(X_C) SS_TAP(X_I) SS_TAP(X_N) SS_TAP(X_E) "@gmail.com");
703 } 701 }
704 /* Show Desktop => LdrKey > D */ 702 /* Show Desktop => LdrKey > D */
705 SEQ_ONE_KEY(KC_D) { 703 if (leader_sequence_one_key(KC_D)) {
706 onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_SPC)) "Mission" SS_TAP(X_ENT)) : SEND_STRING(SS_LGUI(SS_TAP(X_D))); 704 onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_SPC)) "Mission" SS_TAP(X_ENT)) : SEND_STRING(SS_LGUI(SS_TAP(X_D)));
707 } 705 }
708 }
709}
710
711void leader_start_user(void) {
712 isLeader = true;
713}
714
715void leader_end_user(void) {
716 isLeader = false;
717} 706}
718 707
719#endif /* LEADER */ 708#endif /* LEADER */
diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_dictionary.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_dictionary.c
deleted file mode 100644
index 8d5fa00a7d..0000000000
--- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_dictionary.c
+++ /dev/null
@@ -1,14 +0,0 @@
1LEADER_DICTIONARY() {
2 leading = false;
3 leader_end();
4
5 SEQ_ONE_KEY(TD(APMR_PIPE)) {
6 register_code(KC_LCTL);
7 register_code(KC_LSFT);
8 register_code(KC_U);
9
10 unregister_code(KC_U);
11 unregister_code(KC_LSFT);
12 unregister_code(KC_LCTL);
13 }
14}
diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_setup.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_setup.c
deleted file mode 100644
index c22670a05a..0000000000
--- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_setup.c
+++ /dev/null
@@ -1 +0,0 @@
1LEADER_EXTERNS();
diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/matrix_scan_user.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/matrix_scan_user.c
index 277821afac..fc6c99cb85 100644
--- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/matrix_scan_user.c
+++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/matrix_scan_user.c
@@ -1,5 +1,3 @@
1#include "../leader/leader_setup.c"
2
3bool MATRIX_SCANNED = false; 1bool MATRIX_SCANNED = false;
4 2
5void matrix_scan_user(void) { 3void matrix_scan_user(void) {
@@ -7,6 +5,16 @@ void matrix_scan_user(void) {
7 rgblight_sethsv_noeeprom(HSV_GREEN); 5 rgblight_sethsv_noeeprom(HSV_GREEN);
8 MATRIX_SCANNED = true; 6 MATRIX_SCANNED = true;
9 } 7 }
10
11 #include "../leader/leader_dictionary.c"
12}; 8};
9
10void leader_end_user(void) {
11 if (leader_sequence_one_key(TD(APMR_PIPE))) {
12 register_code(KC_LCTL);
13 register_code(KC_LSFT);
14 register_code(KC_U);
15
16 unregister_code(KC_U);
17 unregister_code(KC_LSFT);
18 unregister_code(KC_LCTL);
19 }
20}
diff --git a/keyboards/ergodox_ez/keymaps/stamm/keymap.c b/keyboards/ergodox_ez/keymaps/stamm/keymap.c
index 8a3e30f5f6..21f58b298c 100644
--- a/keyboards/ergodox_ez/keymaps/stamm/keymap.c
+++ b/keyboards/ergodox_ez/keymaps/stamm/keymap.c
@@ -244,7 +244,30 @@ uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record) {
244 } 244 }
245} 245}
246 246
247LEADER_EXTERNS(); 247void leader_end_user(void) {
248 if (leader_sequence_one_key(KC_F)) {
249 SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
250 }
251 if (leader_sequence_one_key(KC_S)) {
252 SEND_STRING ("sudo -i\n");
253 }
254 if (leader_sequence_one_key(KC_H)) {
255 SEND_STRING ("--help\n");
256 }
257 if (leader_sequence_two_keys(KC_D, KC_D)) {
258 SEND_STRING(SS_LGUI("ac"));
259 /* SEND_STRING(SS_LGUI("a") SS_LGUI("c")); */
260 }
261 if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
262 SEND_STRING("https://start.duckduckgo.com\n");
263 }
264 if (leader_sequence_two_keys(KC_A, KC_S)) {
265 register_code(KC_LGUI);
266 register_code(KC_S);
267 unregister_code(KC_S);
268 unregister_code(KC_LGUI);
269 }
270}
248 271
249void matrix_scan_user(void) { 272void matrix_scan_user(void) {
250 if (is_alt_tab_active) { 273 if (is_alt_tab_active) {
@@ -253,31 +276,4 @@ void matrix_scan_user(void) {
253 is_alt_tab_active = false; 276 is_alt_tab_active = false;
254 } 277 }
255 } 278 }
256 LEADER_DICTIONARY() {
257 leading = false;
258 leader_end();
259
260 SEQ_ONE_KEY(KC_F) {
261 SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
262 }
263 SEQ_ONE_KEY(KC_S) {
264 SEND_STRING ("sudo -i\n");
265 }
266 SEQ_ONE_KEY(KC_H) {
267 SEND_STRING ("--help\n");
268 }
269 SEQ_TWO_KEYS(KC_D, KC_D) {
270 SEND_STRING(SS_LGUI("ac"));
271 /* SEND_STRING(SS_LGUI("a") SS_LGUI("c")); */
272 }
273 SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
274 SEND_STRING("https://start.duckduckgo.com\n");
275 }
276 SEQ_TWO_KEYS(KC_A, KC_S) {
277 register_code(KC_LGUI);
278 register_code(KC_S);
279 unregister_code(KC_S);
280 unregister_code(KC_LGUI);
281 }
282 }
283} 279}
diff --git a/keyboards/handwired/co60/keymaps/jmdaly_hhkb_split_space/keymap.c b/keyboards/handwired/co60/keymaps/jmdaly_hhkb_split_space/keymap.c
index 885c31e8c6..1d49d91346 100644
--- a/keyboards/handwired/co60/keymaps/jmdaly_hhkb_split_space/keymap.c
+++ b/keyboards/handwired/co60/keymaps/jmdaly_hhkb_split_space/keymap.c
@@ -49,89 +49,69 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
49 ) 49 )
50}; 50};
51 51
52void matrix_init_user(void) { 52void leader_end_user() {
53 53 // Close a program in i3wm
54} 54 if (leader_sequence_one_key(KC_Q)) {
55 55 register_code(KC_LGUI);
56LEADER_EXTERNS(); 56 register_code(KC_LSFT);
57 57 register_code(KC_Q);
58void matrix_scan_user(void) { 58 unregister_code(KC_Q);
59 59 unregister_code(KC_LSFT);
60 LEADER_DICTIONARY() { 60 unregister_code(KC_LGUI);
61 leading = false; 61 }
62 leader_end(); 62 // Exit i3wm
63 63 if (leader_sequence_one_key(KC_E)) {
64 // Close a program in i3wm 64 register_code(KC_LGUI);
65 SEQ_ONE_KEY(KC_Q) { 65 register_code(KC_LSFT);
66 register_code(KC_LGUI); 66 register_code(KC_E);
67 register_code(KC_LSFT); 67 unregister_code(KC_E);
68 register_code(KC_Q); 68 unregister_code(KC_LSFT);
69 unregister_code(KC_Q); 69 unregister_code(KC_LGUI);
70 unregister_code(KC_LSFT); 70 }
71 unregister_code(KC_LGUI); 71 // Copy selected text in suckless terminal
72 } 72 if (leader_sequence_one_key(KC_C)) {
73 // Exit i3wm 73 register_code(KC_LCTL);
74 SEQ_ONE_KEY(KC_E) { 74 register_code(KC_LSFT);
75 register_code(KC_LGUI); 75 register_code(KC_C);
76 register_code(KC_LSFT); 76 unregister_code(KC_C);
77 register_code(KC_E); 77 unregister_code(KC_LSFT);
78 unregister_code(KC_E); 78 unregister_code(KC_LCTL);
79 unregister_code(KC_LSFT); 79 }
80 unregister_code(KC_LGUI); 80 // Paste text in suckless terminal
81 } 81 if (leader_sequence_one_key(KC_V)) {
82 // Copy selected text in suckless terminal 82 register_code(KC_LCTL);
83 SEQ_ONE_KEY(KC_C) { 83 register_code(KC_LSFT);
84 register_code(KC_LCTL); 84 register_code(KC_V);
85 register_code(KC_LSFT); 85 unregister_code(KC_V);
86 register_code(KC_C); 86 unregister_code(KC_LSFT);
87 unregister_code(KC_C); 87 unregister_code(KC_LCTL);
88 unregister_code(KC_LSFT); 88 }
89 unregister_code(KC_LCTL); 89 // FZF shortcut to fuzzy switch directories
90 } 90 if (leader_sequence_one_key(KC_D)) {
91 // Paste text in suckless terminal 91 register_code(KC_LALT);
92 SEQ_ONE_KEY(KC_V) { 92 register_code(KC_C);
93 register_code(KC_LCTL); 93 unregister_code(KC_C);
94 register_code(KC_LSFT); 94 unregister_code(KC_LALT);
95 register_code(KC_V); 95 }
96 unregister_code(KC_V); 96 // Send keys to bring up fuzzy process kill
97 unregister_code(KC_LSFT); 97 if (leader_sequence_one_key(KC_K)) {
98 unregister_code(KC_LCTL); 98 SEND_STRING("kill " SS_TAP(X_TAB));
99 } 99 }
100 // FZF shortcut to fuzzy switch directories 100 // Send keys to start neovim and fuzzy search for filename
101 SEQ_ONE_KEY(KC_D) { 101 if (leader_sequence_one_key(KC_T)) {
102 register_code(KC_LALT); 102 SEND_STRING("nvim ");
103 register_code(KC_C); 103 register_code(KC_LCTL);
104 unregister_code(KC_C); 104 register_code(KC_T);
105 unregister_code(KC_LALT); 105 unregister_code(KC_T);
106 } 106 unregister_code(KC_LCTL);
107 // Send keys to bring up fuzzy process kill 107 }
108 SEQ_ONE_KEY(KC_K) { 108 // Switch between windows in tmux
109 SEND_STRING("kill " SS_TAP(X_TAB)); 109 if (leader_sequence_one_key(KC_L)) {
110 } 110 register_code(KC_LCTL);
111 // Send keys to start neovim and fuzzy search for filename 111 register_code(KC_B);
112 SEQ_ONE_KEY(KC_T) { 112 unregister_code(KC_B);
113 SEND_STRING("nvim "); 113 unregister_code(KC_LCTL);
114 register_code(KC_LCTL); 114 register_code(KC_L);
115 register_code(KC_T); 115 unregister_code(KC_L);
116 unregister_code(KC_T);
117 unregister_code(KC_LCTL);
118 }
119 // Switch between windows in tmux
120 SEQ_ONE_KEY(KC_L) {
121 register_code(KC_LCTL);
122 register_code(KC_B);
123 unregister_code(KC_B);
124 unregister_code(KC_LCTL);
125 register_code(KC_L);
126 unregister_code(KC_L);
127 }
128 } 116 }
129}
130
131bool process_record_user(uint16_t keycode, keyrecord_t *record) {
132 return true;
133}
134
135void led_set_user(uint8_t usb_led) {
136
137} 117}
diff --git a/keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c b/keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c
index 1b8e41de0e..1852920345 100644
--- a/keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c
@@ -42,25 +42,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
42 _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PSCR, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_LEFT, KC_RGHT, _______, KC_PENT, 42 _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PSCR, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_LEFT, KC_RGHT, _______, KC_PENT,
43 _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______, 43 _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______,
44 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______)}; 44 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______)};
45
46/*void matrix_scan_user(void) {
47 LEADER_DICTIONARY() {
48 leading = false;
49 leader_end();
50
51 SEQ_ONE_KEY(KC_RSFT) {
52 register_code(KC_S);
53 unregister_code(KC_S);
54 }
55 SEQ_TWO_KEYS(KC_A, KC_S) {
56 register_code(KC_H);
57 unregister_code(KC_H);
58 }
59 SEQ_THREE_KEYS(KC_A, KC_S, KC_D) {
60 register_code(KC_LGUI);
61 register_code(KC_S);
62 unregister_code(KC_S);
63 unregister_code(KC_LGUI);
64 }
65 }
66}*/
diff --git a/keyboards/ibnuda/squiggle/keymaps/rick-complicated/keymap.c b/keyboards/ibnuda/squiggle/keymaps/rick-complicated/keymap.c
index c33bf71741..c030738400 100644
--- a/keyboards/ibnuda/squiggle/keymaps/rick-complicated/keymap.c
+++ b/keyboards/ibnuda/squiggle/keymaps/rick-complicated/keymap.c
@@ -181,15 +181,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
181), 181),
182}; 182};
183 183
184LEADER_EXTERNS(); 184void leader_end_user(void) {
185 185 if (leader_sequence_one_key(KC_U)) {
186void matrix_scan_user(void) { 186 SEND_STRING(":luvu:\n");
187 LEADER_DICTIONARY() {
188 leading = false;
189 leader_end();
190
191 SEQ_ONE_KEY(KC_U) {
192 SEND_STRING(":luvu:\n");
193 } 187 }
194 }
195} 188}
diff --git a/keyboards/input_club/ergodox_infinity/keymaps/not-quite-neo/keymap.c b/keyboards/input_club/ergodox_infinity/keymaps/not-quite-neo/keymap.c
index be1edfc019..a345e075d9 100644
--- a/keyboards/input_club/ergodox_infinity/keymaps/not-quite-neo/keymap.c
+++ b/keyboards/input_club/ergodox_infinity/keymaps/not-quite-neo/keymap.c
@@ -255,38 +255,29 @@ L06 -> <TBD>: UNSPECIFIED
255 255
256}; 256};
257 257
258void leader_end_user(void) {
259 if (leader_sequence_one_key(KC_1)) {
260 // ¯\_(ツ)_/¯
261 unicode_input_start(); register_hex(0xaf); unicode_input_finish();
262 register_code (KC_RALT); TAP_ONCE (KC_MINS); unregister_code (KC_RALT);
263 register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT);
264 unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
265 register_code (KC_RSFT); TAP_ONCE (KC_9); TAP_ONCE(KC_7); unregister_code (KC_RSFT);
266 unicode_input_start (); register_hex(0xaf); unicode_input_finish();
267 }
268
269 if (leader_sequence_one_key(KC_2)) {
270 // 凸(ツ)凸
271 unicode_input_start(); register_hex(0x51F8); unicode_input_finish();
272 register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT);
273 unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
274 register_code (KC_RSFT); TAP_ONCE (KC_9); unregister_code (KC_RSFT);
275 unicode_input_start (); register_hex(0x51F8); unicode_input_finish();
276 }
277}
278
258 279
259// Runs just one time when the keyboard initializes. 280// Runs just one time when the keyboard initializes.
260void matrix_init_user(void) { 281void matrix_init_user(void) {
261 set_unicode_input_mode(UNICODE_MODE_LINUX); 282 set_unicode_input_mode(UNICODE_MODE_LINUX);
262}; 283};
263
264
265LEADER_EXTERNS();
266
267// Runs constantly in the background, in a loop.
268void matrix_scan_user(void) {
269 LEADER_DICTIONARY() {
270 leading = false;
271 leader_end();
272
273 SEQ_ONE_KEY (KC_1) {
274 // ¯\_(ツ)_/¯
275 unicode_input_start(); register_hex(0xaf); unicode_input_finish();
276 register_code (KC_RALT); TAP_ONCE (KC_MINS); unregister_code (KC_RALT);
277 register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT);
278 unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
279 register_code (KC_RSFT); TAP_ONCE (KC_9); TAP_ONCE(KC_7); unregister_code (KC_RSFT);
280 unicode_input_start (); register_hex(0xaf); unicode_input_finish();
281 }
282
283 SEQ_ONE_KEY (KC_2) {
284 // 凸(ツ)凸
285 unicode_input_start(); register_hex(0x51F8); unicode_input_finish();
286 register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT);
287 unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
288 register_code (KC_RSFT); TAP_ONCE (KC_9); unregister_code (KC_RSFT);
289 unicode_input_start (); register_hex(0x51F8); unicode_input_finish();
290 }
291 }
292}
diff --git a/keyboards/keebio/iris/keymaps/omgvee/keymap.c b/keyboards/keebio/iris/keymaps/omgvee/keymap.c
index 4276938b8d..035d381bac 100644
--- a/keyboards/keebio/iris/keymaps/omgvee/keymap.c
+++ b/keyboards/keebio/iris/keymaps/omgvee/keymap.c
@@ -32,9 +32,6 @@ enum custom_keycodes {
32#define MW_L KC_MS_WH_LEFT 32#define MW_L KC_MS_WH_LEFT
33#define MW_R KC_MS_WH_RIGHT 33#define MW_R KC_MS_WH_RIGHT
34 34
35//// only uncomment the below line when you enable leader key in rules.mk
36//LEADER_EXTERNS();
37
38//Tap Dance Declarations 35//Tap Dance Declarations
39enum { 36enum {
40 TD_SCL = 0 37 TD_SCL = 0
diff --git a/keyboards/keychron/q1/iso/keymaps/victorsavu3/keymap.c b/keyboards/keychron/q1/iso/keymaps/victorsavu3/keymap.c
index 9cfc26d138..b97e6bfb92 100644
--- a/keyboards/keychron/q1/iso/keymaps/victorsavu3/keymap.c
+++ b/keyboards/keychron/q1/iso/keymaps/victorsavu3/keymap.c
@@ -76,68 +76,62 @@ static bool wiggle_mouse;
76static uint16_t wiggle_timer; 76static uint16_t wiggle_timer;
77static uint16_t next_wiggle; 77static uint16_t next_wiggle;
78 78
79void leader_end_user(void) {
80 if (leader_sequence_one_key(QK_LEAD)) {
81 tap_code(KC_CAPS);
82 }
79 83
80LEADER_EXTERNS(); 84 if (leader_sequence_four_keys(KC_I, KC_D, KC_L, KC_E)) {
85 wiggle_mouse = !wiggle_mouse;
86 wiggle_timer = timer_read();
87 }
81 88
82void matrix_scan_user(void) { 89 if (leader_sequence_two_keys(KC_O, KC_K)) {
83 LEADER_DICTIONARY() { 90 send_unicode_string("👍");
84 leading = false; 91 }
85 leader_end(); 92
86 93 if (leader_sequence_three_keys(KC_S, KC_A, KC_D)) {
87 SEQ_ONE_KEY(QK_LEAD) { 94 send_unicode_string("😞");
88 tap_code(KC_CAPS); 95 }
89 } 96
90 97 if (leader_sequence_five_keys(KC_C, KC_H, KC_E, KC_C, KC_K)) {
91 SEQ_FOUR_KEYS(KC_I, KC_D, KC_L, KC_E) { 98 send_unicode_string("✅");
92 wiggle_mouse = !wiggle_mouse; 99 }
93 wiggle_timer = timer_read(); 100
94 } 101 if (leader_sequence_five_keys(KC_C, KC_R, KC_O, KC_S, KC_S)) {
95 102 send_unicode_string("❎");
96 SEQ_TWO_KEYS(KC_O, KC_K) { 103 }
97 send_unicode_string("👍"); 104
98 } 105 if (leader_sequence_five_keys(KC_T, KC_H, KC_A, KC_N, KC_K)) {
99 106 send_unicode_string("🙏");
100 SEQ_THREE_KEYS(KC_S, KC_A, KC_D) { 107 }
101 send_unicode_string("😞"); 108
102 } 109 if (leader_sequence_five_keys(KC_S, KC_M, KC_I, KC_L, KC_E)) {
103 110 send_unicode_string("😊");
104 SEQ_FIVE_KEYS(KC_C, KC_H, KC_E, KC_C, KC_K) { 111 }
105 send_unicode_string("✅"); 112
106 } 113 if (leader_sequence_five_keys(KC_P, KC_A, KC_R, KC_T, KC_Y)) {
107 114 send_unicode_string("🎉");
108 SEQ_FIVE_KEYS(KC_C, KC_R, KC_O, KC_S, KC_S) { 115 }
109 send_unicode_string("❎"); 116
110 } 117 if (leader_sequence_four_keys(KC_E, KC_Y, KC_E, KC_S)) {
111 118 send_unicode_string("(ಠ_ಠ)");
112 SEQ_FIVE_KEYS(KC_T, KC_H, KC_A, KC_N, KC_K) { 119 }
113 send_unicode_string("🙏"); 120
114 } 121 if (leader_sequence_five_keys(KC_M, KC_A, KC_G, KC_I, KC_C)) {
115 122 send_unicode_string("(ಠ_ಠ) 🪄 ⠁⭒*.✫.*⭒⠁");
116 SEQ_FIVE_KEYS(KC_S, KC_M, KC_I, KC_L, KC_E) {
117 send_unicode_string("😊");
118 }
119
120 SEQ_FIVE_KEYS(KC_P, KC_A, KC_R, KC_T, KC_Y) {
121 send_unicode_string("🎉");
122 }
123
124 SEQ_FOUR_KEYS(KC_E, KC_Y, KC_E, KC_S) {
125 send_unicode_string("(ಠ_ಠ)");
126 }
127
128 SEQ_FIVE_KEYS(KC_M, KC_A, KC_G, KC_I, KC_C) {
129 send_unicode_string("(ಠ_ಠ) 🪄 ⠁⭒*.✫.*⭒⠁");
130 }
131
132 SEQ_FIVE_KEYS(KC_T, KC_A, KC_B, KC_L, KC_E) {
133 send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻");
134 }
135
136 SEQ_FIVE_KEYS(KC_S, KC_H, KC_R, KC_U, KC_G) {
137 send_unicode_string("¯\\_(ツ)_/¯");
138 }
139 } 123 }
140 124
125 if (leader_sequence_five_keys(KC_T, KC_A, KC_B, KC_L, KC_E)) {
126 send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻");
127 }
128
129 if (leader_sequence_five_keys(KC_S, KC_H, KC_R, KC_U, KC_G)) {
130 send_unicode_string("¯\\_(ツ)_/¯");
131 }
132}
133
134void matrix_scan_user(void) {
141 if (wiggle_mouse && timer_elapsed(wiggle_timer) > next_wiggle) { 135 if (wiggle_mouse && timer_elapsed(wiggle_timer) > next_wiggle) {
142 wiggle_timer = timer_read(); 136 wiggle_timer = timer_read();
143 137
diff --git a/keyboards/kprepublic/bm65hsrgb_iso/keymaps/p4yne/keymap.c b/keyboards/kprepublic/bm65hsrgb_iso/keymaps/p4yne/keymap.c
index a2719798de..03d1ddabed 100644
--- a/keyboards/kprepublic/bm65hsrgb_iso/keymaps/p4yne/keymap.c
+++ b/keyboards/kprepublic/bm65hsrgb_iso/keymaps/p4yne/keymap.c
@@ -446,27 +446,18 @@ bool rgb_matrix_indicators_user(void) {
446 return false; 446 return false;
447} 447}
448 448
449#ifdef LEADER_ENABLE 449void leader_end_user(void) {
450LEADER_EXTERNS(); 450 if (leader_sequence_one_key(KC_F)) {
451 451 // Anything you can do in a macro.
452void matrix_scan_user(void) { 452 SEND_STRING("QMK is awesome.");
453 LEADER_DICTIONARY() { 453 }
454 leading = false; 454 if (leader_sequence_two_keys(KC_D, KC_D)) {
455 leader_end(); 455 SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
456 456 }
457 SEQ_ONE_KEY(KC_F) { 457 if (leader_sequence_two_keys(KC_S, KC_S)) {
458 // Anything you can do in a macro. 458 SEND_STRING(SS_LCTL("v"));
459 SEND_STRING("QMK is awesome."); 459 }
460 } 460 if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
461 SEQ_TWO_KEYS(KC_D, KC_D) { 461 SEND_STRING("https://start.duckduckgo.com\n");
462 SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
463 }
464 SEQ_TWO_KEYS(KC_S, KC_S) {
465 SEND_STRING(SS_LCTL("v"));
466 }
467 SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
468 SEND_STRING("https://start.duckduckgo.com\n");
469 }
470 } 462 }
471} 463}
472#endif
diff --git a/keyboards/kprepublic/bm65hsrgb_iso/rev1/keymaps/deadolus/keymap.c b/keyboards/kprepublic/bm65hsrgb_iso/rev1/keymaps/deadolus/keymap.c
index d150416bed..11f8103297 100644
--- a/keyboards/kprepublic/bm65hsrgb_iso/rev1/keymaps/deadolus/keymap.c
+++ b/keyboards/kprepublic/bm65hsrgb_iso/rev1/keymaps/deadolus/keymap.c
@@ -255,30 +255,19 @@ bool rgb_matrix_indicators_user(void) {
255 return false; 255 return false;
256} 256}
257 257
258#ifdef LEADER_ENABLE 258void leader_end_user(void) {
259LEADER_EXTERNS(); 259 if (leader_sequence_one_key(KC_F)) {
260 260 // Anything you can do in a macro.
261//SEND_STRING seems to be local dependent. 261 SEND_STRING("QMK is awesome.");
262//For swiss-german layout I have to send "ctrl+." to get ":" 262 }
263void matrix_scan_user(void) { 263 if (leader_sequence_two_keys(KC_D, KC_D)) {
264 LEADER_DICTIONARY() { 264 SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
265 leading = false; 265 }
266 leader_end(); 266 if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
267 267 SEND_STRING("https");
268 SEQ_ONE_KEY(KC_F) { 268 register_code(KC_LSFT);
269 // Anything you can do in a macro. 269 SEND_STRING(".77");
270 SEND_STRING("QMK is awesome."); 270 unregister_code(KC_LSFT);
271 } 271 SEND_STRING("start.duckduckgo.com\n");
272 SEQ_TWO_KEYS(KC_D, KC_D) {
273 SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
274 }
275 SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
276 SEND_STRING("https");
277 register_code(KC_LSFT);
278 SEND_STRING(".77");
279 unregister_code(KC_LSFT);
280 SEND_STRING("start.duckduckgo.com\n");
281 }
282 } 272 }
283} 273}
284#endif
diff --git a/keyboards/massdrop/alt/keymaps/jdelkins/keymap.c b/keyboards/massdrop/alt/keymaps/jdelkins/keymap.c
index 4c9a8860f4..64a9f6f598 100644
--- a/keyboards/massdrop/alt/keymaps/jdelkins/keymap.c
+++ b/keyboards/massdrop/alt/keymaps/jdelkins/keymap.c
@@ -256,6 +256,54 @@ static void set_rgb_layer(int layer) {
256 } 256 }
257} 257}
258 258
259void leader_end_user(void) {
260 if (leader_sequence_one_key(KC_K)) {
261 layer_invert(_KP);
262 }
263 if (leader_sequence_one_key(KC_G)) {
264 layer_invert(_GAME);
265 }
266 if (leader_sequence_one_key(KC_KP_5)) {
267 layer_invert(_KP);
268 }
269 if (leader_sequence_two_keys(KC_SCLN, KC_1)) {
270 send_secret_string(0);
271 }
272 if (leader_sequence_two_keys(KC_SCLN, KC_2)) {
273 send_secret_string(1);
274 }
275 if (leader_sequence_two_keys(KC_SCLN, KC_3)) {
276 send_secret_string(2);
277 }
278 if (leader_sequence_two_keys(KC_SCLN, KC_4)) {
279 send_secret_string(3);
280 }
281 if (leader_sequence_two_keys(KC_SCLN, KC_5)) {
282 send_secret_string(4);
283 }
284 if (leader_sequence_two_keys(KC_SCLN, KC_6)) {
285 send_secret_string(5);
286 }
287 if (leader_sequence_two_keys(KC_SCLN, KC_M)) {
288 send_secret_string(0);
289 }
290 if (leader_sequence_two_keys(KC_SCLN, KC_COMM)) {
291 send_secret_string(1);
292 }
293 if (leader_sequence_two_keys(KC_SCLN, KC_DOT)) {
294 send_secret_string(2);
295 }
296 if (leader_sequence_two_keys(KC_SCLN, KC_J)) {
297 send_secret_string(3);
298 }
299 if (leader_sequence_two_keys(KC_SCLN, KC_K)) {
300 send_secret_string(4);
301 }
302 if (leader_sequence_two_keys(KC_SCLN, KC_L)) {
303 send_secret_string(5);
304 }
305}
306
259// Runs just one time when the keyboard initializes. 307// Runs just one time when the keyboard initializes.
260void matrix_init_keymap(void) { 308void matrix_init_keymap(void) {
261 // force numlock on upon startup 309 // force numlock on upon startup
@@ -264,8 +312,6 @@ void matrix_init_keymap(void) {
264 } 312 }
265}; 313};
266 314
267LEADER_EXTERNS();
268
269// Runs constantly in the background, in a loop. 315// Runs constantly in the background, in a loop.
270void matrix_scan_keymap(void) { 316void matrix_scan_keymap(void) {
271 if (rgb_matrix_get_flags() != LED_FLAG_NONE && timer_elapsed(rgb_timer) > 1000) { 317 if (rgb_matrix_get_flags() != LED_FLAG_NONE && timer_elapsed(rgb_timer) > 1000) {
@@ -282,56 +328,6 @@ void matrix_scan_keymap(void) {
282 else 328 else
283 rgb_matrix_set_color(15, 0, 0, 0); 329 rgb_matrix_set_color(15, 0, 0, 0);
284 } 330 }
285 LEADER_DICTIONARY() {
286 leading = false;
287 leader_end();
288
289 SEQ_ONE_KEY(KC_K) {
290 layer_invert(_KP);
291 }
292 SEQ_ONE_KEY(KC_G) {
293 layer_invert(_GAME);
294 }
295 SEQ_ONE_KEY(KC_KP_5) {
296 layer_invert(_KP);
297 }
298 SEQ_TWO_KEYS(KC_SCLN, KC_1) {
299 send_secret_string(0);
300 }
301 SEQ_TWO_KEYS(KC_SCLN, KC_2) {
302 send_secret_string(1);
303 }
304 SEQ_TWO_KEYS(KC_SCLN, KC_3) {
305 send_secret_string(2);
306 }
307 SEQ_TWO_KEYS(KC_SCLN, KC_4) {
308 send_secret_string(3);
309 }
310 SEQ_TWO_KEYS(KC_SCLN, KC_5) {
311 send_secret_string(4);
312 }
313 SEQ_TWO_KEYS(KC_SCLN, KC_6) {
314 send_secret_string(5);
315 }
316 SEQ_TWO_KEYS(KC_SCLN, KC_M) {
317 send_secret_string(0);
318 }
319 SEQ_TWO_KEYS(KC_SCLN, KC_COMM) {
320 send_secret_string(1);
321 }
322 SEQ_TWO_KEYS(KC_SCLN, KC_DOT) {
323 send_secret_string(2);
324 }
325 SEQ_TWO_KEYS(KC_SCLN, KC_J) {
326 send_secret_string(3);
327 }
328 SEQ_TWO_KEYS(KC_SCLN, KC_K) {
329 send_secret_string(4);
330 }
331 SEQ_TWO_KEYS(KC_SCLN, KC_L) {
332 send_secret_string(5);
333 }
334 }
335}; 331};
336 332
337layer_state_t layer_state_set_keymap(layer_state_t state) { 333layer_state_t layer_state_set_keymap(layer_state_t state) {
diff --git a/keyboards/maxr1998/phoebe/keymaps/default/keymap.c b/keyboards/maxr1998/phoebe/keymaps/default/keymap.c
index 74a70f6174..b83d51f32a 100644
--- a/keyboards/maxr1998/phoebe/keymaps/default/keymap.c
+++ b/keyboards/maxr1998/phoebe/keymaps/default/keymap.c
@@ -130,18 +130,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
130 return true; 130 return true;
131}; 131};
132 132
133LEADER_EXTERNS(); 133void leader_end_user(void) {
134 134 if (leader_sequence_two_keys(KC_G, KC_P)) {
135void matrix_scan_user(void) { 135 SEND_STRING("git push");
136 LEADER_DICTIONARY() { 136 }
137 leading = false; 137 if (leader_sequence_three_keys(KC_G, KC_F, KC_P)) {
138 leader_end(); 138 SEND_STRING("git push --force-with-lease");
139
140 SEQ_TWO_KEYS(KC_G, KC_P) {
141 SEND_STRING("git push");
142 }
143 SEQ_THREE_KEYS(KC_G, KC_F, KC_P) {
144 SEND_STRING("git push --force-with-lease");
145 }
146 } 139 }
147} 140}
diff --git a/keyboards/mechkeys/mechmini/v2/keymaps/wsturgiss/keymap.c b/keyboards/mechkeys/mechmini/v2/keymaps/wsturgiss/keymap.c
index 2338bb7d04..85725c8c5c 100644
--- a/keyboards/mechkeys/mechmini/v2/keymaps/wsturgiss/keymap.c
+++ b/keyboards/mechkeys/mechmini/v2/keymaps/wsturgiss/keymap.c
@@ -50,39 +50,30 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
50}; 50};
51 51
52//Leader maps 52//Leader maps
53 53void leader_end_user(void) {
54 54 if (leader_sequence_one_key(KC_F)) {
55LEADER_EXTERNS(); 55 // Anything you can do in a macro.
56 56 SEND_STRING("QMK is awesome.");
57void matrix_scan_user(void) {
58 LEADER_DICTIONARY() {
59 leading = false;
60 leader_end();
61
62 SEQ_ONE_KEY(KC_F) {
63 // Anything you can do in a macro.
64 SEND_STRING("QMK is awesome.");
65 } 57 }
66 //tableflip (LEADER - TF) 58 //tableflip (LEADER - TF)
67 SEQ_TWO_KEYS(KC_T, KC_F) { 59 if (leader_sequence_two_keys(KC_T, KC_F)) {
68 set_unicode_input_mode(UNICODE_MODE_MACOS); 60 set_unicode_input_mode(UNICODE_MODE_MACOS);
69 send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻"); 61 send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻");
70 } 62 }
71 //screencap (LEADER - SC) 63 //screencap (LEADER - SC)
72 SEQ_TWO_KEYS(KC_S, KC_C) { 64 if (leader_sequence_two_keys(KC_S, KC_C)) {
73 SEND_STRING(SS_LGUI(SS_LSFT(SS_TAP(X_4)))); 65 SEND_STRING(SS_LGUI(SS_LSFT(SS_TAP(X_4))));
74 } 66 }
75 //screencap (LEADER - TM) 67 //screencap (LEADER - TM)
76 SEQ_TWO_KEYS(KC_T, KC_M) { 68 if (leader_sequence_two_keys(KC_T, KC_M)) {
77 set_unicode_input_mode(UNICODE_MODE_MACOS); 69 set_unicode_input_mode(UNICODE_MODE_MACOS);
78 register_unicode(0x2122); // ™ 70 register_unicode(0x2122); // ™
79 } 71 }
80 /* 72 /*
81 SEQ_THREE_KEYS(KC_D, KC_D, KC_S) { 73 if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
82 SEND_STRING("https://start.duckduckgo.com"SS_TAP(X_ENTER)); 74 SEND_STRING("https://start.duckduckgo.com"SS_TAP(X_ENTER));
83 } 75 }
84 */ 76 */
85 }
86} 77}
87 78
88//change colors and rgb modes on layer change 79//change colors and rgb modes on layer change
diff --git a/keyboards/planck/keymaps/copface/keymap.c b/keyboards/planck/keymaps/copface/keymap.c
index 8435ef405d..376ceeb288 100644
--- a/keyboards/planck/keymaps/copface/keymap.c
+++ b/keyboards/planck/keymaps/copface/keymap.c
@@ -157,47 +157,41 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
157 return true; 157 return true;
158} 158}
159 159
160LEADER_EXTERNS(); 160void leader_end_user(void) {
161void matrix_scan_user(void) { 161 // Screenshot
162 LEADER_DICTIONARY() { 162 if (leader_sequence_one_key(KC_S)) {
163 leading = false; 163 tap_code16(G(C(S(KC_4))));
164 leader_end(); 164 }
165 165 // Record Screen
166 // Screenshot 166 if (leader_sequence_two_keys(KC_S, KC_S)) {
167 SEQ_ONE_KEY(KC_S) { 167 tap_code16(S(G(KC_5)));
168 tap_code16(G(C(S(KC_4)))); 168 }
169 } 169 // 1Pass browser
170 // Record Screen 170 if (leader_sequence_one_key(KC_A)) {
171 SEQ_TWO_KEYS(KC_S, KC_S) { 171 tap_code16(G(A(KC_BSLS)));
172 tap_code16(S(G(KC_5))); 172 }
173 } 173 // 1Pass mini
174 // 1Pass browser 174 if (leader_sequence_two_keys(KC_A, KC_A)) {
175 SEQ_ONE_KEY(KC_A) { 175 tap_code16(G(KC_BSLS));
176 tap_code16(G(A(KC_BSLS))); 176 }
177 } 177 // Comment out
178 // 1Pass mini 178 if (leader_sequence_one_key(KC_F)) {
179 SEQ_TWO_KEYS(KC_A, KC_A) { 179 tap_code16(G(KC_SLSH));
180 tap_code16(G(KC_BSLS)); 180 }
181 } 181 // Spotlight
182 // Comment out 182 if (leader_sequence_one_key(KC_SPC)) {
183 SEQ_ONE_KEY(KC_F) { 183 tap_code16(G(KC_SPC));
184 tap_code16(G(KC_SLSH)); 184 }
185 } 185 // Auto format
186 // Spotlight 186 if (leader_sequence_one_key(KC_ENT)) {
187 SEQ_ONE_KEY(KC_SPC) { 187 tap_code16(S(G(A(KC_F))));
188 tap_code16(G(KC_SPC)); 188 }
189 } 189 // Focus file tree
190 // Auto format 190 if (leader_sequence_one_key(KC_TAB)) {
191 SEQ_ONE_KEY(KC_ENT) { 191 tap_code16(G(KC_1));
192 tap_code16(S(G(A(KC_F)))); 192 }
193 } 193 // Caps-lock
194 // Focus file tree 194 if (leader_sequence_two_keys(KC_TAB, KC_TAB)) {
195 SEQ_ONE_KEY(KC_TAB) { 195 tap_code16(KC_CAPS);
196 tap_code16(G(KC_1));
197 }
198 // Caps-lock
199 SEQ_TWO_KEYS(KC_TAB, KC_TAB) {
200 tap_code16(KC_CAPS);
201 }
202 } 196 }
203} 197}
diff --git a/keyboards/planck/keymaps/experimental/keymap.c b/keyboards/planck/keymaps/experimental/keymap.c
index e0ade650fe..d5c7425439 100644
--- a/keyboards/planck/keymaps/experimental/keymap.c
+++ b/keyboards/planck/keymaps/experimental/keymap.c
@@ -372,39 +372,32 @@ void music_scale_user(void)
372 372
373#endif 373#endif
374 374
375LEADER_EXTERNS(); 375void leader_end_user(void) {
376 376 if (leader_sequence_one_key(KC_R)) {
377void matrix_scan_user(void) { 377 tap_random_base64();
378 LEADER_DICTIONARY() { 378 tap_random_base64();
379 leading = false; 379 tap_random_base64();
380 leader_end(); 380 tap_random_base64();
381 381 tap_random_base64();
382 SEQ_ONE_KEY (KC_R) { 382 tap_random_base64();
383 tap_random_base64(); 383 tap_random_base64();
384 tap_random_base64(); 384 tap_random_base64();
385 tap_random_base64(); 385 tap_random_base64();
386 tap_random_base64(); 386 }
387 tap_random_base64(); 387 if (leader_sequence_one_key(KC_V)) {
388 tap_random_base64(); 388 SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
389 tap_random_base64(); 389 }
390 tap_random_base64(); 390 if (leader_sequence_one_key(KC_F)) {
391 tap_random_base64(); 391 SEND_STRING("if yes\n\tpeanut butter\nelse\n\trice snacks");
392 } 392 }
393 SEQ_ONE_KEY (KC_V) { 393 if (leader_sequence_two_keys(KC_A, KC_S)) {
394 SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); 394 register_code(KC_H);
395 } 395 unregister_code(KC_H);
396 SEQ_ONE_KEY(KC_F) { 396 }
397 SEND_STRING("if yes\n\tpeanut butter\nelse\n\trice snacks"); 397 if (leader_sequence_three_keys(KC_A, KC_S, KC_D)) {
398 } 398 register_code(KC_LGUI);
399 SEQ_TWO_KEYS(KC_A, KC_S) { 399 register_code(KC_S);
400 register_code(KC_H); 400 unregister_code(KC_S);
401 unregister_code(KC_H); 401 unregister_code(KC_LGUI);
402 }
403 SEQ_THREE_KEYS(KC_A, KC_S, KC_D) {
404 register_code(KC_LGUI);
405 register_code(KC_S);
406 unregister_code(KC_S);
407 unregister_code(KC_LGUI);
408 }
409 } 402 }
410} 403}
diff --git a/keyboards/planck/keymaps/jdelkins/keymap.c b/keyboards/planck/keymaps/jdelkins/keymap.c
index 9d306abc78..ecb49da406 100644
--- a/keyboards/planck/keymaps/jdelkins/keymap.c
+++ b/keyboards/planck/keymaps/jdelkins/keymap.c
@@ -408,7 +408,64 @@ void keyboard_post_init_keymap(void) {
408 bspc_timer = 0; 408 bspc_timer = 0;
409} 409}
410 410
411LEADER_EXTERNS(); 411void leader_end_user(void) {
412 if (leader_sequence_one_key(KC_K)) {
413 layer_invert(_KP);
414 }
415 if (leader_sequence_one_key(KC_G)) {
416 layer_invert(_GAME);
417 }
418 if (leader_sequence_one_key(KC_KP_5)) {
419 layer_invert(_KP);
420 }
421 if (leader_sequence_one_key(KC_5)) {
422 layer_invert(_KP);
423 }
424 if (leader_sequence_two_keys(KC_SCLN, KC_1)) {
425 send_secret_string(0);
426 }
427 if (leader_sequence_two_keys(KC_SCLN, KC_2)) {
428 send_secret_string(1);
429 }
430 if (leader_sequence_two_keys(KC_SCLN, KC_3)) {
431 send_secret_string(2);
432 }
433 if (leader_sequence_two_keys(KC_SCLN, KC_4)) {
434 send_secret_string(3);
435 }
436 if (leader_sequence_two_keys(KC_SCLN, KC_5)) {
437 send_secret_string(4);
438 }
439 if (leader_sequence_two_keys(KC_SCLN, KC_6)) {
440 send_secret_string(5);
441 }
442 if (leader_sequence_two_keys(KC_SCLN, KC_M)) {
443 send_secret_string(0);
444 }
445 if (leader_sequence_two_keys(KC_SCLN, KC_COMM)) {
446 send_secret_string(1);
447 }
448 if (leader_sequence_two_keys(KC_SCLN, KC_DOT)) {
449 send_secret_string(2);
450 }
451 if (leader_sequence_two_keys(KC_SCLN, KC_J)) {
452 send_secret_string(3);
453 }
454 if (leader_sequence_two_keys(KC_SCLN, KC_K)) {
455 send_secret_string(4);
456 }
457 if (leader_sequence_two_keys(KC_SCLN, KC_L)) {
458 send_secret_string(5);
459 }
460 if (leader_sequence_one_key(KC_C)) {
461 tap_code16(C(KC_C));
462 }
463 // neovim: terminal escape
464 if (leader_sequence_one_key(KC_QUOT)) {
465 tap_code16(C(KC_BSLS));
466 tap_code16(C(KC_N));
467 }
468}
412 469
413void matrix_scan_keymap(void) { 470void matrix_scan_keymap(void) {
414#ifdef AUDIO_ENABLE 471#ifdef AUDIO_ENABLE
@@ -436,67 +493,6 @@ void matrix_scan_keymap(void) {
436 bspc_timer = 0; 493 bspc_timer = 0;
437 register_code(KC_BSPC); 494 register_code(KC_BSPC);
438 } 495 }
439 LEADER_DICTIONARY() {
440 leading = false;
441 leader_end();
442
443 SEQ_ONE_KEY(KC_K) {
444 layer_invert(_KP);
445 }
446 SEQ_ONE_KEY(KC_G) {
447 layer_invert(_GAME);
448 }
449 SEQ_ONE_KEY(KC_KP_5) {
450 layer_invert(_KP);
451 }
452 SEQ_ONE_KEY(KC_5) {
453 layer_invert(_KP);
454 }
455 SEQ_TWO_KEYS(KC_SCLN, KC_1) {
456 send_secret_string(0);
457 }
458 SEQ_TWO_KEYS(KC_SCLN, KC_2) {
459 send_secret_string(1);
460 }
461 SEQ_TWO_KEYS(KC_SCLN, KC_3) {
462 send_secret_string(2);
463 }
464 SEQ_TWO_KEYS(KC_SCLN, KC_4) {
465 send_secret_string(3);
466 }
467 SEQ_TWO_KEYS(KC_SCLN, KC_5) {
468 send_secret_string(4);
469 }
470 SEQ_TWO_KEYS(KC_SCLN, KC_6) {
471 send_secret_string(5);
472 }
473 SEQ_TWO_KEYS(KC_SCLN, KC_M) {
474 send_secret_string(0);
475 }
476 SEQ_TWO_KEYS(KC_SCLN, KC_COMM) {
477 send_secret_string(1);
478 }
479 SEQ_TWO_KEYS(KC_SCLN, KC_DOT) {
480 send_secret_string(2);
481 }
482 SEQ_TWO_KEYS(KC_SCLN, KC_J) {
483 send_secret_string(3);
484 }
485 SEQ_TWO_KEYS(KC_SCLN, KC_K) {
486 send_secret_string(4);
487 }
488 SEQ_TWO_KEYS(KC_SCLN, KC_L) {
489 send_secret_string(5);
490 }
491 SEQ_ONE_KEY(KC_C) {
492 tap_code16(C(KC_C));
493 }
494 // neovim: terminal escape
495 SEQ_ONE_KEY(KC_QUOT) {
496 tap_code16(C(KC_BSLS));
497 tap_code16(C(KC_N));
498 }
499 }
500} 496}
501 497
502bool music_mask_user(uint16_t keycode) { 498bool music_mask_user(uint16_t keycode) {
diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c
index eb3391c171..b206b8511e 100644
--- a/keyboards/planck/keymaps/jweickm/keymap.c
+++ b/keyboards/planck/keymaps/jweickm/keymap.c
@@ -984,31 +984,26 @@ bool dip_switch_update_user(uint8_t index, bool active) {
984 return true; 984 return true;
985} 985}
986 986
987 987void leader_end_user(void) {
988LEADER_EXTERNS(); 988 if (leader_sequence_one_key(KC_F)) {
989
990void matrix_scan_user(void) {
991 LEADER_DICTIONARY() {
992 leading = false;
993 leader_end();
994
995 SEQ_ONE_KEY(KC_F) {
996 // Anything you can do in a macro. 989 // Anything you can do in a macro.
997 SEND_STRING("QMK is awesome."); 990 SEND_STRING("QMK is awesome.");
998 } 991 }
999 SEQ_TWO_KEYS(KC_D, KC_D) { 992 if (leader_sequence_two_keys(KC_D, KC_D)) {
1000 SEND_STRING(SS_LCTL("a") SS_LCTL("c")); 993 SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
1001 } 994 }
1002 SEQ_THREE_KEYS(KC_D, KC_D, KC_S) { 995 if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
1003 SEND_STRING("https://start.duckduckgo.com\n"); 996 SEND_STRING("https://start.duckduckgo.com\n");
1004 } 997 }
1005 SEQ_TWO_KEYS(KC_A, KC_S) { 998 if (leader_sequence_two_keys(KC_A, KC_S)) {
1006 register_code(KC_LGUI); 999 register_code(KC_LGUI);
1007 register_code(KC_S); 1000 register_code(KC_S);
1008 unregister_code(KC_S); 1001 unregister_code(KC_S);
1009 unregister_code(KC_LGUI); 1002 unregister_code(KC_LGUI);
1010 } 1003 }
1011 } 1004}
1005
1006void matrix_scan_user(void) {
1012#ifdef AUDIO_ENABLE 1007#ifdef AUDIO_ENABLE
1013 if (muse_mode) { 1008 if (muse_mode) {
1014 if (muse_counter == 0) { 1009 if (muse_counter == 0) {
diff --git a/keyboards/planck/keymaps/rootiest/keymap.c b/keyboards/planck/keymaps/rootiest/keymap.c
index 5aec280af3..ce3b69ed1f 100644
--- a/keyboards/planck/keymaps/rootiest/keymap.c
+++ b/keyboards/planck/keymaps/rootiest/keymap.c
@@ -240,7 +240,6 @@ uint16_t muse_tempo = 50;
240 240
241// Used by Leader key chords 241// Used by Leader key chords
242bool did_leader_succeed; 242bool did_leader_succeed;
243LEADER_EXTERNS();
244 243
245// Tap-Dance stuffs, initializing functions that are coded further below 244// Tap-Dance stuffs, initializing functions that are coded further below
246td_state_t cur_dance(tap_dance_state_t* state); 245td_state_t cur_dance(tap_dance_state_t* state);
@@ -1404,6 +1403,81 @@ void leader_start_user(void) {
1404} 1403}
1405// Called when either the leader sequence is completed, or the leader timeout is hit 1404// Called when either the leader sequence is completed, or the leader timeout is hit
1406void leader_end_user(void) { 1405void leader_end_user(void) {
1406 did_leader_succeed = false;
1407
1408 if (leader_sequence_one_key(KC_E)) {
1409 SEND_STRING(SS_LCTL(SS_LSFT("t")));
1410 did_leader_succeed = true;
1411 }
1412 if (leader_sequence_one_key(KC_C)) {
1413 SEND_STRING(SS_LGUI("r") SS_DELAY(250) "calc\n");
1414 did_leader_succeed = true;
1415 }
1416 else if (leader_sequence_one_key(KC_V)) {
1417 SEND_STRING(SS_LCTL("v"));
1418 did_leader_succeed = true;
1419 }
1420 else if (leader_sequence_two_keys(KC_E, KC_D)) {
1421 SEND_STRING(SS_LGUI("r") "cmd\n" SS_LCTL("c"));
1422 did_leader_succeed = true;
1423 }
1424 else if (leader_sequence_two_keys(KC_A, KC_C)) {
1425 SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
1426 did_leader_succeed = true;
1427 }
1428 else if (leader_sequence_three_keys(KC_C, KC_A, KC_T)) {
1429 send_unicode_string("😸");
1430 did_leader_succeed = true;
1431 }
1432 else if (leader_sequence_three_keys(KC_B, KC_A, KC_T)) {
1433 send_unicode_string("🦇");
1434 did_leader_succeed = true;
1435 }
1436 else if (leader_sequence_three_keys(KC_D, KC_O, KC_G)) {
1437 send_unicode_string("🐶");
1438 did_leader_succeed = true;
1439 }
1440 else if (leader_sequence_five_keys(KC_S, KC_M, KC_I, KC_L, KC_E)) {
1441 send_unicode_string("🙂");
1442 did_leader_succeed = true;
1443 }
1444 else if (leader_sequence_four_keys(KC_H, KC_A, KC_P, KC_Y)) {
1445 send_unicode_string("🙂");
1446 did_leader_succeed = true;
1447 }
1448 else if (leader_sequence_five_keys(KC_H, KC_A, KC_P, KC_P, KC_Y)) {
1449 send_unicode_string("🙂");
1450 did_leader_succeed = true;
1451 }
1452 else if (leader_sequence_three_keys(KC_S, KC_A, KC_D)) {
1453 send_unicode_string("🙁");
1454 did_leader_succeed = true;
1455 }
1456 else if (leader_sequence_three_keys(KC_Y, KC_E, KC_S)) {
1457 send_unicode_string("👍");
1458 did_leader_succeed = true;
1459 }
1460 else if (leader_sequence_two_keys(KC_N, KC_O)) {
1461 send_unicode_string("👎");
1462 did_leader_succeed = true;
1463 }
1464 else if (leader_sequence_three_keys(KC_W, KC_O, KC_W)) {
1465 send_unicode_string("🤯");
1466 did_leader_succeed = true;
1467 }
1468 else if (leader_sequence_three_keys(KC_P, KC_O, KC_O)) {
1469 send_unicode_string("💩");
1470 did_leader_succeed = true;
1471 }
1472 else if (leader_sequence_four_keys(KC_P, KC_O, KC_O, KC_P)) {
1473 send_unicode_string("💩");
1474 did_leader_succeed = true;
1475 }
1476 else if (leader_sequence_four_keys(KC_B, KC_O, KC_A, KC_T)) {
1477 send_unicode_string("⛵");
1478 did_leader_succeed = true;
1479 }
1480
1407 if (did_leader_succeed) { 1481 if (did_leader_succeed) {
1408#ifdef AUDIO_ENABLE 1482#ifdef AUDIO_ENABLE
1409 PLAY_SONG(leader_succeed); 1483 PLAY_SONG(leader_succeed);
@@ -1758,84 +1832,6 @@ void matrix_scan_user(void) {
1758 is_alt_tab_active = false; 1832 is_alt_tab_active = false;
1759 } 1833 }
1760 } 1834 }
1761 // Monitor and perform leader-key chords
1762 LEADER_DICTIONARY() {
1763 did_leader_succeed = leading = false;
1764
1765 SEQ_ONE_KEY(KC_E) {
1766 SEND_STRING(SS_LCTL(SS_LSFT("t")));
1767 did_leader_succeed = true;
1768 }
1769 SEQ_ONE_KEY(KC_C) {
1770 SEND_STRING(SS_LGUI("r") SS_DELAY(250) "calc\n");
1771 did_leader_succeed = true;
1772 }
1773 else SEQ_ONE_KEY(KC_V) {
1774 SEND_STRING(SS_LCTL("v"));
1775 did_leader_succeed = true;
1776 }
1777 else SEQ_TWO_KEYS(KC_E, KC_D) {
1778 SEND_STRING(SS_LGUI("r") "cmd\n" SS_LCTL("c"));
1779 did_leader_succeed = true;
1780 }
1781 else SEQ_TWO_KEYS(KC_A, KC_C) {
1782 SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
1783 did_leader_succeed = true;
1784 }
1785 else SEQ_THREE_KEYS(KC_C, KC_A, KC_T) {
1786 send_unicode_string("😸");
1787 did_leader_succeed = true;
1788 }
1789 else SEQ_THREE_KEYS(KC_B, KC_A, KC_T) {
1790 send_unicode_string("🦇");
1791 did_leader_succeed = true;
1792 }
1793 else SEQ_THREE_KEYS(KC_D, KC_O, KC_G) {
1794 send_unicode_string("🐶");
1795 did_leader_succeed = true;
1796 }
1797 else SEQ_FIVE_KEYS(KC_S, KC_M, KC_I, KC_L, KC_E) {
1798 send_unicode_string("🙂");
1799 did_leader_succeed = true;
1800 }
1801 else SEQ_FOUR_KEYS(KC_H, KC_A, KC_P, KC_Y) {
1802 send_unicode_string("🙂");
1803 did_leader_succeed = true;
1804 }
1805 else SEQ_FIVE_KEYS(KC_H, KC_A, KC_P, KC_P, KC_Y) {
1806 send_unicode_string("🙂");
1807 did_leader_succeed = true;
1808 }
1809 else SEQ_THREE_KEYS(KC_S, KC_A, KC_D) {
1810 send_unicode_string("🙁");
1811 did_leader_succeed = true;
1812 }
1813 else SEQ_THREE_KEYS(KC_Y, KC_E, KC_S) {
1814 send_unicode_string("👍");
1815 did_leader_succeed = true;
1816 }
1817 else SEQ_TWO_KEYS(KC_N, KC_O) {
1818 send_unicode_string("👎");
1819 did_leader_succeed = true;
1820 }
1821 else SEQ_THREE_KEYS(KC_W, KC_O, KC_W) {
1822 send_unicode_string("🤯");
1823 did_leader_succeed = true;
1824 }
1825 else SEQ_THREE_KEYS(KC_P, KC_O, KC_O) {
1826 send_unicode_string("💩");
1827 did_leader_succeed = true;
1828 }
1829 else SEQ_FOUR_KEYS(KC_P, KC_O, KC_O, KC_P) {
1830 send_unicode_string("💩");
1831 did_leader_succeed = true;
1832 }
1833 else SEQ_FOUR_KEYS(KC_B, KC_O, KC_A, KC_T) {
1834 send_unicode_string("⛵");
1835 did_leader_succeed = true;
1836 }
1837 leader_end();
1838 }
1839 // Run the wake-up RGB animation if performing wake-up 1835 // Run the wake-up RGB animation if performing wake-up
1840 if (do_wake_animation) { 1836 if (do_wake_animation) {
1841 rgb_wakeup_sequence(); 1837 rgb_wakeup_sequence();
diff --git a/keyboards/planck/keymaps/yhaliaw/keymap.c b/keyboards/planck/keymaps/yhaliaw/keymap.c
index 62d856e9f2..8931101fef 100644
--- a/keyboards/planck/keymaps/yhaliaw/keymap.c
+++ b/keyboards/planck/keymaps/yhaliaw/keymap.c
@@ -158,36 +158,24 @@ void keyboard_post_init_user(void) {
158} 158}
159 159
160bool leader_found; 160bool leader_found;
161LEADER_EXTERNS();
162
163void matrix_scan_user(void) {
164 LEADER_DICTIONARY() {
165 leading = false;
166 leader_found = false;
167 SEQ_ONE_KEY(L_RESET) {
168 leader_found = true;
169 reset_keyboard();
170 }
171 else
172 SEQ_ONE_KEY(KC_DEL) {
173 leader_found = true;
174 layer_clear();
175 }
176 else
177 SEQ_ONE_KEY(LOWER) {
178 leader_found = true;
179 layer_on(_LOWER);
180 }
181 else
182 SEQ_ONE_KEY(RAISE) {
183 leader_found = true;
184 layer_on(_RAISE);
185 }
186 leader_end();
187 }
188}
189 161
190void leader_end_user(void) { 162void leader_end_user(void) {
163 leader_found = false;
164
165 if (leader_sequence_one_key(L_RESET)) {
166 leader_found = true;
167 reset_keyboard();
168 } else if (leader_sequence_one_key(KC_DEL)) {
169 leader_found = true;
170 layer_clear();
171 } else if (leader_sequence_one_key(LOWER)) {
172 leader_found = true;
173 layer_on(_LOWER);
174 } else if (leader_sequence_one_key(RAISE)) {
175 leader_found = true;
176 layer_on(_RAISE);
177 }
178
191 // Plays sound on if leader sequence found. 179 // Plays sound on if leader sequence found.
192 if (leader_found) { 180 if (leader_found) {
193#ifdef AUDIO_ENABLE 181#ifdef AUDIO_ENABLE
diff --git a/keyboards/preonic/keymaps/brauner/keymap.c b/keyboards/preonic/keymaps/brauner/keymap.c
index 123a4fc215..fa1c7611cf 100644
--- a/keyboards/preonic/keymaps/brauner/keymap.c
+++ b/keyboards/preonic/keymaps/brauner/keymap.c
@@ -363,44 +363,35 @@ bool dip_switch_update_user(uint8_t index, bool active) {
363 return true; 363 return true;
364} 364}
365 365
366LEADER_EXTERNS();
367
368static inline void register_ctrl_sequence(uint16_t keycode) { 366static inline void register_ctrl_sequence(uint16_t keycode) {
369 tap_code16(RCTL(keycode)); 367 tap_code16(RCTL(keycode));
370} 368}
371 369
372static inline void leader_bindings(void) { 370void leader_end_user(void) {
373 LEADER_DICTIONARY() { 371 if (leader_sequence_three_keys(KC_A, KC_C, KC_K)) {
374 leading = false; 372 SEND_STRING("Acked-by: Christian Brauner <brauner@kernel.org>");
375 leader_end(); 373 }
376
377 SEQ_THREE_KEYS(KC_A, KC_C, KC_K) {
378 SEND_STRING("Acked-by: Christian Brauner <brauner@kernel.org>");
379 }
380 374
381 SEQ_THREE_KEYS(KC_R, KC_V, KC_B) { 375 if (leader_sequence_three_keys(KC_R, KC_V, KC_B)) {
382 SEND_STRING("Reviewed-by: Christian Brauner <brauner@kernel.org>"); 376 SEND_STRING("Reviewed-by: Christian Brauner <brauner@kernel.org>");
383 } 377 }
384 378
385 SEQ_THREE_KEYS(KC_S, KC_O, KC_B) { 379 if (leader_sequence_three_keys(KC_S, KC_O, KC_B)) {
386 SEND_STRING("Signed-off-by: Christian Brauner <brauner@kernel.org>"); 380 SEND_STRING("Signed-off-by: Christian Brauner <brauner@kernel.org>");
387 } 381 }
388 382
389 /* Support vim-style copy. */ 383 /* Support vim-style copy. */
390 SEQ_ONE_KEY(KC_Y) { 384 if (leader_sequence_one_key(KC_Y)) {
391 tap_code16(C(S(KC_C))); 385 tap_code16(C(S(KC_C)));
392 } 386 }
393 387
394 /* Support vim-style paste. */ 388 /* Support vim-style paste. */
395 SEQ_ONE_KEY(KC_P) { 389 if (leader_sequence_one_key(KC_P)) {
396 tap_code16(C(S(KC_V))); 390 tap_code16(C(S(KC_V)));
397 }
398 } 391 }
399} 392}
400 393
401void matrix_scan_user(void) { 394void matrix_scan_user(void) {
402 leader_bindings();
403
404#ifdef AUDIO_ENABLE 395#ifdef AUDIO_ENABLE
405 if (muse_mode) { 396 if (muse_mode) {
406 if (muse_counter == 0) { 397 if (muse_counter == 0) {
diff --git a/keyboards/preonic/keymaps/pcurt854/keymap.c b/keyboards/preonic/keymaps/pcurt854/keymap.c
index 15e31df0a6..af88b10f3b 100644
--- a/keyboards/preonic/keymaps/pcurt854/keymap.c
+++ b/keyboards/preonic/keymaps/pcurt854/keymap.c
@@ -362,120 +362,113 @@ float leader_succeed_song[][2] = SONG(STARTUP_SOUND);
362//float leader_fail_song[][2] = SONG(GOODBYE_SOUND); 362//float leader_fail_song[][2] = SONG(GOODBYE_SOUND);
363float leader_fail_song[][2] = SONG(NO_SOUND); 363float leader_fail_song[][2] = SONG(NO_SOUND);
364#endif 364#endif
365LEADER_EXTERNS();
366 365
367void matrix_scan_user(void) { 366void leader_start_user(void) {
368 LEADER_DICTIONARY() { 367#ifdef AUDIO_ENABLE
369 did_leader_succeed = leading = false; 368 PLAY_SONG(leader_start_song);
370 369#endif
371 // tap dance 370}
372 // sort by first key
373 371
374 SEQ_ONE_KEY(KC_C) { 372void leader_end_user(void) {
375 SEND_STRING(SS_TAP(X_CAPS)); 373 did_leader_succeed = false;
376 did_leader_succeed = true;
377 }
378 374
379 SEQ_ONE_KEY(KC_BSPC) { 375 // tap dance
380 SEND_STRING(SS_TAP(X_DEL)); 376 // sort by first key
381 did_leader_succeed = true;
382 }
383 377
384 SEQ_ONE_KEY(KC_D) { 378 if (leader_sequence_one_key(KC_C)) {
385 SEND_STRING("{}"SS_TAP(X_LEFT)); 379 SEND_STRING(SS_TAP(X_CAPS));
386 did_leader_succeed = true; 380 did_leader_succeed = true;
387 } 381 }
388 SEQ_TWO_KEYS(KC_D, KC_B) {
389 SEND_STRING("Dear Brother");
390 did_leader_succeed = true;
391 }
392 SEQ_THREE_KEYS(KC_D, KC_B, KC_S) {
393 SEND_STRING("Dear Brothers and Sister");
394 did_leader_succeed = true;
395 }
396 SEQ_TWO_KEYS(KC_D, KC_D) {
397 SEND_STRING("{");
398 did_leader_succeed = true;
399 }
400 SEQ_THREE_KEYS(KC_D, KC_D, KC_D) {
401 SEND_STRING("}");
402 did_leader_succeed = true;
403 }
404 SEQ_TWO_KEYS(KC_D, KC_S) {
405 SEND_STRING("Dear Sister");
406 did_leader_succeed = true;
407 }
408 382
409 // Html Tags 383 if (leader_sequence_one_key(KC_BSPC)) {
410 SEQ_TWO_KEYS(KC_H, KC_T) { 384 SEND_STRING(SS_TAP(X_DEL));
411 SEND_STRING("<></>"SS_TAP(X_LEFT)); 385 did_leader_succeed = true;
412 did_leader_succeed = true; 386 }
413 }
414 387
415 SEQ_TWO_KEYS(KC_I, KC_C) { 388 if (leader_sequence_one_key(KC_D)) {
416 SEND_STRING("In Christ,"); 389 SEND_STRING("{}"SS_TAP(X_LEFT));
417 did_leader_succeed = true; 390 did_leader_succeed = true;
418 } 391 }
392 if (leader_sequence_two_keys(KC_D, KC_B)) {
393 SEND_STRING("Dear Brother");
394 did_leader_succeed = true;
395 }
396 if (leader_sequence_three_keys(KC_D, KC_B, KC_S)) {
397 SEND_STRING("Dear Brothers and Sister");
398 did_leader_succeed = true;
399 }
400 if (leader_sequence_two_keys(KC_D, KC_D)) {
401 SEND_STRING("{");
402 did_leader_succeed = true;
403 }
404 if (leader_sequence_three_keys(KC_D, KC_D, KC_D)) {
405 SEND_STRING("}");
406 did_leader_succeed = true;
407 }
408 if (leader_sequence_two_keys(KC_D, KC_S)) {
409 SEND_STRING("Dear Sister");
410 did_leader_succeed = true;
411 }
419 412
420 SEQ_ONE_KEY(KC_J) { 413 // Html Tags
421 SEND_STRING("<>"SS_TAP(X_LEFT)); 414 if (leader_sequence_two_keys(KC_H, KC_T)) {
422 did_leader_succeed = true; 415 SEND_STRING("<></>"SS_TAP(X_LEFT));
423 } 416 did_leader_succeed = true;
424 SEQ_TWO_KEYS(KC_J, KC_J) { 417 }
425 SEND_STRING("<");
426 did_leader_succeed = true;
427 }
428 SEQ_THREE_KEYS(KC_J, KC_J, KC_J) {
429 SEND_STRING(">");
430 did_leader_succeed = true;
431 }
432 418
433 SEQ_TWO_KEYS(KC_T, KC_S) { 419 if (leader_sequence_two_keys(KC_I, KC_C)) {
434 SEND_STRING("Thanks!"); 420 SEND_STRING("In Christ,");
435 did_leader_succeed = true; 421 did_leader_succeed = true;
436 } 422 }
437 SEQ_TWO_KEYS(KC_T, KC_Y) {
438 SEND_STRING("Thank you!");
439 did_leader_succeed = true;
440 }
441 423
442 SEQ_ONE_KEY(KC_X) { 424 if (leader_sequence_one_key(KC_J)) {
443 SEND_STRING("()"SS_TAP(X_LEFT)); 425 SEND_STRING("<>"SS_TAP(X_LEFT));
444 did_leader_succeed = true; 426 did_leader_succeed = true;
445 } 427 }
446 SEQ_TWO_KEYS(KC_X, KC_X) { 428 if (leader_sequence_two_keys(KC_J, KC_J)) {
447 SEND_STRING("("); 429 SEND_STRING("<");
448 did_leader_succeed = true; 430 did_leader_succeed = true;
449 } 431 }
450 SEQ_THREE_KEYS(KC_X, KC_X, KC_X) { 432 if (leader_sequence_three_keys(KC_J, KC_J, KC_J)) {
451 SEND_STRING(")"); 433 SEND_STRING(">");
452 did_leader_succeed = true; 434 did_leader_succeed = true;
453 } 435 }
454 436
455 SEQ_ONE_KEY(KC_Z) { 437 if (leader_sequence_two_keys(KC_T, KC_S)) {
456 SEND_STRING("[]"SS_TAP(X_LEFT)); 438 SEND_STRING("Thanks!");
457 did_leader_succeed = true; 439 did_leader_succeed = true;
458 } 440 }
459 SEQ_TWO_KEYS(KC_Z, KC_Z) { 441 if (leader_sequence_two_keys(KC_T, KC_Y)) {
460 SEND_STRING("["); 442 SEND_STRING("Thank you!");
461 did_leader_succeed = true; 443 did_leader_succeed = true;
462 } 444 }
463 SEQ_THREE_KEYS(KC_Z, KC_Z, KC_Z) {
464 SEND_STRING("]");
465 did_leader_succeed = true;
466 }
467 445
468 leader_end(); 446 if (leader_sequence_one_key(KC_X)) {
447 SEND_STRING("()"SS_TAP(X_LEFT));
448 did_leader_succeed = true;
449 }
450 if (leader_sequence_two_keys(KC_X, KC_X)) {
451 SEND_STRING("(");
452 did_leader_succeed = true;
453 }
454 if (leader_sequence_three_keys(KC_X, KC_X, KC_X)) {
455 SEND_STRING(")");
456 did_leader_succeed = true;
469 } 457 }
470}
471 458
472void leader_start_user(void) { 459 if (leader_sequence_one_key(KC_Z)) {
473#ifdef AUDIO_ENABLE 460 SEND_STRING("[]"SS_TAP(X_LEFT));
474 PLAY_SONG(leader_start_song); 461 did_leader_succeed = true;
475#endif 462 }
476} 463 if (leader_sequence_two_keys(KC_Z, KC_Z)) {
464 SEND_STRING("[");
465 did_leader_succeed = true;
466 }
467 if (leader_sequence_three_keys(KC_Z, KC_Z, KC_Z)) {
468 SEND_STRING("]");
469 did_leader_succeed = true;
470 }
477 471
478void leader_end_user(void) {
479 if (did_leader_succeed) { 472 if (did_leader_succeed) {
480#ifdef AUDIO_ENABLE 473#ifdef AUDIO_ENABLE
481 PLAY_SONG(leader_succeed_song); 474 PLAY_SONG(leader_succeed_song);
diff --git a/keyboards/preonic/keymaps/yhaliaw/keymap.c b/keyboards/preonic/keymaps/yhaliaw/keymap.c
index b64aa7d745..7771199e9c 100644
--- a/keyboards/preonic/keymaps/yhaliaw/keymap.c
+++ b/keyboards/preonic/keymaps/yhaliaw/keymap.c
@@ -168,36 +168,24 @@ void keyboard_post_init_user(void) {
168} 168}
169 169
170bool leader_found; 170bool leader_found;
171LEADER_EXTERNS();
172
173void matrix_scan_user(void) {
174 LEADER_DICTIONARY() {
175 leading = false;
176 leader_found = false;
177 SEQ_ONE_KEY(L_RESET) {
178 leader_found = true;
179 reset_keyboard();
180 }
181 else
182 SEQ_ONE_KEY(KC_DEL) {
183 leader_found = true;
184 layer_clear();
185 }
186 else
187 SEQ_ONE_KEY(LOWER) {
188 leader_found = true;
189 layer_on(_LOWER);
190 }
191 else
192 SEQ_ONE_KEY(RAISE) {
193 leader_found = true;
194 layer_on(_RAISE);
195 }
196 leader_end();
197 }
198}
199 171
200void leader_end_user(void) { 172void leader_end_user(void) {
173 leader_found = false;
174
175 if (leader_sequence_one_key(L_RESET)) {
176 leader_found = true;
177 reset_keyboard();
178 } else if (leader_sequence_one_key(KC_DEL)) {
179 leader_found = true;
180 layer_clear();
181 } else if (leader_sequence_one_key(LOWER)) {
182 leader_found = true;
183 layer_on(_LOWER);
184 } else if (leader_sequence_one_key(RAISE)) {
185 leader_found = true;
186 layer_on(_RAISE);
187 }
188
201 // Plays sound on if leader sequence found. 189 // Plays sound on if leader sequence found.
202 if (leader_found) { 190 if (leader_found) {
203#ifdef AUDIO_ENABLE 191#ifdef AUDIO_ENABLE
diff --git a/keyboards/signum/3_0/keymaps/sgurenkov/keymap.c b/keyboards/signum/3_0/keymaps/sgurenkov/keymap.c
index cfd848fcfd..9353d28472 100644
--- a/keyboards/signum/3_0/keymaps/sgurenkov/keymap.c
+++ b/keyboards/signum/3_0/keymaps/sgurenkov/keymap.c
@@ -92,37 +92,47 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
92 return true; 92 return true;
93} 93}
94 94
95LEADER_EXTERNS(); 95void leader_end_user(void) {
96 96 // Cancel task CTRL+C
97void matrix_scan_user(void) { 97 if (leader_sequence_one_key(KC_C)) {
98 LEADER_DICTIONARY() { 98 tap_code16(C(KC_C));
99 leading = false; 99 }
100 leader_end(); 100 // copy
101 101 if (leader_sequence_one_key(KC_Y)) {
102 // Cancel task CTRL+C 102 tap_code16(G(KC_C));
103 SEQ_ONE_KEY(KC_C) { tap_code16(C(KC_C)); } 103 }
104 // copy 104 // cut
105 SEQ_ONE_KEY(KC_Y) { tap_code16(G(KC_C)); } 105 if (leader_sequence_one_key(KC_X)) {
106 // cut 106 tap_code16(G(KC_X));
107 SEQ_ONE_KEY(KC_X) { tap_code16(G(KC_X)); } 107 }
108 // paste 108 // paste
109 SEQ_ONE_KEY(KC_P) { tap_code16(G(KC_V)); } 109 if (leader_sequence_one_key(KC_P)) {
110 // undo 110 tap_code16(G(KC_V));
111 SEQ_ONE_KEY(KC_U) { tap_code16(G(KC_Z)); } 111 }
112 // redo 112 // undo
113 SEQ_ONE_KEY(KC_R) { tap_code16(S(G(KC_Z))); } 113 if (leader_sequence_one_key(KC_U)) {
114 // delete line 114 tap_code16(G(KC_Z));
115 SEQ_TWO_KEYS(KC_D, KC_D) { 115 }
116 register_code(KC_LGUI); 116 // redo
117 if (leader_sequence_one_key(KC_R)) {
118 tap_code16(S(G(KC_Z)));
119 }
120 // delete line
121 if (leader_sequence_two_keys(KC_D, KC_D)) {
122 register_code(KC_LGUI);
117 123
118 tap_code(KC_RIGHT); 124 tap_code(KC_RIGHT);
119 125
120 tap_code(KC_BACKSPACE); 126 tap_code(KC_BACKSPACE);
121 127
122 unregister_code(KC_LGUI); 128 unregister_code(KC_LGUI);
123 } 129 }
124 // go to the beginning of the string 130 // go to the beginning of the string
125 SEQ_ONE_KEY(KC_H) { tap_code16(G(KC_LEFT)); } 131 if (leader_sequence_one_key(KC_H)) {
126 // go to the end of the string 132 tap_code16(G(KC_LEFT));
127 SEQ_ONE_KEY(KC_L) { tap_code16(G(KC_RIGHT)); }
128 } 133 }
134 // go to the end of the string
135 if (leader_sequence_one_key(KC_L)) {
136 tap_code16(G(KC_RIGHT));
137 }
138}
diff --git a/keyboards/splitkb/kyria/keymaps/asapjockey/keymap.c b/keyboards/splitkb/kyria/keymaps/asapjockey/keymap.c
index c98219a755..cb8eb1e1e7 100644
--- a/keyboards/splitkb/kyria/keymaps/asapjockey/keymap.c
+++ b/keyboards/splitkb/kyria/keymaps/asapjockey/keymap.c
@@ -171,16 +171,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
171 return true; 171 return true;
172} 172}
173 173
174LEADER_EXTERNS(); 174void leader_end_user(void) {
175 175 if (leader_sequence_one_key(KC_F)) { // Shift + Ctrl + F
176void matrix_scan_user(void) { 176 tap_code16(S(C(KC_F)));
177 LEADER_DICTIONARY() {
178 leading = false;
179 leader_end();
180
181 SEQ_ONE_KEY(KC_F) { // Shift + Ctrl + F
182 tap_code16(S(C(KC_F)));
183 }
184 } 177 }
185} 178}
186 179
diff --git a/keyboards/splitkb/kyria/keymaps/cjuniet/keymap.c b/keyboards/splitkb/kyria/keymaps/cjuniet/keymap.c
index a375c5cc4d..4a4bf91177 100644
--- a/keyboards/splitkb/kyria/keymaps/cjuniet/keymap.c
+++ b/keyboards/splitkb/kyria/keymaps/cjuniet/keymap.c
@@ -31,8 +31,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
31 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) 31 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
32}; 32};
33 33
34LEADER_EXTERNS();
35
36void keyboard_post_init_user(void) { 34void keyboard_post_init_user(void) {
37 led_t led_state = host_keyboard_led_state(); 35 led_t led_state = host_keyboard_led_state();
38 if (!led_state.num_lock) { 36 if (!led_state.num_lock) {
@@ -44,25 +42,20 @@ layer_state_t layer_state_set_user(layer_state_t state) {
44 return update_tri_layer_state(state, _SYMBOLS, _NUMBERS, _SPECIALS); 42 return update_tri_layer_state(state, _SYMBOLS, _NUMBERS, _SPECIALS);
45} 43}
46 44
47void matrix_scan_user(void) { 45void leader_end_user(void) {
48 LEADER_DICTIONARY() { 46 // Lock screen (macOS)
49 leading = false; 47 if (leader_sequence_one_key(KC_ESC)) {
50 leader_end(); 48 tap_code16(LCTL(LGUI(KC_Q)));
51 49 }
52 // Lock screen (macOS)
53 SEQ_ONE_KEY(KC_ESC) {
54 tap_code16(LCTL(LGUI(KC_Q)));
55 }
56 50
57 // Escape-Shift-Z-Z (VIM) 51 // Escape-Shift-Z-Z (VIM)
58 SEQ_ONE_KEY(KC_Z) { 52 if (leader_sequence_one_key(KC_Z)) {
59 SEND_STRING(SS_TAP(X_ESC) SS_LSFT("zz")); 53 SEND_STRING(SS_TAP(X_ESC) SS_LSFT("zz"));
60 } 54 }
61 55
62 // Dead grave accent (macOS) 56 // Dead grave accent (macOS)
63 SEQ_ONE_KEY(KC_E) { 57 if (leader_sequence_one_key(KC_E)) {
64 tap_code16(LALT(KC_GRAVE)); 58 tap_code16(LALT(KC_GRAVE));
65 }
66 } 59 }
67} 60}
68 61
diff --git a/keyboards/splitkb/kyria/keymaps/corodiak/keymap.c b/keyboards/splitkb/kyria/keymaps/corodiak/keymap.c
index 2a28d49752..c0ed9f133c 100644
--- a/keyboards/splitkb/kyria/keymaps/corodiak/keymap.c
+++ b/keyboards/splitkb/kyria/keymaps/corodiak/keymap.c
@@ -274,48 +274,41 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
274 return true; 274 return true;
275}; 275};
276 276
277LEADER_EXTERNS(); 277void leader_end_user(void) {
278 278 // Set current OS indicator to macOs
279void matrix_scan_user(void) { 279 if (leader_sequence_one_key(KC_M)) {
280 LEADER_DICTIONARY() { 280 user_config.osIsWindows = false;
281 leading = false; 281 eeconfig_update_user(user_config.raw);
282 leader_end(); 282 }
283 283
284 // Set current OS indicator to macOs 284 // Set current OS indicator to Windows
285 SEQ_ONE_KEY(KC_M) { 285 if (leader_sequence_one_key(KC_W)) {
286 user_config.osIsWindows = false; 286 user_config.osIsWindows = true;
287 eeconfig_update_user(user_config.raw); 287 eeconfig_update_user(user_config.raw);
288 } 288 }
289 289
290 // Set current OS indicator to Windows 290 // Screenshot
291 SEQ_ONE_KEY(KC_W) { 291 if (leader_sequence_one_key(KC_S)) {
292 user_config.osIsWindows = true; 292 if (user_config.osIsWindows == 1) {
293 eeconfig_update_user(user_config.raw); 293 tap_code16(S(G(KC_S)));
294 } 294 } else if (user_config.osIsWindows == 0) {
295 295 tap_code16(S(G(KC_4)));
296 // Screenshot
297 SEQ_ONE_KEY(KC_S) {
298 if (user_config.osIsWindows == 1) {
299 tap_code16(S(G(KC_S)));
300 } else if (user_config.osIsWindows == 0) {
301 tap_code16(S(G(KC_4)));
302 }
303 } 296 }
297 }
304 298
305 // Video 299 // Video
306 SEQ_ONE_KEY(KC_V) { 300 if (leader_sequence_one_key(KC_V)) {
307 if (user_config.osIsWindows == 0) { 301 if (user_config.osIsWindows == 0) {
308 tap_code16(S(G(KC_5))); 302 tap_code16(S(G(KC_5)));
309 }
310 } 303 }
304 }
311 305
312 // Sleep 306 // Sleep
313 SEQ_ONE_KEY(KC_P) { 307 if (leader_sequence_one_key(KC_P)) {
314 if (user_config.osIsWindows == 1) { 308 if (user_config.osIsWindows == 1) {
315 SEND_STRING(SS_LGUI("x") "u" "h"); 309 SEND_STRING(SS_LGUI("x") "u" "h");
316 } else if (user_config.osIsWindows == 0) { 310 } else if (user_config.osIsWindows == 0) {
317 tap_code16(A(G(KC_PWR))); 311 tap_code16(A(G(KC_PWR)));
318 }
319 } 312 }
320 } 313 }
321} 314}
diff --git a/keyboards/splitkb/kyria/keymaps/mattir/keymap.c b/keyboards/splitkb/kyria/keymaps/mattir/keymap.c
index 5f97c40765..5bc0b8215e 100644
--- a/keyboards/splitkb/kyria/keymaps/mattir/keymap.c
+++ b/keyboards/splitkb/kyria/keymaps/mattir/keymap.c
@@ -56,11 +56,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
56 ), 56 ),
57}; 57};
58 58
59void leader_end_user(void) {
60 if (leader_sequence_one_key(KC_A)) {
61 tap_code16(SGUI(KC_L));
62 }
63 if (leader_sequence_two_keys(KC_S, KC_S)) {
64 tap_code16(SGUI(KC_5));
65 }
66}
67
59bool is_cmd_tab_active = false; 68bool is_cmd_tab_active = false;
60uint16_t cmd_tab_timer = 0; 69uint16_t cmd_tab_timer = 0;
61 70
62LEADER_EXTERNS();
63
64void matrix_scan_user(void) { 71void matrix_scan_user(void) {
65 if (is_cmd_tab_active) { 72 if (is_cmd_tab_active) {
66 if (timer_elapsed(cmd_tab_timer) > 1000) { 73 if (timer_elapsed(cmd_tab_timer) > 1000) {
@@ -68,18 +75,6 @@ void matrix_scan_user(void) {
68 is_cmd_tab_active = false; 75 is_cmd_tab_active = false;
69 } 76 }
70 } 77 }
71
72 LEADER_DICTIONARY() {
73 leading = false;
74 leader_end();
75
76 SEQ_ONE_KEY(KC_A) {
77 tap_code16(SGUI(KC_L));
78 }
79 SEQ_TWO_KEYS(KC_S, KC_S) {
80 tap_code16(SGUI(KC_5));
81 }
82 }
83} 78}
84 79
85#ifdef OLED_ENABLE 80#ifdef OLED_ENABLE
diff --git a/keyboards/splitkb/kyria/keymaps/mattir2/keymap.c b/keyboards/splitkb/kyria/keymaps/mattir2/keymap.c
index 0d09bcce74..f42889da90 100644
--- a/keyboards/splitkb/kyria/keymaps/mattir2/keymap.c
+++ b/keyboards/splitkb/kyria/keymaps/mattir2/keymap.c
@@ -49,18 +49,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
49 ), 49 ),
50}; 50};
51 51
52LEADER_EXTERNS(); 52void leader_end_user(void) {
53 53 if (leader_sequence_one_key(KC_A)) {
54void matrix_scan_user(void) { 54 tap_code16(SGUI(KC_L));
55 LEADER_DICTIONARY() { 55 }
56 leading = false; 56 if (leader_sequence_two_keys(KC_S, KC_S)) {
57 leader_end(); 57 tap_code16(SGUI(KC_5));
58
59 SEQ_ONE_KEY(KC_A) {
60 tap_code16(SGUI(KC_L));
61 }
62 SEQ_TWO_KEYS(KC_S, KC_S) {
63 tap_code16(SGUI(KC_5));
64 }
65 } 58 }
66} 59}
diff --git a/keyboards/splitkb/kyria/keymaps/plattfot/keymap.c b/keyboards/splitkb/kyria/keymaps/plattfot/keymap.c
index 1a351803a2..2233e9b01b 100644
--- a/keyboards/splitkb/kyria/keymaps/plattfot/keymap.c
+++ b/keyboards/splitkb/kyria/keymaps/plattfot/keymap.c
@@ -400,82 +400,76 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
400} 400}
401#endif 401#endif
402 402
403LEADER_EXTERNS(); 403void leader_end_user(void) {
404 404 // Sway navigation
405void matrix_scan_user(void) { 405 if (leader_sequence_one_key(KC_Q)) { // Jump to workspace 1
406 LEADER_DICTIONARY() { 406 SEND_STRING(SS_LGUI("1"));
407 leading = false; 407 }
408 leader_end(); 408 if (leader_sequence_one_key(KC_W)) { // Jump to workspace 2
409 // Sway navigation 409 SEND_STRING(SS_LGUI("2"));
410 SEQ_ONE_KEY(KC_Q) { // Jump to workspace 1 410 }
411 SEND_STRING(SS_LGUI("1")); 411 if (leader_sequence_one_key(KC_E)) { // Jump to workspace 3
412 } 412 SEND_STRING(SS_LGUI("3"));
413 SEQ_ONE_KEY(KC_W) { // Jump to workspace 2 413 }
414 SEND_STRING(SS_LGUI("2")); 414 if (leader_sequence_one_key(KC_R)) { // Jump to workspace 4
415 } 415 SEND_STRING(SS_LGUI("4"));
416 SEQ_ONE_KEY(KC_E) { // Jump to workspace 3 416 }
417 SEND_STRING(SS_LGUI("3")); 417 if (leader_sequence_one_key(KC_T)) { // Jump to workspace 5
418 } 418 SEND_STRING(SS_LGUI("5"));
419 SEQ_ONE_KEY(KC_R) { // Jump to workspace 4 419 }
420 SEND_STRING(SS_LGUI("4"));
421 }
422 SEQ_ONE_KEY(KC_T) { // Jump to workspace 5
423 SEND_STRING(SS_LGUI("5"));
424 }
425 420
426 SEQ_ONE_KEY(KC_Y) { // Jump to workspace 6 421 if (leader_sequence_one_key(KC_Y)) { // Jump to workspace 6
427 SEND_STRING(SS_LGUI("6")); 422 SEND_STRING(SS_LGUI("6"));
428 } 423 }
429 SEQ_ONE_KEY(KC_U) { // Jump to workspace 7 424 if (leader_sequence_one_key(KC_U)) { // Jump to workspace 7
430 SEND_STRING(SS_LGUI("7")); 425 SEND_STRING(SS_LGUI("7"));
431 } 426 }
432 SEQ_ONE_KEY(KC_I) { // Jump to workspace 8 427 if (leader_sequence_one_key(KC_I)) { // Jump to workspace 8
433 SEND_STRING(SS_LGUI("8")); 428 SEND_STRING(SS_LGUI("8"));
434 } 429 }
435 SEQ_ONE_KEY(KC_O) { // Jump to workspace 9 430 if (leader_sequence_one_key(KC_O)) { // Jump to workspace 9
436 SEND_STRING(SS_LGUI("9")); 431 SEND_STRING(SS_LGUI("9"));
437 } 432 }
438 SEQ_ONE_KEY(KC_P) { // Jump to workspace 0 433 if (leader_sequence_one_key(KC_P)) { // Jump to workspace 0
439 SEND_STRING(SS_LGUI("0")); 434 SEND_STRING(SS_LGUI("0"));
440 } 435 }
441 SEQ_ONE_KEY(KC_G) { // View scratch pad 436 if (leader_sequence_one_key(KC_G)) { // View scratch pad
442 SEND_STRING(SS_LGUI("-")); 437 SEND_STRING(SS_LGUI("-"));
443 } 438 }
444 439
445 // Sway move window 440 // Sway move window
446 SEQ_TWO_KEYS(KC_M, KC_Q) { // Move to workspace 1 441 if (leader_sequence_two_keys(KC_M, KC_Q)) { // Move to workspace 1
447 SEND_STRING(SS_LSFT(SS_LGUI("1"))); 442 SEND_STRING(SS_LSFT(SS_LGUI("1")));
448 } 443 }
449 SEQ_TWO_KEYS(KC_M, KC_W) { // Move to workspace 2 444 if (leader_sequence_two_keys(KC_M, KC_W)) { // Move to workspace 2
450 SEND_STRING(SS_LSFT(SS_LGUI("2"))); 445 SEND_STRING(SS_LSFT(SS_LGUI("2")));
451 } 446 }
452 SEQ_TWO_KEYS(KC_M, KC_E) { // Move to workspace 3 447 if (leader_sequence_two_keys(KC_M, KC_E)) { // Move to workspace 3
453 SEND_STRING(SS_LSFT(SS_LGUI("3"))); 448 SEND_STRING(SS_LSFT(SS_LGUI("3")));
454 } 449 }
455 SEQ_TWO_KEYS(KC_M, KC_R) { // Move to workspace 4 450 if (leader_sequence_two_keys(KC_M, KC_R)) { // Move to workspace 4
456 SEND_STRING(SS_LSFT(SS_LGUI("4"))); 451 SEND_STRING(SS_LSFT(SS_LGUI("4")));
457 } 452 }
458 SEQ_TWO_KEYS(KC_M, KC_T) { // Move to workspace 5 453 if (leader_sequence_two_keys(KC_M, KC_T)) { // Move to workspace 5
459 SEND_STRING(SS_LSFT(SS_LGUI("5"))); 454 SEND_STRING(SS_LSFT(SS_LGUI("5")));
460 } 455 }
461 456
462 SEQ_TWO_KEYS(KC_M, KC_Y) { // Move to workspace 6 457 if (leader_sequence_two_keys(KC_M, KC_Y)) { // Move to workspace 6
463 SEND_STRING(SS_LSFT(SS_LGUI("6"))); 458 SEND_STRING(SS_LSFT(SS_LGUI("6")));
464 } 459 }
465 SEQ_TWO_KEYS(KC_M, KC_U) { // Move to workspace 7 460 if (leader_sequence_two_keys(KC_M, KC_U)) { // Move to workspace 7
466 SEND_STRING(SS_LSFT(SS_LGUI("7"))); 461 SEND_STRING(SS_LSFT(SS_LGUI("7")));
467 } 462 }
468 SEQ_TWO_KEYS(KC_M, KC_I) { // Move to workspace 8 463 if (leader_sequence_two_keys(KC_M, KC_I)) { // Move to workspace 8
469 SEND_STRING(SS_LSFT(SS_LGUI("8"))); 464 SEND_STRING(SS_LSFT(SS_LGUI("8")));
470 } 465 }
471 SEQ_TWO_KEYS(KC_M, KC_O) { // Move to workspace 9 466 if (leader_sequence_two_keys(KC_M, KC_O)) { // Move to workspace 9
472 SEND_STRING(SS_LSFT(SS_LGUI("9"))); 467 SEND_STRING(SS_LSFT(SS_LGUI("9")));
473 } 468 }
474 SEQ_TWO_KEYS(KC_M, KC_P) { // Move to workspace 0 469 if (leader_sequence_two_keys(KC_M, KC_P)) { // Move to workspace 0
475 SEND_STRING(SS_LSFT(SS_LGUI("0"))); 470 SEND_STRING(SS_LSFT(SS_LGUI("0")));
476 } 471 }
477 SEQ_TWO_KEYS(KC_M, KC_G) { // Move to scratch pad 472 if (leader_sequence_two_keys(KC_M, KC_G)) { // Move to scratch pad
478 SEND_STRING(SS_LSFT(SS_LGUI("-"))); 473 SEND_STRING(SS_LSFT(SS_LGUI("-")));
479 }
480 } 474 }
481} 475}
diff --git a/keyboards/splitkb/kyria/keymaps/thomasbaart/keymap.c b/keyboards/splitkb/kyria/keymaps/thomasbaart/keymap.c
index 420d9a89af..3ed7dbee6e 100644
--- a/keyboards/splitkb/kyria/keymaps/thomasbaart/keymap.c
+++ b/keyboards/splitkb/kyria/keymaps/thomasbaart/keymap.c
@@ -173,12 +173,54 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
173 return true; 173 return true;
174} 174}
175 175
176void leader_end_user(void) {
177 if (leader_sequence_one_key(KC_C)) { // Inline Code
178 SEND_STRING("`` " SS_TAP(X_LEFT) SS_TAP(X_LEFT));
179 }
180 if (leader_sequence_one_key(KC_P)) { // Invoke Password Manager
181 SEND_STRING(SS_LCTL(SS_LALT("\\")));
182 }
183 if (leader_sequence_one_key(KC_S)) { // Windows screenshot
184 SEND_STRING(SS_LGUI("\nS"));
185 }
186 if (leader_sequence_two_keys(KC_F, KC_P)) { // Fusion Projection prefix
187 SEND_STRING("[Projection] ");
188 }
189 if (leader_sequence_two_keys(KC_B, KC_B)) { // Basecone invoice description
190 SEND_STRING("[Leveranciersnaam] [Factuurnummer]");
191 }
192 if (leader_sequence_two_keys(KC_E, KC_S)) { // Support email splitkb
193 SEND_STRING("support@splitkb.com");
194 }
195 if (leader_sequence_two_keys(KC_E, KC_T)) { // Email splitkb
196 SEND_STRING("thomas@splitkb.com");
197 }
198 if (leader_sequence_two_keys(KC_E, KC_P)) { // Email personal
199 SEND_STRING("mail@thomasbaart.nl");
200 }
201 if (leader_sequence_two_keys(KC_S, KC_D)) { // Splitkb documentation
202 SEND_STRING("https://docs.splitkb.com/");
203 }
204 if (leader_sequence_two_keys(KC_S, KC_V)) { // Splitkb VAT number
205 SEND_STRING("NL210593349B01");
206 }
207 if (leader_sequence_two_keys(KC_B, KC_C)) { // Discord bongocat
208 SEND_STRING(":bongocat:\n");
209 }
210 if (leader_sequence_two_keys(KC_C, KC_B)) { // Discord code block
211 SEND_STRING("```c" SS_LSFT("\n\n") "``` " SS_TAP(X_UP));
212 }
213 if (leader_sequence_two_keys(KC_Y, KC_S)) { // Greeting
214 SEND_STRING("Yours sincerely,\n\nThomas Baart");
215 }
216 if (leader_sequence_three_keys(KC_M, KC_V, KC_G)) { // Greeting
217 SEND_STRING("Met vriendelijke groet,\n\nThomas Baart");
218 }
219}
176 220
177bool is_alt_tab_active = false; 221bool is_alt_tab_active = false;
178uint16_t alt_tab_timer = 0; 222uint16_t alt_tab_timer = 0;
179 223
180LEADER_EXTERNS();
181
182void matrix_scan_user(void) { 224void matrix_scan_user(void) {
183 if (is_alt_tab_active) { 225 if (is_alt_tab_active) {
184 if (timer_elapsed(alt_tab_timer) > 1000) { 226 if (timer_elapsed(alt_tab_timer) > 1000) {
@@ -186,54 +228,6 @@ void matrix_scan_user(void) {
186 is_alt_tab_active = false; 228 is_alt_tab_active = false;
187 } 229 }
188 } 230 }
189
190 LEADER_DICTIONARY() {
191 leading = false;
192 leader_end();
193
194 SEQ_ONE_KEY(KC_C) { // Inline Code
195 SEND_STRING("`` " SS_TAP(X_LEFT) SS_TAP(X_LEFT));
196 }
197 SEQ_ONE_KEY(KC_P) { // Invoke Password Manager
198 SEND_STRING(SS_LCTL(SS_LALT("\\")));
199 }
200 SEQ_ONE_KEY(KC_S) { // Windows screenshot
201 SEND_STRING(SS_LGUI("\nS"));
202 }
203 SEQ_TWO_KEYS(KC_F, KC_P) { // Fusion Projection prefix
204 SEND_STRING("[Projection] ");
205 }
206 SEQ_TWO_KEYS(KC_B, KC_B) { // Basecone invoice description
207 SEND_STRING("[Leveranciersnaam] [Factuurnummer]");
208 }
209 SEQ_TWO_KEYS(KC_E, KC_S) { // Support email splitkb
210 SEND_STRING("support@splitkb.com");
211 }
212 SEQ_TWO_KEYS(KC_E, KC_T) { // Email splitkb
213 SEND_STRING("thomas@splitkb.com");
214 }
215 SEQ_TWO_KEYS(KC_E, KC_P) { // Email personal
216 SEND_STRING("mail@thomasbaart.nl");
217 }
218 SEQ_TWO_KEYS(KC_S, KC_D) { // Splitkb documentation
219 SEND_STRING("https://docs.splitkb.com/");
220 }
221 SEQ_TWO_KEYS(KC_S, KC_V) { // Splitkb VAT number
222 SEND_STRING("NL210593349B01");
223 }
224 SEQ_TWO_KEYS(KC_B, KC_C) { // Discord bongocat
225 SEND_STRING(":bongocat:\n");
226 }
227 SEQ_TWO_KEYS(KC_C, KC_B) { // Discord code block
228 SEND_STRING("```c" SS_LSFT("\n\n") "``` " SS_TAP(X_UP));
229 }
230 SEQ_TWO_KEYS(KC_Y, KC_S) { // Greeting
231 SEND_STRING("Yours sincerely,\n\nThomas Baart");
232 }
233 SEQ_THREE_KEYS(KC_M, KC_V, KC_G) { // Greeting
234 SEND_STRING("Met vriendelijke groet,\n\nThomas Baart");
235 }
236 }
237} 231}
238 232
239#ifdef OLED_ENABLE 233#ifdef OLED_ENABLE
diff --git a/keyboards/tada68/keymaps/laas/keymap.c b/keyboards/tada68/keymaps/laas/keymap.c
index fcc71021a3..165112263a 100755
--- a/keyboards/tada68/keymaps/laas/keymap.c
+++ b/keyboards/tada68/keymaps/laas/keymap.c
@@ -7,8 +7,6 @@
7#define _BL 0 7#define _BL 0
8#define _FL 1 8#define _FL 1
9 9
10LEADER_EXTERNS();
11
12const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 10const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
13 /* Keymap _BL: (Base Layer) Default Layer 11 /* Keymap _BL: (Base Layer) Default Layer
14 * ,----------------------------------------------------------------. 12 * ,----------------------------------------------------------------.
diff --git a/quantum/keyboard.c b/quantum/keyboard.c
index 1de5f1cd0c..e8e3292dbc 100644
--- a/quantum/keyboard.c
+++ b/quantum/keyboard.c
@@ -105,6 +105,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
105#ifdef CAPS_WORD_ENABLE 105#ifdef CAPS_WORD_ENABLE
106# include "caps_word.h" 106# include "caps_word.h"
107#endif 107#endif
108#ifdef LEADER_ENABLE
109# include "leader.h"
110#endif
108 111
109static uint32_t last_input_modification_time = 0; 112static uint32_t last_input_modification_time = 0;
110uint32_t last_input_activity_time(void) { 113uint32_t last_input_activity_time(void) {
@@ -546,6 +549,10 @@ void quantum_task(void) {
546 combo_task(); 549 combo_task();
547#endif 550#endif
548 551
552#ifdef LEADER_ENABLE
553 leader_task();
554#endif
555
549#ifdef WPM_ENABLE 556#ifdef WPM_ENABLE
550 decay_wpm(); 557 decay_wpm();
551#endif 558#endif
diff --git a/quantum/leader.c b/quantum/leader.c
new file mode 100644
index 0000000000..272609ad0c
--- /dev/null
+++ b/quantum/leader.c
@@ -0,0 +1,101 @@
1// Copyright 2023 QMK
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include "leader.h"
5#include "timer.h"
6#include "util.h"
7
8#include <string.h>
9
10#ifndef LEADER_TIMEOUT
11# define LEADER_TIMEOUT 300
12#endif
13
14// Leader key stuff
15bool leading = false;
16uint16_t leader_time = 0;
17uint16_t leader_sequence[5] = {0, 0, 0, 0, 0};
18uint8_t leader_sequence_size = 0;
19
20__attribute__((weak)) void leader_start_user(void) {}
21
22__attribute__((weak)) void leader_end_user(void) {}
23
24void leader_start(void) {
25 if (leading) {
26 return;
27 }
28 leader_start_user();
29 leading = true;
30 leader_time = timer_read();
31 leader_sequence_size = 0;
32 memset(leader_sequence, 0, sizeof(leader_sequence));
33}
34
35void leader_end(void) {
36 leading = false;
37 leader_end_user();
38}
39
40void leader_task(void) {
41 if (leader_sequence_active() && leader_sequence_timed_out()) {
42 leader_end();
43 }
44}
45
46bool leader_sequence_active(void) {
47 return leading;
48}
49
50bool leader_sequence_add(uint16_t keycode) {
51 if (leader_sequence_size >= ARRAY_SIZE(leader_sequence)) {
52 return false;
53 }
54
55#if defined(LEADER_NO_TIMEOUT)
56 if (leader_sequence_size == 0) {
57 leader_reset_timer();
58 }
59#endif
60
61 leader_sequence[leader_sequence_size] = keycode;
62 leader_sequence_size++;
63
64 return true;
65}
66
67bool leader_sequence_timed_out(void) {
68#if defined(LEADER_NO_TIMEOUT)
69 return leader_sequence_size > 0 && timer_elapsed(leader_time) > LEADER_TIMEOUT;
70#else
71 return timer_elapsed(leader_time) > LEADER_TIMEOUT;
72#endif
73}
74
75void leader_reset_timer(void) {
76 leader_time = timer_read();
77}
78
79bool leader_sequence_is(uint16_t kc1, uint16_t kc2, uint16_t kc3, uint16_t kc4, uint16_t kc5) {
80 return leader_sequence[0] == kc1 && leader_sequence[1] == kc2 && leader_sequence[2] == kc3 && leader_sequence[3] == kc4 && leader_sequence[4] == kc5;
81}
82
83bool leader_sequence_one_key(uint16_t kc) {
84 return leader_sequence_is(kc, 0, 0, 0, 0);
85}
86
87bool leader_sequence_two_keys(uint16_t kc1, uint16_t kc2) {
88 return leader_sequence_is(kc1, kc2, 0, 0, 0);
89}
90
91bool leader_sequence_three_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3) {
92 return leader_sequence_is(kc1, kc2, kc3, 0, 0);
93}
94
95bool leader_sequence_four_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3, uint16_t kc4) {
96 return leader_sequence_is(kc1, kc2, kc3, kc4, 0);
97}
98
99bool leader_sequence_five_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3, uint16_t kc4, uint16_t kc5) {
100 return leader_sequence_is(kc1, kc2, kc3, kc4, kc5);
101}
diff --git a/quantum/leader.h b/quantum/leader.h
new file mode 100644
index 0000000000..1999006c56
--- /dev/null
+++ b/quantum/leader.h
@@ -0,0 +1,119 @@
1// Copyright 2023 QMK
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include <stdbool.h>
5#include <stdint.h>
6
7/**
8 * \defgroup leader
9 *
10 * Leader Key
11 * \{
12 */
13
14/**
15 * \brief User callback, invoked when the leader sequence begins.
16 */
17void leader_start_user(void);
18
19/**
20 * \brief User callback, invoked when the leader sequence ends.
21 */
22void leader_end_user(void);
23
24/**
25 * Begin the leader sequence, resetting the buffer and timer.
26 */
27void leader_start(void);
28
29/**
30 * End the leader sequence.
31 */
32void leader_end(void);
33
34void leader_task(void);
35
36/**
37 * Whether the leader sequence is active.
38 */
39bool leader_sequence_active(void);
40
41/**
42 * Add the given keycode to the sequence buffer.
43 *
44 * If `LEADER_NO_TIMEOUT` is defined, the timer is reset if the buffer is empty.
45 *
46 * \param keycode The keycode to add.
47 *
48 * \return `true` if the keycode was added, `false` if the buffer is full.
49 */
50bool leader_sequence_add(uint16_t keycode);
51
52/**
53 * Whether the leader sequence has reached the timeout.
54 *
55 * If `LEADER_NO_TIMEOUT` is defined, the buffer must also contain at least one key.
56 */
57bool leader_sequence_timed_out(void);
58
59/**
60 * Reset the leader sequence timer.
61 */
62void leader_reset_timer(void);
63
64/**
65 * Check the sequence buffer for the given keycode.
66 *
67 * \param kc The keycode to check.
68 *
69 * \return `true` if the sequence buffer matches.
70 */
71bool leader_sequence_one_key(uint16_t kc);
72
73/**
74 * Check the sequence buffer for the given keycodes.
75 *
76 * \param kc1 The first keycode to check.
77 * \param kc2 The second keycode to check.
78 *
79 * \return `true` if the sequence buffer matches.
80 */
81bool leader_sequence_two_keys(uint16_t kc1, uint16_t kc2);
82
83/**
84 * Check the sequence buffer for the given keycodes.
85 *
86 * \param kc1 The first keycode to check.
87 * \param kc2 The second keycode to check.
88 * \param kc3 The third keycode to check.
89 *
90 * \return `true` if the sequence buffer matches.
91 */
92bool leader_sequence_three_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3);
93
94/**
95 * Check the sequence buffer for the given keycodes.
96 *
97 * \param kc1 The first keycode to check.
98 * \param kc2 The second keycode to check.
99 * \param kc3 The third keycode to check.
100 * \param kc4 The fourth keycode to check.
101 *
102 * \return `true` if the sequence buffer matches.
103 */
104bool leader_sequence_four_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3, uint16_t kc4);
105
106/**
107 * Check the sequence buffer for the given keycodes.
108 *
109 * \param kc1 The first keycode to check.
110 * \param kc2 The second keycode to check.
111 * \param kc3 The third keycode to check.
112 * \param kc4 The fourth keycode to check.
113 * \param kc5 The fifth keycode to check.
114 *
115 * \return `true` if the sequence buffer matches.
116 */
117bool leader_sequence_five_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3, uint16_t kc4, uint16_t kc5);
118
119/** \} */
diff --git a/quantum/process_keycode/process_leader.c b/quantum/process_keycode/process_leader.c
index 80bc96e65f..a9823b6285 100644
--- a/quantum/process_keycode/process_leader.c
+++ b/quantum/process_keycode/process_leader.c
@@ -15,71 +15,34 @@
15 */ 15 */
16 16
17#include "process_leader.h" 17#include "process_leader.h"
18#include <string.h> 18#include "leader.h"
19 19
20#ifndef LEADER_TIMEOUT 20bool process_leader(uint16_t keycode, keyrecord_t *record) {
21# define LEADER_TIMEOUT 300 21 if (record->event.pressed) {
22 if (leader_sequence_active() && !leader_sequence_timed_out()) {
23#ifndef LEADER_KEY_STRICT_KEY_PROCESSING
24 if (IS_QK_MOD_TAP(keycode)) {
25 keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode);
26 } else if (IS_QK_LAYER_TAP(keycode)) {
27 keycode = QK_LAYER_TAP_GET_TAP_KEYCODE(keycode);
28 }
22#endif 29#endif
23 30
24__attribute__((weak)) void leader_start_user(void) {} 31 if (!leader_sequence_add(keycode)) {
25 32 leader_end();
26__attribute__((weak)) void leader_end_user(void) {}
27
28// Leader key stuff
29bool leading = false;
30uint16_t leader_time = 0;
31
32uint16_t leader_sequence[5] = {0, 0, 0, 0, 0};
33uint8_t leader_sequence_size = 0;
34
35void leader_start(void) {
36 if (leading) {
37 return;
38 }
39 leader_start_user();
40 leading = true;
41 leader_time = timer_read();
42 leader_sequence_size = 0;
43 memset(leader_sequence, 0, sizeof(leader_sequence));
44}
45 33
46void leader_end(void) { 34 return true;
47 leader_end_user(); 35 }
48}
49 36
50bool process_leader(uint16_t keycode, keyrecord_t *record) {
51 // Leader key set-up
52 if (record->event.pressed) {
53 if (leading) {
54#ifndef LEADER_NO_TIMEOUT
55 if (timer_elapsed(leader_time) < LEADER_TIMEOUT)
56#endif // LEADER_NO_TIMEOUT
57 {
58#ifndef LEADER_KEY_STRICT_KEY_PROCESSING
59 if (IS_QK_MOD_TAP(keycode)) {
60 keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode);
61 } else if (IS_QK_LAYER_TAP(keycode)) {
62 keycode = QK_LAYER_TAP_GET_TAP_KEYCODE(keycode);
63 }
64#endif // LEADER_KEY_STRICT_KEY_PROCESSING
65 if (leader_sequence_size < ARRAY_SIZE(leader_sequence)) {
66 leader_sequence[leader_sequence_size] = keycode;
67 leader_sequence_size++;
68 } else {
69 leading = false;
70 leader_end_user();
71 return true;
72 }
73#ifdef LEADER_PER_KEY_TIMING 37#ifdef LEADER_PER_KEY_TIMING
74 leader_time = timer_read(); 38 leader_reset_timer();
75#endif 39#endif
76 return false; 40
77 } 41 return false;
78 } else { 42 } else if (keycode == QK_LEADER) {
79 if (keycode == QK_LEADER) { 43 leader_start();
80 leader_start();
81 }
82 } 44 }
83 } 45 }
46
84 return true; 47 return true;
85} 48}
diff --git a/quantum/process_keycode/process_leader.h b/quantum/process_keycode/process_leader.h
index 82b4a3ed7b..eb0f721f60 100644
--- a/quantum/process_keycode/process_leader.h
+++ b/quantum/process_keycode/process_leader.h
@@ -19,27 +19,3 @@
19#include "quantum.h" 19#include "quantum.h"
20 20
21bool process_leader(uint16_t keycode, keyrecord_t *record); 21bool process_leader(uint16_t keycode, keyrecord_t *record);
22
23void leader_start_user(void);
24void leader_end_user(void);
25
26void leader_start(void);
27void leader_end(void);
28
29#define SEQ_ONE_KEY(key) if (leader_sequence[0] == (key) && leader_sequence[1] == 0 && leader_sequence[2] == 0 && leader_sequence[3] == 0 && leader_sequence[4] == 0)
30#define SEQ_TWO_KEYS(key1, key2) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == 0 && leader_sequence[3] == 0 && leader_sequence[4] == 0)
31#define SEQ_THREE_KEYS(key1, key2, key3) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == (key3) && leader_sequence[3] == 0 && leader_sequence[4] == 0)
32#define SEQ_FOUR_KEYS(key1, key2, key3, key4) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == (key3) && leader_sequence[3] == (key4) && leader_sequence[4] == 0)
33#define SEQ_FIVE_KEYS(key1, key2, key3, key4, key5) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == (key3) && leader_sequence[3] == (key4) && leader_sequence[4] == (key5))
34
35#define LEADER_EXTERNS() \
36 extern bool leading; \
37 extern uint16_t leader_time; \
38 extern uint16_t leader_sequence[5]; \
39 extern uint8_t leader_sequence_size
40
41#ifdef LEADER_NO_TIMEOUT
42# define LEADER_DICTIONARY() if (leading && leader_sequence_size > 0 && timer_elapsed(leader_time) > LEADER_TIMEOUT)
43#else
44# define LEADER_DICTIONARY() if (leading && timer_elapsed(leader_time) > LEADER_TIMEOUT)
45#endif
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 708d325a32..315fa25568 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -93,6 +93,7 @@ extern layer_state_t layer_state;
93#endif 93#endif
94 94
95#ifdef LEADER_ENABLE 95#ifdef LEADER_ENABLE
96# include "leader.h"
96# include "process_leader.h" 97# include "process_leader.h"
97#endif 98#endif
98 99
diff --git a/tests/leader/config.h b/tests/leader/config.h
new file mode 100644
index 0000000000..e8005d4b6d
--- /dev/null
+++ b/tests/leader/config.h
@@ -0,0 +1,6 @@
1// Copyright 2023 QMK
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
6#include "test_common.h"
diff --git a/tests/leader/leader_no_initial_timeout/config.h b/tests/leader/leader_no_initial_timeout/config.h
new file mode 100644
index 0000000000..73b280bce9
--- /dev/null
+++ b/tests/leader/leader_no_initial_timeout/config.h
@@ -0,0 +1,8 @@
1// Copyright 2023 QMK
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
6#include "test_common.h"
7
8#define LEADER_NO_TIMEOUT
diff --git a/tests/leader/leader_no_initial_timeout/test.mk b/tests/leader/leader_no_initial_timeout/test.mk
new file mode 100644
index 0000000000..635c04ee92
--- /dev/null
+++ b/tests/leader/leader_no_initial_timeout/test.mk
@@ -0,0 +1,7 @@
1# --------------------------------------------------------------------------------
2# Keep this file, even if it is empty, as a marker that this folder contains tests
3# --------------------------------------------------------------------------------
4
5LEADER_ENABLE = yes
6
7SRC += ../leader_sequences.c
diff --git a/tests/leader/leader_no_initial_timeout/test_leader_no_initial_timeout.cpp b/tests/leader/leader_no_initial_timeout/test_leader_no_initial_timeout.cpp
new file mode 100644
index 0000000000..c23af65344
--- /dev/null
+++ b/tests/leader/leader_no_initial_timeout/test_leader_no_initial_timeout.cpp
@@ -0,0 +1,48 @@
1// Copyright 2023 QMK
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include "keyboard_report_util.hpp"
5#include "keycode.h"
6#include "test_common.hpp"
7#include "test_keymap_key.hpp"
8
9using testing::_;
10
11class Leader : public TestFixture {};
12
13TEST_F(Leader, does_not_timeout_until_next_key_pressed) {
14 TestDriver driver;
15
16 auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
17 auto key_a = KeymapKey(0, 1, 0, KC_A);
18
19 set_keymap({key_leader, key_a});
20
21 EXPECT_EQ(leader_sequence_active(), false);
22
23 EXPECT_NO_REPORT(driver);
24 tap_key(key_leader);
25
26 EXPECT_EQ(leader_sequence_active(), true);
27
28 idle_for(1000);
29
30 EXPECT_EQ(leader_sequence_active(), true);
31 EXPECT_EQ(leader_sequence_timed_out(), false);
32
33 EXPECT_REPORT(driver, (KC_1));
34 EXPECT_EMPTY_REPORT(driver);
35 tap_key(key_a);
36
37 EXPECT_EQ(leader_sequence_active(), true);
38 EXPECT_EQ(leader_sequence_timed_out(), false);
39
40 idle_for(300);
41
42 EXPECT_EQ(leader_sequence_active(), false);
43 EXPECT_EQ(leader_sequence_timed_out(), true);
44
45 EXPECT_REPORT(driver, (KC_A));
46 EXPECT_EMPTY_REPORT(driver);
47 tap_key(key_a);
48}
diff --git a/tests/leader/leader_per_key_timeout/config.h b/tests/leader/leader_per_key_timeout/config.h
new file mode 100644
index 0000000000..045e7c1a57
--- /dev/null
+++ b/tests/leader/leader_per_key_timeout/config.h
@@ -0,0 +1,5 @@
1#pragma once
2
3#include "test_common.h"
4
5#define LEADER_PER_KEY_TIMING
diff --git a/tests/leader/leader_per_key_timeout/test.mk b/tests/leader/leader_per_key_timeout/test.mk
new file mode 100644
index 0000000000..635c04ee92
--- /dev/null
+++ b/tests/leader/leader_per_key_timeout/test.mk
@@ -0,0 +1,7 @@
1# --------------------------------------------------------------------------------
2# Keep this file, even if it is empty, as a marker that this folder contains tests
3# --------------------------------------------------------------------------------
4
5LEADER_ENABLE = yes
6
7SRC += ../leader_sequences.c
diff --git a/tests/leader/leader_per_key_timeout/test_leader_per_key_timeout.cpp b/tests/leader/leader_per_key_timeout/test_leader_per_key_timeout.cpp
new file mode 100644
index 0000000000..a1e9eb3c77
--- /dev/null
+++ b/tests/leader/leader_per_key_timeout/test_leader_per_key_timeout.cpp
@@ -0,0 +1,40 @@
1// Copyright 2023 QMK
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include "keyboard_report_util.hpp"
5#include "keycode.h"
6#include "test_common.hpp"
7#include "test_keymap_key.hpp"
8
9using testing::_;
10
11class Leader : public TestFixture {};
12
13TEST_F(Leader, does_not_timeout_during_sequence) {
14 TestDriver driver;
15
16 auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
17 auto key_a = KeymapKey(0, 1, 0, KC_A);
18 auto key_b = KeymapKey(0, 2, 0, KC_B);
19 auto key_c = KeymapKey(0, 3, 0, KC_C);
20
21 set_keymap({key_leader, key_a, key_b, key_c});
22
23 tap_key(key_leader);
24
25 EXPECT_NO_REPORT(driver);
26 tap_key(key_a);
27
28 idle_for(150);
29
30 EXPECT_NO_REPORT(driver);
31 tap_key(key_b);
32
33 idle_for(150);
34
35 EXPECT_REPORT(driver, (KC_3));
36 EXPECT_EMPTY_REPORT(driver);
37 tap_key(key_c);
38
39 idle_for(300);
40}
diff --git a/tests/leader/leader_sequences.c b/tests/leader/leader_sequences.c
new file mode 100644
index 0000000000..39e23623b3
--- /dev/null
+++ b/tests/leader/leader_sequences.c
@@ -0,0 +1,26 @@
1// Copyright 2023 QMK
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include "quantum.h"
5
6void leader_end_user(void) {
7 if (leader_sequence_one_key(KC_A)) {
8 tap_code(KC_1);
9 }
10
11 if (leader_sequence_two_keys(KC_A, KC_B)) {
12 tap_code(KC_2);
13 }
14
15 if (leader_sequence_three_keys(KC_A, KC_B, KC_C)) {
16 tap_code(KC_3);
17 }
18
19 if (leader_sequence_four_keys(KC_A, KC_B, KC_C, KC_D)) {
20 tap_code(KC_4);
21 }
22
23 if (leader_sequence_five_keys(KC_A, KC_B, KC_C, KC_D, KC_E)) {
24 tap_code(KC_5);
25 }
26}
diff --git a/tests/leader/leader_strict_key_processing/config.h b/tests/leader/leader_strict_key_processing/config.h
new file mode 100644
index 0000000000..cca5ed0458
--- /dev/null
+++ b/tests/leader/leader_strict_key_processing/config.h
@@ -0,0 +1,8 @@
1// Copyright 2023 QMK
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
6#include "test_common.h"
7
8#define LEADER_KEY_STRICT_KEY_PROCESSING
diff --git a/tests/leader/leader_strict_key_processing/test.mk b/tests/leader/leader_strict_key_processing/test.mk
new file mode 100644
index 0000000000..635c04ee92
--- /dev/null
+++ b/tests/leader/leader_strict_key_processing/test.mk
@@ -0,0 +1,7 @@
1# --------------------------------------------------------------------------------
2# Keep this file, even if it is empty, as a marker that this folder contains tests
3# --------------------------------------------------------------------------------
4
5LEADER_ENABLE = yes
6
7SRC += ../leader_sequences.c
diff --git a/tests/leader/leader_strict_key_processing/test_leader_strict_key_processing.cpp b/tests/leader/leader_strict_key_processing/test_leader_strict_key_processing.cpp
new file mode 100644
index 0000000000..de6bcf0fce
--- /dev/null
+++ b/tests/leader/leader_strict_key_processing/test_leader_strict_key_processing.cpp
@@ -0,0 +1,45 @@
1// Copyright 2023 QMK
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include "keyboard_report_util.hpp"
5#include "keycode.h"
6#include "test_common.hpp"
7#include "test_keymap_key.hpp"
8
9using testing::_;
10
11class Leader : public TestFixture {};
12
13TEST_F(Leader, does_not_extract_mod_tap_keycode) {
14 TestDriver driver;
15
16 auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
17 auto key_mt = KeymapKey(0, 1, 0, LSFT_T(KC_A));
18
19 set_keymap({key_leader, key_mt});
20
21 tap_key(key_leader);
22
23 EXPECT_NO_REPORT(driver);
24 tap_key(key_mt);
25
26 EXPECT_EQ(leader_sequence_one_key(KC_A), false);
27 EXPECT_EQ(leader_sequence_one_key(LSFT_T(KC_A)), true);
28}
29
30TEST_F(Leader, does_not_extract_layer_tap_keycode) {
31 TestDriver driver;
32
33 auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
34 auto key_lt = KeymapKey(0, 1, 0, LT(1, KC_A));
35
36 set_keymap({key_leader, key_lt});
37
38 tap_key(key_leader);
39
40 EXPECT_NO_REPORT(driver);
41 tap_key(key_lt);
42
43 EXPECT_EQ(leader_sequence_one_key(KC_A), false);
44 EXPECT_EQ(leader_sequence_one_key(LT(1, KC_A)), true);
45}
diff --git a/tests/leader/test.mk b/tests/leader/test.mk
new file mode 100644
index 0000000000..bae8bfcc41
--- /dev/null
+++ b/tests/leader/test.mk
@@ -0,0 +1,7 @@
1# --------------------------------------------------------------------------------
2# Keep this file, even if it is empty, as a marker that this folder contains tests
3# --------------------------------------------------------------------------------
4
5LEADER_ENABLE = yes
6
7SRC += leader_sequences.c
diff --git a/tests/leader/test_leader.cpp b/tests/leader/test_leader.cpp
new file mode 100644
index 0000000000..7349d2f89f
--- /dev/null
+++ b/tests/leader/test_leader.cpp
@@ -0,0 +1,224 @@
1// Copyright 2023 QMK
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include "keyboard_report_util.hpp"
5#include "keycode.h"
6#include "test_common.hpp"
7#include "test_keymap_key.hpp"
8
9using testing::_;
10
11class Leader : public TestFixture {};
12
13TEST_F(Leader, triggers_one_key_sequence) {
14 TestDriver driver;
15
16 auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
17 auto key_a = KeymapKey(0, 1, 0, KC_A);
18
19 set_keymap({key_leader, key_a});
20
21 EXPECT_EQ(leader_sequence_active(), false);
22
23 EXPECT_NO_REPORT(driver);
24 tap_key(key_leader);
25
26 EXPECT_EQ(leader_sequence_active(), true);
27
28 EXPECT_REPORT(driver, (KC_1));
29 EXPECT_EMPTY_REPORT(driver);
30 tap_key(key_a);
31
32 EXPECT_EQ(leader_sequence_timed_out(), false);
33
34 idle_for(300);
35
36 EXPECT_EQ(leader_sequence_active(), false);
37 EXPECT_EQ(leader_sequence_timed_out(), true);
38
39 EXPECT_REPORT(driver, (KC_A));
40 EXPECT_EMPTY_REPORT(driver);
41 tap_key(key_a);
42}
43
44TEST_F(Leader, triggers_two_key_sequence) {
45 TestDriver driver;
46
47 auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
48 auto key_a = KeymapKey(0, 1, 0, KC_A);
49 auto key_b = KeymapKey(0, 2, 0, KC_B);
50
51 set_keymap({key_leader, key_a, key_b});
52
53 EXPECT_EQ(leader_sequence_active(), false);
54
55 EXPECT_NO_REPORT(driver);
56 tap_key(key_leader);
57
58 EXPECT_EQ(leader_sequence_active(), true);
59
60 EXPECT_REPORT(driver, (KC_2));
61 EXPECT_EMPTY_REPORT(driver);
62 tap_key(key_a);
63 tap_key(key_b);
64
65 EXPECT_EQ(leader_sequence_timed_out(), false);
66
67 idle_for(300);
68
69 EXPECT_EQ(leader_sequence_active(), false);
70 EXPECT_EQ(leader_sequence_timed_out(), true);
71
72 EXPECT_REPORT(driver, (KC_A));
73 EXPECT_EMPTY_REPORT(driver);
74 tap_key(key_a);
75}
76
77TEST_F(Leader, triggers_three_key_sequence) {
78 TestDriver driver;
79
80 auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
81 auto key_a = KeymapKey(0, 1, 0, KC_A);
82 auto key_b = KeymapKey(0, 2, 0, KC_B);
83 auto key_c = KeymapKey(0, 3, 0, KC_C);
84
85 set_keymap({key_leader, key_a, key_b, key_c});
86
87 EXPECT_EQ(leader_sequence_active(), false);
88
89 EXPECT_NO_REPORT(driver);
90 tap_key(key_leader);
91
92 EXPECT_EQ(leader_sequence_active(), true);
93
94 EXPECT_REPORT(driver, (KC_3));
95 EXPECT_EMPTY_REPORT(driver);
96 tap_key(key_a);
97 tap_key(key_b);
98 tap_key(key_c);
99
100 EXPECT_EQ(leader_sequence_timed_out(), false);
101
102 idle_for(300);
103
104 EXPECT_EQ(leader_sequence_active(), false);
105 EXPECT_EQ(leader_sequence_timed_out(), true);
106
107 EXPECT_REPORT(driver, (KC_A));
108 EXPECT_EMPTY_REPORT(driver);
109 tap_key(key_a);
110}
111
112TEST_F(Leader, triggers_four_key_sequence) {
113 TestDriver driver;
114
115 auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
116 auto key_a = KeymapKey(0, 1, 0, KC_A);
117 auto key_b = KeymapKey(0, 2, 0, KC_B);
118 auto key_c = KeymapKey(0, 3, 0, KC_C);
119 auto key_d = KeymapKey(0, 4, 0, KC_D);
120
121 set_keymap({key_leader, key_a, key_b, key_c, key_d});
122
123 EXPECT_EQ(leader_sequence_active(), false);
124
125 EXPECT_NO_REPORT(driver);
126 tap_key(key_leader);
127
128 EXPECT_EQ(leader_sequence_active(), true);
129
130 EXPECT_REPORT(driver, (KC_4));
131 EXPECT_EMPTY_REPORT(driver);
132 tap_key(key_a);
133 tap_key(key_b);
134 tap_key(key_c);
135 tap_key(key_d);
136
137 EXPECT_EQ(leader_sequence_timed_out(), false);
138
139 idle_for(300);
140
141 EXPECT_EQ(leader_sequence_active(), false);
142 EXPECT_EQ(leader_sequence_timed_out(), true);
143
144 EXPECT_REPORT(driver, (KC_A));
145 EXPECT_EMPTY_REPORT(driver);
146 tap_key(key_a);
147}
148
149TEST_F(Leader, triggers_five_key_sequence) {
150 TestDriver driver;
151
152 auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
153 auto key_a = KeymapKey(0, 1, 0, KC_A);
154 auto key_b = KeymapKey(0, 2, 0, KC_B);
155 auto key_c = KeymapKey(0, 3, 0, KC_C);
156 auto key_d = KeymapKey(0, 4, 0, KC_D);
157 auto key_e = KeymapKey(0, 5, 0, KC_E);
158
159 set_keymap({key_leader, key_a, key_b, key_c, key_d, key_e});
160
161 EXPECT_EQ(leader_sequence_active(), false);
162
163 EXPECT_NO_REPORT(driver);
164 tap_key(key_leader);
165
166 EXPECT_EQ(leader_sequence_active(), true);
167
168 EXPECT_REPORT(driver, (KC_5));
169 EXPECT_EMPTY_REPORT(driver);
170 tap_key(key_a);
171 tap_key(key_b);
172 tap_key(key_c);
173 tap_key(key_d);
174 tap_key(key_e);
175
176 EXPECT_EQ(leader_sequence_timed_out(), false);
177
178 idle_for(300);
179
180 EXPECT_EQ(leader_sequence_active(), false);
181 EXPECT_EQ(leader_sequence_timed_out(), true);
182
183 EXPECT_REPORT(driver, (KC_A));
184 EXPECT_EMPTY_REPORT(driver);
185 tap_key(key_a);
186}
187
188TEST_F(Leader, extracts_mod_tap_keycode) {
189 TestDriver driver;
190
191 auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
192 auto key_mt = KeymapKey(0, 1, 0, LSFT_T(KC_A));
193
194 set_keymap({key_leader, key_mt});
195
196 tap_key(key_leader);
197
198 EXPECT_REPORT(driver, (KC_1));
199 EXPECT_EMPTY_REPORT(driver);
200 tap_key(key_mt);
201
202 EXPECT_EQ(leader_sequence_one_key(KC_A), true);
203
204 idle_for(300);
205}
206
207TEST_F(Leader, extracts_layer_tap_keycode) {
208 TestDriver driver;
209
210 auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
211 auto key_lt = KeymapKey(0, 1, 0, LT(1, KC_A));
212
213 set_keymap({key_leader, key_lt});
214
215 tap_key(key_leader);
216
217 EXPECT_REPORT(driver, (KC_1));
218 EXPECT_EMPTY_REPORT(driver);
219 tap_key(key_lt);
220
221 EXPECT_EQ(leader_sequence_one_key(KC_A), true);
222
223 idle_for(300);
224}
diff --git a/users/alfrdmalr/alfrdmalr.c b/users/alfrdmalr/alfrdmalr.c
index 18ce8bad7c..7bc04fb55c 100644
--- a/users/alfrdmalr/alfrdmalr.c
+++ b/users/alfrdmalr/alfrdmalr.c
@@ -7,7 +7,12 @@ uint16_t muse_counter = 0;
7uint8_t muse_offset = 70; 7uint8_t muse_offset = 70;
8uint16_t muse_tempo = 50; 8uint16_t muse_tempo = 50;
9 9
10LEADER_EXTERNS(); 10void leader_end_user(void) {
11 // reset keyboard to bootloader
12 if (leader_sequence_five_keys(KC_R, KC_E, KC_S, KC_E, KC_T)) {
13 reset_keyboard();
14 }
15}
11 16
12void matrix_scan_user(void) { 17void matrix_scan_user(void) {
13#ifdef AUDIO_ENABLE 18#ifdef AUDIO_ENABLE
@@ -28,15 +33,6 @@ void matrix_scan_user(void) {
28 } 33 }
29 } 34 }
30#endif 35#endif
31
32 LEADER_DICTIONARY() {
33 leading = false;
34 // reset keyboard to bootloader
35 SEQ_FIVE_KEYS(KC_R, KC_E, KC_S, KC_E, KC_T) {
36 reset_keyboard();
37 }
38 leader_end();
39 }
40} 36}
41 37
42bool syml_pressed = false; 38bool syml_pressed = false;
diff --git a/users/arkag/arkag.c b/users/arkag/arkag.c
index 7074da18eb..4e80b318a7 100644
--- a/users/arkag/arkag.c
+++ b/users/arkag/arkag.c
@@ -303,146 +303,141 @@ void pri_mod_keystroke(uint16_t key) {
303 pri_mod(false); 303 pri_mod(false);
304} 304}
305 305
306void leader_end_user(void) {
307 // begin OS functions
308 if (leader_sequence_two_keys(KC_P, KC_B)) {
309 if (current_os == OS_WIN) {
310 long_keystroke(2, (uint16_t[]){KC_LGUI, KC_PAUSE});
311 } else {
312 return;
313 }
314 }
315 if (leader_sequence_two_keys(KC_S, KC_S)) {
316 if (current_os == OS_MAC) {
317 long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_4});
318 } else if (current_os == OS_WIN) {
319 long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_S});
320 } else {
321 return;
322 }
323 }
324 if (leader_sequence_three_keys(KC_C, KC_A, KC_D)) {
325 if (current_os == OS_WIN) {
326 long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_DEL});
327 } else {
328 }
329 }
330 if (leader_sequence_three_keys(KC_C, KC_A, KC_E)) {
331 if (current_os == OS_WIN) {
332 long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_END});
333 } else {
334 }
335 }
336 // end OS functions
337
338 // begin format functions
339 if (leader_sequence_one_key(KC_B)) {
340 surround_type(2, KC_8, true);
341 }
342 if (leader_sequence_one_key(KC_I)) {
343 surround_type(2, KC_MINS, true);
344 }
345 if (leader_sequence_one_key(KC_U)) {
346 surround_type(4, KC_MINS, true);
347 }
348 if (leader_sequence_one_key(KC_S)) {
349 surround_type(4, KC_GRAVE, true);
350 }
351 if (leader_sequence_one_key(KC_C)) {
352 register_unicode(0x00E7); // ç
353 }
354 if (leader_sequence_two_keys(KC_A, KC_V)) {
355 surround_type(2, KC_QUOT, true);
356 pair_surround_type(2, KC_LCBR, true);
357 surround_type(2, KC_SPC, false);
358 }
359 if (leader_sequence_two_keys(KC_M, KC_L)) {
360 pair_surround_type(1, KC_LBRC, false);
361 SEND_STRING("LINK_NAME");
362 tap_code(KC_RGHT);
363 pair_surround_type(1, KC_LPRN, true);
364 pri_mod_keystroke(KC_V);
365 }
366 if (leader_sequence_two_keys(KC_C, KC_C)) {
367 surround_type(2, KC_GRAVE, false);
368 }
369 if (leader_sequence_three_keys(KC_C, KC_C, KC_C)) {
370 surround_type(6, KC_GRAVE, false);
371 }
372 if (leader_sequence_one_key(KC_E)) {
373 register_unicode(0x00E8); // è
374 }
375 if (leader_sequence_two_keys(KC_E, KC_E)) {
376 register_unicode(0x00E9); // é
377 }
378 // end format functions
379
380 // start fancy functions
381 if (leader_sequence_two_keys(KC_V, KC_P)) {
382 SEND_STRING("ggvG}x:set paste\ni");
383 pri_mod_keystroke(KC_V);
384 }
385 if (leader_sequence_three_keys(KC_C, KC_C, KC_ENT)) {
386 surround_type(6, KC_GRAVE, false);
387 pri_mod_keystroke(KC_V);
388 multi_tap(3, KC_RGHT, false);
389 tap_code(KC_ENTER);
390 }
391 if (leader_sequence_three_keys(KC_T, KC_C, KC_ENT)) {
392 multi_tap(3, KC_GRAVE, false);
393 pri_mod_keystroke(KC_V);
394 multi_tap(2, KC_ENTER, false);
395 }
396 // end fancy functions
397
398 // start typing functions
399 if (leader_sequence_two_keys(KC_T, KC_M)) {
400 register_unicode(0x2122); // ™
401 }
402 if (leader_sequence_two_keys(KC_D, KC_D)) {
403 SEND_STRING(".\\Administrator");
404 }
405 if (leader_sequence_three_keys(KC_D, KC_D, KC_D)) {
406 SEND_STRING(".\\Administrator");
407 tap_code(KC_TAB);
408 pri_mod_keystroke(KC_V);
409 tap_code(KC_ENTER);
410 }
411 if (leader_sequence_three_keys(KC_L, KC_O, KC_D)) {
412 send_unicode_string("ಠ__ಠ");
413 }
414 if (leader_sequence_three_keys(KC_M, KC_A, KC_P)) {
415 SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/users/arkag");
416 }
417 if (leader_sequence_two_keys(KC_F, KC_F)) {
418 send_unicode_string("(╯‵Д′)╯彡┻━┻");
419 }
420 if (leader_sequence_three_keys(KC_F, KC_F, KC_F)) {
421 send_unicode_string("┬─┬ノ( º _ º ノ)");
422 }
423 if (leader_sequence_three_keys(KC_L, KC_O, KC_L)) {
424 send_unicode_string("( ͡° ͜ʖ ͡°)");
425 }
426 if (leader_sequence_three_keys(KC_S, KC_S, KC_S)) {
427 send_unicode_string("¯\\_(ツ)_/¯");
428 }
429 // end typing functions
430}
431
306void matrix_init_user(void) { 432void matrix_init_user(void) {
307 current_os = eeprom_read_byte(EECONFIG_USERSPACE); 433 current_os = eeprom_read_byte(EECONFIG_USERSPACE);
308 set_os(current_os, false); 434 set_os(current_os, false);
309} 435}
310 436
311LEADER_EXTERNS();
312
313void matrix_scan_user(void) { 437void matrix_scan_user(void) {
314 check_state(); 438 check_state();
315 flash_rgb(); 439 flash_rgb();
316 fade_rgb(); 440 fade_rgb();
317 LEADER_DICTIONARY() {
318 leading = false;
319 leader_end();
320
321 // begin OS functions
322 SEQ_TWO_KEYS(KC_P, KC_B) {
323 if (current_os == OS_WIN) {
324 long_keystroke(2, (uint16_t[]){KC_LGUI, KC_PAUSE});
325 } else {
326 return;
327 }
328 }
329 SEQ_TWO_KEYS(KC_S, KC_S) {
330 if (current_os == OS_MAC) {
331 long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_4});
332 } else if (current_os == OS_WIN) {
333 long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_S});
334 } else {
335 return;
336 }
337 }
338 SEQ_THREE_KEYS(KC_C, KC_A, KC_D) {
339 if (current_os == OS_WIN) {
340 long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_DEL});
341 } else {
342 }
343 }
344 SEQ_THREE_KEYS(KC_C, KC_A, KC_E) {
345 if (current_os == OS_WIN) {
346 long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_END});
347 } else {
348 }
349 }
350 // end OS functions
351
352 // begin format functions
353 SEQ_ONE_KEY(KC_B) {
354 surround_type(2, KC_8, true);
355 }
356 SEQ_ONE_KEY(KC_I) {
357 surround_type(2, KC_MINS, true);
358 }
359 SEQ_ONE_KEY(KC_U) {
360 surround_type(4, KC_MINS, true);
361 }
362 SEQ_ONE_KEY(KC_S) {
363 surround_type(4, KC_GRAVE, true);
364 }
365 SEQ_ONE_KEY(KC_C) {
366 register_unicode(0x00E7); // ç
367 }
368 SEQ_TWO_KEYS(KC_A, KC_V) {
369 surround_type(2, KC_QUOT, true);
370 pair_surround_type(2, KC_LCBR, true);
371 surround_type(2, KC_SPC, false);
372 }
373 SEQ_TWO_KEYS(KC_M, KC_L) {
374 pair_surround_type(1, KC_LBRC, false);
375 SEND_STRING("LINK_NAME");
376 tap_code(KC_RGHT);
377 pair_surround_type(1, KC_LPRN, true);
378 pri_mod_keystroke(KC_V);
379 }
380 SEQ_TWO_KEYS(KC_C, KC_C) {
381 surround_type(2, KC_GRAVE, false);
382 }
383 SEQ_THREE_KEYS(KC_C, KC_C, KC_C) {
384 surround_type(6, KC_GRAVE, false);
385 }
386 SEQ_ONE_KEY(KC_E) {
387 register_unicode(0x00E8); // è
388 }
389 SEQ_TWO_KEYS(KC_E, KC_E) {
390 register_unicode(0x00E9); // é
391 }
392 // end format functions
393
394 // start fancy functions
395 SEQ_TWO_KEYS(KC_V, KC_P) {
396 SEND_STRING("ggvG}x:set paste\ni");
397 pri_mod_keystroke(KC_V);
398 }
399 SEQ_THREE_KEYS(KC_C, KC_C, KC_ENT) {
400 surround_type(6, KC_GRAVE, false);
401 pri_mod_keystroke(KC_V);
402 multi_tap(3, KC_RGHT, false);
403 tap_code(KC_ENTER);
404 }
405 SEQ_THREE_KEYS(KC_T, KC_C, KC_ENT) {
406 multi_tap(3, KC_GRAVE, false);
407 pri_mod_keystroke(KC_V);
408 multi_tap(2, KC_ENTER, false);
409 }
410 // end fancy functions
411
412 // start typing functions
413 SEQ_TWO_KEYS(KC_T, KC_M) {
414 register_unicode(0x2122); // ™
415 }
416 SEQ_TWO_KEYS(KC_D, KC_D) {
417 SEND_STRING(".\\Administrator");
418 }
419 SEQ_THREE_KEYS(KC_D, KC_D, KC_D) {
420 SEND_STRING(".\\Administrator");
421 tap_code(KC_TAB);
422 pri_mod_keystroke(KC_V);
423 tap_code(KC_ENTER);
424 }
425 SEQ_THREE_KEYS(KC_L, KC_O, KC_D) {
426 send_unicode_string("ಠ__ಠ");
427 }
428 SEQ_THREE_KEYS(KC_M, KC_A, KC_P) {
429 SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/users/arkag");
430 }
431 SEQ_TWO_KEYS(KC_F, KC_F) {
432 send_unicode_string("(╯‵Д′)╯彡┻━┻");
433 }
434 SEQ_THREE_KEYS(KC_F, KC_F, KC_F) {
435 send_unicode_string("┬─┬ノ( º _ º ノ)");
436 }
437 SEQ_THREE_KEYS(KC_L, KC_O, KC_L) {
438 send_unicode_string("( ͡° ͜ʖ ͡°)");
439 }
440 SEQ_THREE_KEYS(KC_S, KC_S, KC_S) {
441 send_unicode_string("¯\\_(ツ)_/¯");
442 }
443 // end typing functions
444
445 }
446} 441}
447 442
448bool process_record_user(uint16_t keycode, keyrecord_t *record) { 443bool process_record_user(uint16_t keycode, keyrecord_t *record) {
diff --git a/users/curry/leader.c b/users/curry/leader.c
deleted file mode 100644
index 3fca6a2ec3..0000000000
--- a/users/curry/leader.c
+++ /dev/null
@@ -1,24 +0,0 @@
1#include "curry.h"
2#include "leader.h"
3
4LEADER_EXTERNS();
5
6void matrix_scan_user(void) {
7 static bool has_ran_yet;
8 if (!has_ran_yet) {
9 has_ran_yet = true;
10 startup_user();
11 }
12
13#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
14 matrix_scan_rgb();
15#endif // RGBLIGHT_ENABLE
16 LEADER_DICTIONARY() {
17 leading = false;
18 leader_end();
19 SEQ_ONE_KEY(KC_F) { SEND_STRING(SS_LCTL("akf")); } // Select all and format
20 SEQ_ONE_KEY(KC_P) { SEND_STRING(SS_LCTL(SS_LSFT("4"))); } // Screenshot region
21 SEQ_TWO_KEYS(KC_D, KC_D) { SEND_STRING(SS_LCTL("ac")); } // Copy all
22 }
23 matrix_scan_keymap();
24}
diff --git a/users/curry/leader_user.c b/users/curry/leader_user.c
new file mode 100644
index 0000000000..9cee19af49
--- /dev/null
+++ b/users/curry/leader_user.c
@@ -0,0 +1,31 @@
1#include "curry.h"
2#include "leader_user.h"
3
4void leader_end_user(void) {
5 if (leader_sequence_one_key(KC_F)) {
6 // Select all and format
7 SEND_STRING(SS_LCTL("akf"));
8 }
9 if (leader_sequence_one_key(KC_P)) {
10 // Screenshot region
11 SEND_STRING(SS_LCTL(SS_LSFT("4")));
12 }
13 if (leader_sequence_two_keys(KC_D, KC_D)) {
14 // Copy all
15 SEND_STRING(SS_LCTL("ac"));
16 }
17}
18
19void matrix_scan_user(void) {
20 static bool has_ran_yet;
21 if (!has_ran_yet) {
22 has_ran_yet = true;
23 startup_user();
24 }
25
26#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
27 matrix_scan_rgb();
28#endif // RGBLIGHT_ENABLE
29
30 matrix_scan_keymap();
31}
diff --git a/users/curry/leader.h b/users/curry/leader_user.h
index f215893b9e..f215893b9e 100644
--- a/users/curry/leader.h
+++ b/users/curry/leader_user.h
diff --git a/users/curry/rules.mk b/users/curry/rules.mk
index 724f97f5eb..aa89110276 100644
--- a/users/curry/rules.mk
+++ b/users/curry/rules.mk
@@ -29,7 +29,7 @@ ifeq ($(strip $(OLED_ENABLE)), yes)
29endif 29endif
30 30
31ifeq ($(strip $(LEADER_ENABLE)), yes) 31ifeq ($(strip $(LEADER_ENABLE)), yes)
32 SRC += leader.c 32 SRC += leader_user.c
33endif 33endif
34 34
35ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) 35ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
diff --git a/users/danielo515/danielo515.c b/users/danielo515/danielo515.c
index 1c7718f1d2..aa33f55d66 100644
--- a/users/danielo515/danielo515.c
+++ b/users/danielo515/danielo515.c
@@ -4,84 +4,121 @@ bool onMac = true;
4 4
5//**************** LEADER *********************// 5//**************** LEADER *********************//
6#ifdef LEADER_ENABLE 6#ifdef LEADER_ENABLE
7LEADER_EXTERNS(); 7void leader_start_user(vodi) {
8# ifdef RGBLIGHT_ENABLE 8# ifdef RGBLIGHT_ENABLE
9 9 rgblight_setrgb_range(5, 100, 199, 10, 15);
10void leader_start_user(void) { rgblight_setrgb_range(5, 100, 199, 10, 15); };
11
12void leader_end_user(void) { rgblight_setrgb_range(200, 200, 255, 10, 15); };
13# endif 10# endif
11}
14 12
15void matrix_scan_user(void) { 13void leader_end_user() {
16 if (leading && leader_sequence_size > 0 && timer_elapsed(leader_time) > LEADER_TIMEOUT) { 14 if (leader_sequence_one_key(KC_T)) {
17 leading = false; 15 SEND_STRING("``" SS_TAP(X_LEFT));
18 SEQ_ONE_KEY(KC_T) { SEND_STRING("``" SS_TAP(X_LEFT)); } 16 }
19 // Triple ticks 17 // Triple ticks
20 SEQ_TWO_KEYS(KC_T, KC_T) { SEND_STRING("```" SS_TAP(X_ENTER) SS_TAP(X_ENTER) "```" SS_TAP(X_UP)); } 18 if (leader_sequence_two_keys(KC_T, KC_T)) {
21 // ==== International spanish accent vowels ==== 19 SEND_STRING("```" SS_TAP(X_ENTER) SS_TAP(X_ENTER) "```" SS_TAP(X_UP));
22 SEQ_ONE_KEY(KC_A) { SEND_STRING(SS_LALT("e") "a"); } 20 }
23 SEQ_ONE_KEY(KC_E) { SEND_STRING(SS_LALT("e") "e"); } 21 // ==== International spanish accent vowels ====
24 SEQ_ONE_KEY(KC_I) { SEND_STRING(SS_LALT("e") "i"); } 22 if (leader_sequence_one_key(KC_A)) {
25 SEQ_ONE_KEY(KC_O) { SEND_STRING(SS_LALT("e") "o"); } 23 SEND_STRING(SS_LALT("e") "a");
26 SEQ_ONE_KEY(KC_U) { SEND_STRING(SS_LALT("e") "u"); } 24 }
27 SEQ_ONE_KEY(KC_N) { SEND_STRING(SS_LALT("n") "n"); } 25 if (leader_sequence_one_key(KC_E)) {
28 // ==== MACROS === 26 SEND_STRING(SS_LALT("e") "e");
29 SEQ_ONE_KEY(KC_G) { SEND_STRING(" | grep "); } 27 }
30 SEQ_ONE_KEY(KC_K) { onMac ? SEND_STRING(SS_LCTL(" ")) : SEND_STRING(SS_LCTL("f")); } 28 if (leader_sequence_one_key(KC_I)) {
31 // vim delete all 29 SEND_STRING(SS_LALT("e") "i");
32 SEQ_TWO_KEYS(KC_D, KC_G) { 30 }
33 if (onMac) { 31 if (leader_sequence_one_key(KC_O)) {
34 SEND_STRING(SS_LGUI("a") SS_TAP(X_D)); 32 SEND_STRING(SS_LALT("e") "o");
35 } else { 33 }
36 SEND_STRING(SS_LCTL("a") SS_TAP(X_D)); 34 if (leader_sequence_one_key(KC_U)) {
37 } 35 SEND_STRING(SS_LALT("e") "u");
36 }
37 if (leader_sequence_one_key(KC_N)) {
38 SEND_STRING(SS_LALT("n") "n");
39 }
40 // ==== MACROS ===
41 if (leader_sequence_one_key(KC_G)) {
42 SEND_STRING(" | grep ");
43 }
44 if (leader_sequence_one_key(KC_K)) {
45 onMac ? SEND_STRING(SS_LCTL(" ")) : SEND_STRING(SS_LCTL("f"));
46 }
47 // vim delete all
48 if (leader_sequence_two_keys(KC_D, KC_G)) {
49 if (onMac) {
50 SEND_STRING(SS_LGUI("a") SS_TAP(X_D));
51 } else {
52 SEND_STRING(SS_LCTL("a") SS_TAP(X_D));
38 } 53 }
39 // tripe delete! 54 }
40 SEQ_ONE_KEY(KC_BACKSPACE) { SEND_STRING(SS_TAP(X_BACKSPACE) SS_TAP(X_BACKSPACE) SS_TAP(X_BACKSPACE)); } 55 // tripe delete!
41 SEQ_TWO_KEYS(KC_P, KC_G) { SEND_STRING("ps -ef | grep "); } 56 if (leader_sequence_one_key(KC_BACKSPACE)) {
42 SEQ_TWO_KEYS(KC_J, KC_A) { SEND_STRING("() => {}" SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT)); } 57 SEND_STRING(SS_TAP(X_BACKSPACE) SS_TAP(X_BACKSPACE) SS_TAP(X_BACKSPACE));
43 // this is a pain to type 58 }
44 SEQ_TWO_KEYS(KC_S, KC_S) { SEND_STRING("~/.ssh/ "); } 59 if (leader_sequence_two_keys(KC_P, KC_G)) {
45 SEQ_TWO_KEYS(KC_F, KC_T) { SEND_STRING("feat():" SS_TAP(X_LEFT) SS_TAP(X_LEFT)); } 60 SEND_STRING("ps -ef | grep ");
46 // ### LAYER CHANGE 61 }
47 SEQ_ONE_KEY(KC_1) { layer_on(1); } 62 if (leader_sequence_two_keys(KC_J, KC_A)) {
48 // control enter, because yes 63 SEND_STRING("() => {}" SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT));
49 SEQ_ONE_KEY(KC_H) { SEND_STRING(SS_DOWN(X_LCTL) SS_TAP(X_ENTER) SS_UP(X_LCTL)); } 64 }
50 // paste all 65 // this is a pain to type
51 SEQ_ONE_KEY(KC_P) { 66 if (leader_sequence_two_keys(KC_S, KC_S)) {
52 if (onMac) { 67 SEND_STRING("~/.ssh/ ");
53 SEND_STRING(SS_LGUI("a") SS_LGUI("v")); 68 }
54 } else { 69 if (leader_sequence_two_keys(KC_F, KC_T)) {
55 SEND_STRING(SS_LCTL("a") SS_LCTL("v")); 70 SEND_STRING("feat():" SS_TAP(X_LEFT) SS_TAP(X_LEFT));
56 } 71 }
72 // ### LAYER CHANGE
73 if (leader_sequence_one_key(KC_1)) {
74 layer_on(1);
75 }
76 // control enter, because yes
77 if (leader_sequence_one_key(KC_H)) {
78 SEND_STRING(SS_DOWN(X_LCTL) SS_TAP(X_ENTER) SS_UP(X_LCTL));
79 }
80 // paste all
81 if (leader_sequence_one_key(KC_P)) {
82 if (onMac) {
83 SEND_STRING(SS_LGUI("a") SS_LGUI("v"));
84 } else {
85 SEND_STRING(SS_LCTL("a") SS_LCTL("v"));
57 } 86 }
58 SEQ_THREE_KEYS(KC_M, KC_A, KC_C) { 87 }
59 onMac = true; 88 if (leader_sequence_three_keys(KC_M, KC_A, KC_C)) {
89 onMac = true;
60# ifdef RGBLIGHT_ENABLE 90# ifdef RGBLIGHT_ENABLE
61 rgblight_setrgb(255, 255, 255); 91 rgblight_setrgb(255, 255, 255);
62# endif 92# endif
63 } 93 }
64 SEQ_THREE_KEYS(KC_W, KC_I, KC_N) { 94 if (leader_sequence_three_keys(KC_W, KC_I, KC_N)) {
65 onMac = false; 95 onMac = false;
66# ifdef RGBLIGHT_ENABLE 96# ifdef RGBLIGHT_ENABLE
67 rgblight_setrgb(255, 255, 0); 97 rgblight_setrgb(255, 255, 0);
68# endif 98# endif
99 }
100 /* Copy all */
101 if (leader_sequence_one_key(KC_Y)) {
102 if (onMac) {
103 SEND_STRING(SS_LGUI("a") SS_LGUI("c"));
104 } else {
105 SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
69 } 106 }
70 /* Copy all */ 107 }
71 SEQ_ONE_KEY(KC_Y) { 108 // emoji bar
72 if (onMac) { 109 if (leader_sequence_two_keys(KC_E, KC_E)) {
73 SEND_STRING(SS_LGUI("a") SS_LGUI("c")); 110 SEND_STRING(SS_DOWN(X_LGUI) SS_LCTL(" ") SS_UP(X_LGUI));
74 } else { 111 }
75 SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
76 }
77 }
78 // emoji bar
79 SEQ_TWO_KEYS(KC_E, KC_E) { SEND_STRING(SS_DOWN(X_LGUI) SS_LCTL(" ") SS_UP(X_LGUI)); }
80
81 SEQ_TWO_KEYS(KC_F, KC_F) { SEND_STRING("ps -ef | grep "); }
82 SEQ_TWO_KEYS(KC_H, KC_T) { SEND_STRING("https://"); }
83 112
84 leader_end(); 113 if (leader_sequence_two_keys(KC_F, KC_F)) {
114 SEND_STRING("ps -ef | grep ");
85 } 115 }
116 if (leader_sequence_two_keys(KC_H, KC_T)) {
117 SEND_STRING("https://");
118 }
119
120# ifdef RGBLIGHT_ENABLE
121 rgblight_setrgb_range(200, 200, 255, 10, 15);
122# endif
86} 123}
87#endif // LEADER 124#endif // LEADER
diff --git a/users/jjerrell/jjerrell.c b/users/jjerrell/jjerrell.c
index 95c2acba5e..47aa9bc042 100644
--- a/users/jjerrell/jjerrell.c
+++ b/users/jjerrell/jjerrell.c
@@ -23,41 +23,36 @@ __attribute__((weak)) void matrix_scan_keymap(void) {}
23__attribute__((weak)) void leader_scan_secrets(void) {} 23__attribute__((weak)) void leader_scan_secrets(void) {}
24 24
25#ifdef LEADER_ENABLE 25#ifdef LEADER_ENABLE
26 LEADER_EXTERNS(); 26void leader_end_user(void) {
27 void matrix_scan_leader(void) { 27 static uint8_t mods = 0;
28 static uint8_t mods = 0; 28 mods = get_mods();
29 mods = get_mods(); 29 clear_mods();
30 LEADER_DICTIONARY() { 30
31 leading = false; 31 // Website Refresh / XCode "Run"
32 leader_end(); 32 if (leader_sequence_one_key(KC_R)) {
33 clear_mods(); 33 SEND_STRING(SS_LGUI("r"));
34 34 }
35 // Website Refresh / XCode "Run" 35
36 SEQ_ONE_KEY(KC_R) { 36 if (leader_sequence_two_keys(KC_B, KC_D)) {
37 SEND_STRING(SS_LGUI("r")); 37 send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " Built at: " QMK_BUILDDATE), TAP_CODE_DELAY);
38 } 38 }
39 39
40 SEQ_TWO_KEYS(KC_B, KC_D) { 40 if (leader_sequence_two_keys(KC_L, KC_C)) {
41 send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " Built at: " QMK_BUILDDATE), TAP_CODE_DELAY); 41 send_string_with_delay("/** */", TAP_CODE_DELAY);
42 } 42 wait_ms(TAPPING_TERM);
43 43 tap_code(KC_LEFT);
44 SEQ_TWO_KEYS(KC_L, KC_C) { 44 tap_code(KC_LEFT);
45 send_string_with_delay("/** */", TAP_CODE_DELAY); 45 tap_code(KC_LEFT);
46 wait_ms(TAPPING_TERM); 46 if (!(mods & MOD_MASK_SHIFT)) {
47 tap_code(KC_LEFT); 47 tap_code(KC_ENT);
48 tap_code(KC_LEFT);
49 tap_code(KC_LEFT);
50 if (!(mods & MOD_MASK_SHIFT)) {
51 tap_code(KC_ENT);
52 }
53 }
54
55 set_mods(mods);
56 #ifndef NO_SECRETS
57 leader_scan_secrets();
58 #endif // !NO_SECRETS
59 } 48 }
60 } 49 }
50
51 set_mods(mods);
52 #ifndef NO_SECRETS
53 leader_scan_secrets();
54 #endif // !NO_SECRETS
55}
61#endif 56#endif
62 57
63static bool is_first_run = true; 58static bool is_first_run = true;
@@ -66,9 +61,7 @@ void matrix_scan_user(void) {
66 is_first_run = false; 61 is_first_run = false;
67 startup_user(); 62 startup_user();
68 } 63 }
69 #ifdef LEADER_ENABLE 64
70 matrix_scan_leader();
71 #endif
72 matrix_scan_keymap(); 65 matrix_scan_keymap();
73} 66}
74 67
diff --git a/users/kuatsure/kuatsure.c b/users/kuatsure/kuatsure.c
index bfdbdd4035..37adc337c1 100644
--- a/users/kuatsure/kuatsure.c
+++ b/users/kuatsure/kuatsure.c
@@ -53,81 +53,70 @@ void tmux_pane_zoom(void) {
53 SEND_STRING("z"); 53 SEND_STRING("z");
54} 54}
55 55
56LEADER_EXTERNS(); 56void leader_end_user(void) {
57void matrix_scan_user(void) { 57 // Stop music and lock computer via alfred
58 LEADER_DICTIONARY() { 58 if (leader_sequence_one_key(KC_H)) {
59 leading = false; 59 SEND_STRING(SS_LGUI(" ") SS_TAP(X_LGUI) "afk" SS_TAP(X_ENTER));
60 leader_end(); 60 }
61 61
62 // Available seqs 62 // Stop music and lock computer via alfred
63 // SEQ_ONE_KEY, SEQ_TWO_KEYS, SEQ_THREE_KEYS 63 if (leader_sequence_two_keys(KC_H, KC_H)) {
64 // anything you can do in a macro https://docs.qmk.fm/macros.html 64 SEND_STRING(SS_LGUI(" ") SS_TAP(X_LGUI) "afk" SS_TAP(X_ENTER) SS_TAP(X_MEDIA_PLAY_PAUSE));
65 // https://docs.qmk.fm/feature_leader_key.html 65 }
66 66
67 // Stop music and lock computer via alfred 67 // Whole Screen Shot
68 SEQ_ONE_KEY(KC_H) { 68 if (leader_sequence_one_key(KC_A)) {
69 SEND_STRING(SS_LGUI(" ") SS_TAP(X_LGUI) "afk" SS_TAP(X_ENTER)); 69 SEND_STRING(SS_LGUI(SS_LSFT("3")));
70 } 70 }
71 71
72 // Stop music and lock computer via alfred 72 // Selective Screen Shot
73 SEQ_TWO_KEYS(KC_H, KC_H) { 73 if (leader_sequence_one_key(KC_S)) {
74 SEND_STRING(SS_LGUI(" ") SS_TAP(X_LGUI) "afk" SS_TAP(X_ENTER) SS_TAP(X_MEDIA_PLAY_PAUSE)); 74 SEND_STRING(SS_LGUI(SS_LSFT("4")));
75 } 75 }
76 76
77 // Whole Screen Shot 77 // TMUX - shift to pane 1 and zoom
78 SEQ_ONE_KEY(KC_A) { 78 if (leader_sequence_one_key(KC_J)) {
79 SEND_STRING(SS_LGUI(SS_LSFT("3"))); 79 tmux_prefix();
80 } 80 SEND_STRING("q1");
81 81 tmux_pane_zoom();
82 // Selective Screen Shot 82 }
83 SEQ_ONE_KEY(KC_S) { 83
84 SEND_STRING(SS_LGUI(SS_LSFT("4"))); 84 // TMUX - shift to first window
85 } 85 if (leader_sequence_two_keys(KC_J, KC_J)) {
86 86 tmux_prefix();
87 // TMUX - shift to pane 1 and zoom 87 SEND_STRING("1");
88 SEQ_ONE_KEY(KC_J) { 88 }
89 tmux_prefix(); 89
90 SEND_STRING("q1"); 90 // TMUX - shift to pane 2 and zoom
91 tmux_pane_zoom(); 91 if (leader_sequence_one_key(KC_K)) {
92 } 92 tmux_prefix();
93 93 SEND_STRING("q2");
94 // TMUX - shift to first window 94 tmux_pane_zoom();
95 SEQ_TWO_KEYS(KC_J, KC_J) { 95 }
96 tmux_prefix(); 96
97 SEND_STRING("1"); 97 // TMUX - shift to second window
98 } 98 if (leader_sequence_two_keys(KC_K, KC_K)) {
99 99 tmux_prefix();
100 // TMUX - shift to pane 2 and zoom 100 SEND_STRING("2");
101 SEQ_ONE_KEY(KC_K) { 101 }
102 tmux_prefix(); 102
103 SEND_STRING("q2"); 103 // TMUX - shift to pane 3 and zoom
104 tmux_pane_zoom(); 104 if (leader_sequence_one_key(KC_L)) {
105 } 105 tmux_prefix();
106 106 SEND_STRING("q3");
107 // TMUX - shift to second window 107 tmux_pane_zoom();
108 SEQ_TWO_KEYS(KC_K, KC_K) { 108 }
109 tmux_prefix(); 109
110 SEND_STRING("2"); 110 // TMUX - shift to third window
111 } 111 if (leader_sequence_two_keys(KC_L, KC_L)) {
112 112 tmux_prefix();
113 // TMUX - shift to pane 3 and zoom 113 SEND_STRING("3");
114 SEQ_ONE_KEY(KC_L) { 114 }
115 tmux_prefix(); 115
116 SEND_STRING("q3"); 116 // TMUX - shift to last pane and zoom
117 tmux_pane_zoom(); 117 if (leader_sequence_one_key(KC_SEMICOLON)) {
118 } 118 tmux_prefix();
119 119 SEND_STRING(";");
120 // TMUX - shift to third window 120 tmux_pane_zoom();
121 SEQ_TWO_KEYS(KC_L, KC_L) {
122 tmux_prefix();
123 SEND_STRING("3");
124 }
125
126 // TMUX - shift to last pane and zoom
127 SEQ_ONE_KEY(KC_SEMICOLON) {
128 tmux_prefix();
129 SEND_STRING(";");
130 tmux_pane_zoom();
131 }
132 } 121 }
133} 122}
diff --git a/users/kuchosauronad0/leader.c b/users/kuchosauronad0/leader.c
deleted file mode 100644
index e8935ec401..0000000000
--- a/users/kuchosauronad0/leader.c
+++ /dev/null
@@ -1,116 +0,0 @@
1#include "leader.h"
2#ifdef RGBLIGHT_ENABLE
3extern rgblight_config_t rgblight_config;
4#endif
5bool leader_succeed;
6
7LEADER_EXTERNS();
8
9void matrix_scan_user(void) {
10 static bool has_ran_yet;
11 if (!has_ran_yet) {
12 has_ran_yet = true;
13 startup_user();
14 }
15#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
16// run_diablo_macro_check();
17#endif
18#ifdef RGBLIGHT_ENABLE
19 matrix_scan_rgb();
20#endif
21 LEADER_DICTIONARY() {
22 leader_succeed = leading = false;
23
24 SEQ_ONE_KEY(KC_W) {
25 // vim/tmux: Use in command mode in vim: write to file, switch tmux pane in the current session window and repeat the last command
26 SEND_STRING(":w" SS_TAP(X_ENTER));
27 tmux_pane_switch_repeat();
28 leader_succeed = true;
29 } else
30 SEQ_ONE_KEY(KC_T) {
31 // Send the Tmux Prefix
32 tmux_prefix();
33 leader_succeed = true;
34 } else
35 SEQ_ONE_KEY(KC_A) {
36 // tmux: Send the prefix and press 'right' arrow
37 tmux_prefix();
38 tap_code(KC_RIGHT);
39 leader_succeed = true;
40 } else
41 SEQ_TWO_KEYS(KC_T, KC_T) {
42 // tmux: Send the prefix to a nested session
43 tmux_prefix();
44 tmux_prefix();
45 leader_succeed = true;
46 } else
47 SEQ_TWO_KEYS(KC_T, KC_R) {
48 // tmux: Switch pane and repeat last action
49 tmux_pane_switch_repeat();
50 leader_succeed = true;
51 } else
52 SEQ_TWO_KEYS(KC_V, KC_Z){
53 // vim: Zoom pane
54 tap_code16(LCTL(KC_W));
55 tap_code16(LSFT(KC_BSLS));
56 leader_succeed = true;
57 } else
58 SEQ_TWO_KEYS(KC_V, KC_R) {
59 // vim: Substitute and place cursor
60 SEND_STRING(":%s///g" SS_TAP(X_LEFT));
61 tap_code(KC_LEFT);
62 tap_code(KC_LEFT);
63 leader_succeed = true;
64 } else
65 SEQ_TWO_KEYS(KC_V, KC_T) {
66 // vim: move current pane to new tab
67 tap_code16(LCTL(KC_W));
68 tap_code16(LSFT(KC_T));
69 leader_succeed = true;
70 } else
71 SEQ_ONE_KEY(KC_R){
72 // Toggle RGB Layer indicator
73 tap_code16(KC_RGB_T);
74 leader_succeed = true;
75 } else
76 SEQ_ONE_KEY(KC_SPC){
77 // One Shot Unicode layer
78//TODO tap_code16(OS_UNI);
79 leader_succeed = true;
80 } else
81 SEQ_TWO_KEYS(KC_SPC, KC_SPC){
82 // Toggle _MODS
83 tap_code16(TG_MODS);
84 leader_succeed = true;
85 } else
86 SEQ_THREE_KEYS(KC_BSPC, KC_BSPC, KC_BSPC){
87 // Reset the keyboard
88 reset_keyboard();
89 leader_succeed = true;
90 }
91 leader_end();
92 }
93// matrix_scan_keymap();
94}
95
96void leader_start_user(void) {
97#ifdef RGBLIGHT_ENABLE
98 rgblight_savebase();
99 rgblight_mode_noeeprom(1);
100 rgblight_sethsv_noeeprom(HSV_GOLDENROD);
101#endif
102}
103
104void leader_end_user(void) {
105// pick color depending of success /fail
106// fade leader_start from 100 to 0
107// fade new color from 0 to 100 to 0
108// fade old color from 0 to 100
109#ifdef RGBLIGHT_ENABLE
110 if (leader_succeed) {
111 fadeflash_leds(HSV_GREEN);
112 } else {
113 fadeflash_leds(HSV_RED);
114 }
115#endif
116}
diff --git a/users/kuchosauronad0/leader_user.c b/users/kuchosauronad0/leader_user.c
new file mode 100644
index 0000000000..fd356021a6
--- /dev/null
+++ b/users/kuchosauronad0/leader_user.c
@@ -0,0 +1,113 @@
1#include "leader_user.h"
2#ifdef RGBLIGHT_ENABLE
3extern rgblight_config_t rgblight_config;
4#endif
5bool leader_succeed;
6
7void matrix_scan_user(void) {
8 static bool has_ran_yet;
9 if (!has_ran_yet) {
10 has_ran_yet = true;
11 startup_user();
12 }
13#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
14// run_diablo_macro_check();
15#endif
16#ifdef RGBLIGHT_ENABLE
17 matrix_scan_rgb();
18#endif
19
20// matrix_scan_keymap();
21}
22
23void leader_start_user(void) {
24#ifdef RGBLIGHT_ENABLE
25 rgblight_savebase();
26 rgblight_mode_noeeprom(1);
27 rgblight_sethsv_noeeprom(HSV_GOLDENROD);
28#endif
29}
30
31void leader_end_user(void) {
32 leader_succeed = false;
33
34 if (leader_sequence_one_key(KC_W)) {
35 // vim/tmux: Use in command mode in vim: write to file, switch tmux pane in the current session window and repeat the last command
36 SEND_STRING(":w" SS_TAP(X_ENTER));
37 tmux_pane_switch_repeat();
38 leader_succeed = true;
39 } else
40 if (leader_sequence_one_key(KC_T)) {
41 // Send the Tmux Prefix
42 tmux_prefix();
43 leader_succeed = true;
44 } else
45 if (leader_sequence_one_key(KC_A)) {
46 // tmux: Send the prefix and press 'right' arrow
47 tmux_prefix();
48 tap_code(KC_RIGHT);
49 leader_succeed = true;
50 } else
51 if (leader_sequence_two_keys(KC_T, KC_T)) {
52 // tmux: Send the prefix to a nested session
53 tmux_prefix();
54 tmux_prefix();
55 leader_succeed = true;
56 } else
57 if (leader_sequence_two_keys(KC_T, KC_R)) {
58 // tmux: Switch pane and repeat last action
59 tmux_pane_switch_repeat();
60 leader_succeed = true;
61 } else
62 if (leader_sequence_two_keys(KC_V, KC_Z)){
63 // vim: Zoom pane
64 tap_code16(LCTL(KC_W));
65 tap_code16(LSFT(KC_BSLS));
66 leader_succeed = true;
67 } else
68 if (leader_sequence_two_keys(KC_V, KC_R)) {
69 // vim: Substitute and place cursor
70 SEND_STRING(":%s///g" SS_TAP(X_LEFT));
71 tap_code(KC_LEFT);
72 tap_code(KC_LEFT);
73 leader_succeed = true;
74 } else
75 if (leader_sequence_two_keys(KC_V, KC_T)) {
76 // vim: move current pane to new tab
77 tap_code16(LCTL(KC_W));
78 tap_code16(LSFT(KC_T));
79 leader_succeed = true;
80 } else
81 if (leader_sequence_one_key(KC_R)){
82 // Toggle RGB Layer indicator
83 tap_code16(KC_RGB_T);
84 leader_succeed = true;
85 } else
86 if (leader_sequence_one_key(KC_SPC)){
87 // One Shot Unicode layer
88//TODO tap_code16(OS_UNI);
89 leader_succeed = true;
90 } else
91 if (leader_sequence_two_keys(KC_SPC, KC_SPC)){
92 // Toggle _MODS
93 tap_code16(TG_MODS);
94 leader_succeed = true;
95 } else
96 if (leader_sequence_three_keys(KC_BSPC, KC_BSPC, KC_BSPC)){
97 // Reset the keyboard
98 reset_keyboard();
99 leader_succeed = true;
100 }
101
102// pick color depending of success /fail
103// fade leader_start from 100 to 0
104// fade new color from 0 to 100 to 0
105// fade old color from 0 to 100
106#ifdef RGBLIGHT_ENABLE
107 if (leader_succeed) {
108 fadeflash_leds(HSV_GREEN);
109 } else {
110 fadeflash_leds(HSV_RED);
111 }
112#endif
113}
diff --git a/users/kuchosauronad0/leader.h b/users/kuchosauronad0/leader_user.h
index ed904f3063..d68dc80c13 100644
--- a/users/kuchosauronad0/leader.h
+++ b/users/kuchosauronad0/leader_user.h
@@ -1,6 +1,6 @@
1#pragma once 1#pragma once
2#include "kuchosauronad0.h" 2#include "kuchosauronad0.h"
3 3
4#include "leader.h" 4#include "leader_user.h"
5 5
6void matrix_scan_user(void); 6void matrix_scan_user(void);
diff --git a/users/kuchosauronad0/readme.md b/users/kuchosauronad0/readme.md
index b577eedb70..88cc4cd374 100644
--- a/users/kuchosauronad0/readme.md
+++ b/users/kuchosauronad0/readme.md
@@ -38,7 +38,7 @@ TODO: Make use of `TD_SPC` and `TD_QT{1..3}`
38## [Leader Key](#leader-key) 38## [Leader Key](#leader-key)
39To enable set `LEADER_ENABLE = yes` in file *rules.mk* 39To enable set `LEADER_ENABLE = yes` in file *rules.mk*
40 40
41|LEADER_DICTIONARY()|program| description | 41|Leader sequence|program| description |
42|---|---|---| 42|---|---|---|
43| W |vim/tmux| save file, switch pane and repeat last command | 43| W |vim/tmux| save file, switch pane and repeat last command |
44| T |tmux| send default prefix | 44| T |tmux| send default prefix |
@@ -50,7 +50,7 @@ To enable set `LEADER_ENABLE = yes` in file *rules.mk*
50|V + T|vim | move current split to its own tab| 50|V + T|vim | move current split to its own tab|
51|3x Backspace|keyboard| Reset Keyboard | 51|3x Backspace|keyboard| Reset Keyboard |
52 52
53`LEADER_DICTIONARY()` is defined in *leader.c* 53Leader sequences are defined in *leader_user.c*
54 54
55## [Combo Keys](#combo-keys) 55## [Combo Keys](#combo-keys)
56To enable set `COMBO_ENABLE = yes` in file *rules.mk*. 56To enable set `COMBO_ENABLE = yes` in file *rules.mk*.
diff --git a/users/kuchosauronad0/rgblight_user.c b/users/kuchosauronad0/rgblight_user.c
index 77a8ac6df8..1b5c29cfb0 100644
--- a/users/kuchosauronad0/rgblight_user.c
+++ b/users/kuchosauronad0/rgblight_user.c
@@ -145,7 +145,7 @@ void rgblight_fade_helper(bool direction){
145void fadeflash_leds(uint8_t hue, uint8_t sat, uint8_t val){ 145void fadeflash_leds(uint8_t hue, uint8_t sat, uint8_t val){
146 // indicate success / fail of a leader sequence 146 // indicate success / fail of a leader sequence
147 // fade out, set new hue and saturation, fade in, fade out, set old color, fade in 147 // fade out, set new hue and saturation, fade in, fade out, set old color, fade in
148 // this is used in leader.c 148 // this is used in leader_user.c
149 // TODO: come up with a better name maybe 149 // TODO: come up with a better name maybe
150 rgblight_fade_helper(false); 150 rgblight_fade_helper(false);
151 rgblight_sethsv_noeeprom(hue, sat, 0); 151 rgblight_sethsv_noeeprom(hue, sat, 0);
diff --git a/users/kuchosauronad0/rules.mk b/users/kuchosauronad0/rules.mk
index dfab85703c..a65fe9d258 100644
--- a/users/kuchosauronad0/rules.mk
+++ b/users/kuchosauronad0/rules.mk
@@ -21,7 +21,7 @@ ifeq ($(strip $(COMBO_ENABLE)), yes)
21endif 21endif
22 22
23ifeq ($(strip $(LEADER_ENABLE)), yes) 23ifeq ($(strip $(LEADER_ENABLE)), yes)
24 SRC += leader.c 24 SRC += leader_user.c
25endif 25endif
26 26
27ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") 27ifneq ("$(wildcard $(USER_PATH)/secrets.c)","")
diff --git a/users/sigma/sigma.c b/users/sigma/sigma.c
index 9a0786233b..bd66729bdc 100644
--- a/users/sigma/sigma.c
+++ b/users/sigma/sigma.c
@@ -90,26 +90,19 @@ void store_userspace_config(void) {
90 eeconfig_update_user(stored_userspace_config.raw); 90 eeconfig_update_user(stored_userspace_config.raw);
91} 91}
92 92
93LEADER_EXTERNS(); 93void leader_end_user(void) {
94 94 if (leader_sequence_two_keys(KC_F1, KC_L)) {
95void matrix_scan_user(void) { 95 set_os(_OS_LINUX);
96 LEADER_DICTIONARY() { 96 }
97 leading = false; 97 if (leader_sequence_two_keys(KC_F1, KC_M)) {
98 leader_end(); 98 set_os(_OS_MACOS);
99 99 }
100 SEQ_TWO_KEYS(KC_F1, KC_L) { 100 if (leader_sequence_two_keys(KC_F1, KC_W)) {
101 set_os(_OS_LINUX); 101 set_os(_OS_WINDOWS);
102 } 102 }
103 SEQ_TWO_KEYS(KC_F1, KC_M) { 103 if (leader_sequence_two_keys(KC_F1, KC_S)) {
104 set_os(_OS_MACOS); 104 stored_userspace_config.raw = runtime_userspace_config.raw;
105 } 105 store_userspace_config();
106 SEQ_TWO_KEYS(KC_F1, KC_W) {
107 set_os(_OS_WINDOWS);
108 }
109 SEQ_TWO_KEYS(KC_F1, KC_S) {
110 stored_userspace_config.raw = runtime_userspace_config.raw;
111 store_userspace_config();
112 }
113 } 106 }
114} 107}
115 108
diff --git a/users/uqs/uqs.c b/users/uqs/uqs.c
index bccab617ac..83733bbe2a 100644
--- a/users/uqs/uqs.c
+++ b/users/uqs/uqs.c
@@ -534,43 +534,36 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
534} 534}
535 535
536#ifdef LEADER_ENABLE 536#ifdef LEADER_ENABLE
537LEADER_EXTERNS(); 537void leader_end_user(void) {
538
539void matrix_scan_user(void) {
540 LEADER_DICTIONARY() {
541 leading = false;
542 leader_end();
543
544#ifdef UCIS_ENABLE 538#ifdef UCIS_ENABLE
545 SEQ_ONE_KEY(KC_U) { 539 if (leader_sequence_one_key(KC_U)) {
546 ucis_start(); 540 ucis_start();
547 } 541 }
548#endif 542#endif
549 SEQ_ONE_KEY(KC_H) { 543 if (leader_sequence_one_key(KC_H)) {
550 send_unicode_string("ᕕ( ᐛ )ᕗ"); // happy 544 send_unicode_string("ᕕ( ᐛ )ᕗ"); // happy
551 } 545 }
552 SEQ_ONE_KEY(KC_D) { 546 if (leader_sequence_one_key(KC_D)) {
553 send_unicode_string("ಠ_ಠ"); // disapproval 547 send_unicode_string("ಠ_ಠ"); // disapproval
554 } 548 }
555 SEQ_ONE_KEY(KC_L) { 549 if (leader_sequence_one_key(KC_L)) {
556 send_unicode_string("( ͡° ͜ʖ ͡°)"); // lenny 550 send_unicode_string("( ͡° ͜ʖ ͡°)"); // lenny
557 } 551 }
558 SEQ_ONE_KEY(KC_S) { 552 if (leader_sequence_one_key(KC_S)) {
559 send_unicode_string("¯\\_(ツ)_/¯"); // shrug 553 send_unicode_string("¯\\_(ツ)_/¯"); // shrug
560 } 554 }
561 // tableflip (LEADER - TF) 555 // tableflip (LEADER - TF)
562 SEQ_TWO_KEYS(KC_T, KC_F) { 556 if (leader_sequence_two_keys(KC_T, KC_F)) {
563 //set_unicode_input_mode(UNICODE_MODE_LINUX); 557 //set_unicode_input_mode(UNICODE_MODE_LINUX);
564 //send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B"); 558 //send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
565 send_unicode_string("(╯°□°)╯︵ ┻━┻"); 559 send_unicode_string("(╯°□°)╯︵ ┻━┻");
566 } 560 }
567 // untableflip 561 // untableflip
568 SEQ_THREE_KEYS(KC_U, KC_T, KC_F) { 562 if (leader_sequence_three_keys(KC_U, KC_T, KC_F)) {
569 //set_unicode_input_mode(UNICODE_MODE_LINUX); 563 //set_unicode_input_mode(UNICODE_MODE_LINUX);
570 //send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B"); 564 //send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
571 send_unicode_string("┬─┬ノ( º _ ºノ)"); 565 send_unicode_string("┬─┬ノ( º _ ºノ)");
572 } 566 }
573 }
574} 567}
575#endif 568#endif
576 569
diff --git a/users/yet-another-developer/leader.c b/users/yet-another-developer/leader.c
deleted file mode 100644
index 3cbbf8d70e..0000000000
--- a/users/yet-another-developer/leader.c
+++ /dev/null
@@ -1,46 +0,0 @@
1#include "leader.h"
2
3LEADER_EXTERNS();
4
5// Runs constantly in the background, in a loop.
6void matrix_scan_user(void){
7
8#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
9// run_diablo_macro_check();
10#endif // TAP_DANCE_ENABLE
11
12#ifdef RGBLIGHT_ENABLE
13 matrix_scan_rgb();
14#endif // RGBLIGHT_ENABLE
15
16 LEADER_DICTIONARY() {
17 leading = false;
18 leader_end();
19
20 SEQ_TWO_KEYS(KC_V, KC_Z){
21 // vim: Zoom pane
22 tap_code16(LCTL(KC_W));
23 tap_code16(LSFT(KC_BSLS));
24 }
25
26 SEQ_TWO_KEYS(KC_V, KC_R) {
27 // vim: Substitute and place cursor
28 SEND_STRING(":%s///g" SS_TAP(X_LEFT));
29 tap_code(KC_LEFT);
30 tap_code(KC_LEFT);
31 }
32
33 SEQ_TWO_KEYS(KC_V, KC_T) {
34 // vim: move current pane to new tab
35 tap_code16(LCTL(KC_W));
36 tap_code16(LSFT(KC_T));
37 }
38
39 SEQ_THREE_KEYS(KC_BSPC, KC_BSPC, KC_BSPC){
40 // Reset the keyboard
41 reset_keyboard();
42 }
43 }
44
45 matrix_scan_keymap();
46}
diff --git a/users/yet-another-developer/leader_user.c b/users/yet-another-developer/leader_user.c
new file mode 100644
index 0000000000..53a7e2d7e5
--- /dev/null
+++ b/users/yet-another-developer/leader_user.c
@@ -0,0 +1,41 @@
1#include "leader_user.h"
2
3void leader_end_user(void) {
4 if (leader_sequence_two_keys(KC_V, KC_Z)){
5 // vim: Zoom pane
6 tap_code16(LCTL(KC_W));
7 tap_code16(LSFT(KC_BSLS));
8 }
9
10 if (leader_sequence_two_keys(KC_V, KC_R)) {
11 // vim: Substitute and place cursor
12 SEND_STRING(":%s///g" SS_TAP(X_LEFT));
13 tap_code(KC_LEFT);
14 tap_code(KC_LEFT);
15 }
16
17 if (leader_sequence_two_keys(KC_V, KC_T)) {
18 // vim: move current pane to new tab
19 tap_code16(LCTL(KC_W));
20 tap_code16(LSFT(KC_T));
21 }
22
23 if (leader_sequence_three_keys(KC_BSPC, KC_BSPC, KC_BSPC)){
24 // Reset the keyboard
25 reset_keyboard();
26 }
27}
28
29// Runs constantly in the background, in a loop.
30void matrix_scan_user(void){
31
32#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
33// run_diablo_macro_check();
34#endif // TAP_DANCE_ENABLE
35
36#ifdef RGBLIGHT_ENABLE
37 matrix_scan_rgb();
38#endif // RGBLIGHT_ENABLE
39
40 matrix_scan_keymap();
41}
diff --git a/users/yet-another-developer/leader.h b/users/yet-another-developer/leader_user.h
index 7ed6c8a82c..84cc6f65fa 100644
--- a/users/yet-another-developer/leader.h
+++ b/users/yet-another-developer/leader_user.h
@@ -1,6 +1,6 @@
1#pragma once 1#pragma once
2#include "yet-another-developer.h" 2#include "yet-another-developer.h"
3 3
4#include "leader.h" 4#include "leader_user.h"
5 5
6void matrix_scan_user(void); 6void matrix_scan_user(void);
diff --git a/users/yet-another-developer/rules.mk b/users/yet-another-developer/rules.mk
index 64cf1f2fce..9afa78e3f7 100644
--- a/users/yet-another-developer/rules.mk
+++ b/users/yet-another-developer/rules.mk
@@ -14,7 +14,7 @@ endif
14 14
15 15
16ifeq ($(strip $(LEADER_ENABLE)), yes) 16ifeq ($(strip $(LEADER_ENABLE)), yes)
17 SRC += leader.c 17 SRC += leader_user.c
18endif 18endif
19 19
20 20