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 @@
-# The Leader Key: A New Kind of Modifier
+# The Leader Key: A New Kind of Modifier :id=the-leader-key
-If 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.
+If 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.
-That's what `QK_LEAD` does. Here's an example:
+## Usage :id=usage
-1. 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.
-2. 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.
- * 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`.
-3. Within your `matrix_scan_user` function, add something like this:
+Add the following to your `rules.mk`:
-```c
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY(KC_F) {
- // Anything you can do in a macro.
- SEND_STRING("QMK is awesome.");
- }
- SEQ_TWO_KEYS(KC_D, KC_D) {
- SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
- }
- SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
- SEND_STRING("https://start.duckduckgo.com\n");
- }
- SEQ_TWO_KEYS(KC_A, KC_S) {
- register_code(KC_LGUI);
- register_code(KC_S);
- unregister_code(KC_S);
- unregister_code(KC_LGUI);
- }
- }
-}
+```make
+LEADER_ENABLE = yes
```
-As 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.
+Then add the `QK_LEAD` keycode to your keymap.
-Each of these accepts one or more keycodes as arguments. This is an important point: You can use keycodes from **any layer on your keyboard**. That layer would need to be active for the leader macro to fire, obviously.
+## Callbacks :id=callbacks
-## Adding Leader Key Support
+These 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.
-To enable Leader Key, add the following line to your keymap's `rules.mk`:
+```c
+void leader_start_user(void) {
+ // Do something when the leader key is pressed
+}
-```make
-LEADER_ENABLE = yes
+void leader_end_user(void) {
+ if (leader_sequence_one_key(KC_F)) {
+ // Leader, f => Types the below string
+ SEND_STRING("QMK is awesome.");
+ } else if (leader_sequence_two_keys(KC_D, KC_D)) {
+ // Leader, d, d => Ctrl+A, Ctrl+C
+ SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
+ } else if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
+ // Leader, d, d, s => Types the below string
+ SEND_STRING("https://start.duckduckgo.com\n");
+ } else if (leader_sequence_two_keys(KC_A, KC_S)) {
+ // Leader, a, s => GUI+S
+ tap_code16(LGUI(KC_S));
+ }
+}
```
-Place 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:
+## Basic Configuration :id=basic-configuration
+
+### Timeout :id=timeout
+
+This 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`:
```c
-LEADER_EXTERNS();
+#define LEADER_TIMEOUT 350
```
-## Per Key Timing on Leader keys
+### Per-Key Timeout :id=per-key-timeout
-Rather 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).
+Rather 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).
+
+To enable this, add the following to your `config.h`:
-In order to enable this, place this in your `config.h`:
```c
#define LEADER_PER_KEY_TIMING
```
-After this, it's recommended that you lower your `LEADER_TIMEOUT` to something less that 300ms.
+After this, it's recommended that you lower your timeout below 300 ms:
```c
#define LEADER_TIMEOUT 250
```
-Now, something like this won't seem impossible to do without a 1000MS leader key timeout:
+Now, something like this won't seem impossible to do without a 1000 millisecond timeout:
```c
-SEQ_THREE_KEYS(KC_C, KC_C, KC_C) {
- SEND_STRING("Per key timing is great!!!");
+if (leader_sequence_three_keys(KC_C, KC_C, KC_C)) {
+ SEND_STRING("Per key timing is great!!!");
}
```
-## Infinite Leader key timeout
+### Disabling Initial Timeout :id=disabling-initial-timeout
+
+Sometimes 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.
-Sometimes 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.
-This 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.
-To 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.
-This 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.
-This way you can configure a very short `LEADER_TIMEOUT` but still have plenty of time to position your hands.
+To 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`:
-In order to enable this, place this in your `config.h`:
```c
#define LEADER_NO_TIMEOUT
```
-## Strict Key Processing
-
-By 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.
+Now, 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.
-While, 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.
+### Strict Key Processing :id=strict-key-processing
-## Customization
+By 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.
-The 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()`.
+This gives a more expected behaviour for most users, however you may want to change this.
-The `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.
-
-You can add these functions to your code (`keymap.c` usually) to add feedback to the Leader sequences (such as beeping or playing music).
+To enable this, add the following to your `config.h`:
```c
-void leader_start_user(void) {
- // sequence started
-}
-
-void leader_end_user(void) {
- // sequence ended (no success/failure detection)
-}
+#define LEADER_KEY_STRICT_KEY_PROCESSING
```
-### Example
+## Example :id=example
-This 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.
+This 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).
```c
-bool did_leader_succeed;
#ifdef AUDIO_ENABLE
-float leader_start[][2] = SONG(ONE_UP_SOUND );
-float leader_succeed[][2] = SONG(ALL_STAR);
-float leader_fail[][2] = SONG(RICK_ROLL);
+float leader_start_song[][2] = SONG(ONE_UP_SOUND);
+float leader_succeed_song[][2] = SONG(ALL_STAR);
+float leader_fail_song[][2] = SONG(RICK_ROLL);
#endif
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- did_leader_succeed = leading = false;
-
- SEQ_ONE_KEY(KC_E) {
- // Anything you can do in a macro.
- SEND_STRING(SS_LCTL(SS_LSFT("t")));
- did_leader_succeed = true;
- } else
- SEQ_TWO_KEYS(KC_E, KC_D) {
- SEND_STRING(SS_LGUI("r") "cmd\n" SS_LCTL("c"));
- did_leader_succeed = true;
- }
- leader_end();
- }
-}
void leader_start_user(void) {
#ifdef AUDIO_ENABLE
- PLAY_SONG(leader_start);
+ PLAY_SONG(leader_start_song);
#endif
}
void leader_end_user(void) {
- if (did_leader_succeed) {
-#ifdef AUDIO_ENABLE
- PLAY_SONG(leader_succeed);
-#endif
- } else {
+ bool did_leader_succeed = false;
+
+ if (leader_sequence_one_key(KC_E)) {
+ SEND_STRING(SS_LCTL(SS_LSFT("t")));
+ did_leader_succeed = true;
+ } else if (leader_sequence_two_keys(KC_E, KC_D)) {
+ SEND_STRING(SS_LGUI("r") "cmd\n" SS_LCTL("c"));
+ did_leader_succeed = true;
+ }
+
#ifdef AUDIO_ENABLE
- PLAY_SONG(leader_fail);
+ if (did_leader_succeed) {
+ PLAY_SONG(leader_succeed_song);
+ } else {
+ PLAY_SONG(leader_fail_song);
+ }
#endif
- }
}
```
+
+## Keycodes :id=keycodes
+
+|Key |Aliases |Description |
+|-----------------------|---------|-------------------------|
+|`QK_LEADER` |`QK_LEAD`|Begin the leader sequence|
+
+## API :id=api
+
+### `void leader_start_user(void)` :id=api-leader-start-user
+
+User callback, invoked when the leader sequence begins.
+
+---
+
+### `void leader_end_user(void)` :id=api-leader-end-user
+
+User callback, invoked when the leader sequence ends.
+
+---
+
+### `void leader_start(void)` :id=api-leader-start
+
+Begin the leader sequence, resetting the buffer and timer.
+
+---
+
+### `void leader_end(void)` :id=api-leader-end
+
+End the leader sequence.
+
+---
+
+### `bool leader_sequence_active(void)` :id=api-leader-sequence-active
+
+Whether the leader sequence is active.
+
+---
+
+### `bool leader_sequence_add(uint16_t keycode)` :id=api-leader-sequence-add
+
+Add the given keycode to the sequence buffer.
+
+If `LEADER_NO_TIMEOUT` is defined, the timer is reset if the buffer is empty.
+
+#### Arguments :id=api-leader-sequence-add-arguments
+
+ - `uint16_t keycode`
+ The keycode to add.
+
+#### Return Value :id=api-leader-sequence-add-return
+
+`true` if the keycode was added, `false` if the buffer is full.
+
+---
+
+### `bool leader_sequence_timed_out(void)` :id=api-leader-sequence-timed-out
+
+Whether the leader sequence has reached the timeout.
+
+If `LEADER_NO_TIMEOUT` is defined, the buffer must also contain at least one key.
+
+---
+
+### `bool leader_reset_timer(void)` :id=api-leader-reset-timer
+
+Reset the leader sequence timer.
+
+---
+
+### `bool leader_sequence_one_key(uint16_t kc)` :id=api-leader-sequence-one-key
+
+Check the sequence buffer for the given keycode.
+
+#### Arguments :id=api-leader-sequence-one-key-arguments
+
+ - `uint16_t kc`
+ The keycode to check.
+
+#### Return Value :id=api-leader-sequence-one-key-return
+
+`true` if the sequence buffer matches.
+
+---
+
+### `bool leader_sequence_two_keys(uint16_t kc1, uint16_t kc2)` :id=api-leader-sequence-two-keys
+
+Check the sequence buffer for the given keycodes.
+
+#### Arguments :id=api-leader-sequence-two-keys-arguments
+
+ - `uint16_t kc1`
+ The first keycode to check.
+ - `uint16_t kc2`
+ The second keycode to check.
+
+#### Return Value :id=api-leader-sequence-two-keys-return
+
+`true` if the sequence buffer matches.
+
+---
+
+### `bool leader_sequence_three_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3)` :id=api-leader-sequence-three-keys
+
+Check the sequence buffer for the given keycodes.
+
+#### Arguments :id=api-leader-sequence-three-keys-arguments
+
+ - `uint16_t kc1`
+ The first keycode to check.
+ - `uint16_t kc2`
+ The second keycode to check.
+ - `uint16_t kc3`
+ The third keycode to check.
+
+#### Return Value :id=api-leader-sequence-three-keys-return
+
+`true` if the sequence buffer matches.
+
+---
+
+### `bool leader_sequence_four_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3, uint16_t kc4)` :id=api-leader-sequence-four-keys
+
+Check the sequence buffer for the given keycodes.
+
+#### Arguments :id=api-leader-sequence-four-keys-arguments
+
+ - `uint16_t kc1`
+ The first keycode to check.
+ - `uint16_t kc2`
+ The second keycode to check.
+ - `uint16_t kc3`
+ The third keycode to check.
+ - `uint16_t kc4`
+ The fourth keycode to check.
+
+#### Return Value :id=api-leader-sequence-four-keys-return
+
+`true` if the sequence buffer matches.
+
+---
+
+### `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
+
+Check the sequence buffer for the given keycodes.
+
+#### Arguments :id=api-leader-sequence-five-keys-arguments
+
+ - `uint16_t kc1`
+ The first keycode to check.
+ - `uint16_t kc2`
+ The second keycode to check.
+ - `uint16_t kc3`
+ The third keycode to check.
+ - `uint16_t kc4`
+ The fourth keycode to check.
+ - `uint16_t kc5`
+ The fifth keycode to check.
+
+#### Return Value :id=api-leader-sequence-five-keys-return
+
+`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] = {
)
};
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- // qq, alt+f4 close window
- SEQ_TWO_KEYS(KC_Q, KC_Q) {
- tap_code16(A(KC_F4));
- }
+void leader_end_user(void) {
+ // qq, alt+f4 close window
+ if (leader_sequence_two_keys(KC_Q, KC_Q)) {
+ tap_code16(A(KC_F4));
+ }
- // ee, open explorer
- SEQ_TWO_KEYS(KC_E, KC_E) {
- tap_code16(G(KC_E));
- }
+ // ee, open explorer
+ if (leader_sequence_two_keys(KC_E, KC_E)) {
+ tap_code16(G(KC_E));
+ }
- // rr, windows run prompt
- SEQ_TWO_KEYS(KC_R, KC_R) {
- tap_code16(G(KC_R));
- }
+ // rr, windows run prompt
+ if (leader_sequence_two_keys(KC_R, KC_R)) {
+ tap_code16(G(KC_R));
+ }
- // ww, maximize window
- SEQ_TWO_KEYS(KC_W, KC_W) {
- tap_code16(G(KC_UP));
- }
+ // ww, maximize window
+ if (leader_sequence_two_keys(KC_W, KC_W)) {
+ tap_code16(G(KC_UP));
+ }
- // ss, minimize window
- SEQ_TWO_KEYS(KC_S, KC_S) {
- tap_code16(G(KC_DOWN));
- }
+ // ss, minimize window
+ if (leader_sequence_two_keys(KC_S, KC_S)) {
+ tap_code16(G(KC_DOWN));
+ }
- // <space><space>, toggle desktop
- SEQ_TWO_KEYS(KC_SPC, KC_SPC) {
- tap_code16(G(KC_D));
- }
+ // <space><space>, toggle desktop
+ if (leader_sequence_two_keys(KC_SPC, KC_SPC)) {
+ tap_code16(G(KC_D));
}
}
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) {
bspc_timer = 0;
}
-LEADER_EXTERNS();
+void leader_end_user(void) {
+ // layer navigation
+ if (leader_sequence_one_key(KC_R)) { layer_invert(_RPT); }
+ if (leader_sequence_one_key(KC_G)) { layer_invert(_GAME); }
+ if (leader_sequence_one_key(KC_K)) { layer_invert(_KP); }
+ if (leader_sequence_one_key(KC_KP_5)) { layer_invert(_KP); }
+
+ // tmux navigation
+ if (leader_sequence_one_key(KC_L)) { SEND_STRING(SS_LCTL("a") "n"); }
+ if (leader_sequence_one_key(KC_H)) { SEND_STRING(SS_LCTL("a") "p"); }
+ if (leader_sequence_one_key(KC_N)) { SEND_STRING(SS_LCTL("a") "c"); }
+ if (leader_sequence_one_key(KC_W)) { SEND_STRING(SS_LCTL("a") "x"); }
+ if (leader_sequence_one_key(KC_MINS)) { SEND_STRING(SS_LCTL("a") "-"); }
+ if (leader_sequence_one_key(KC_QUOT)) { SEND_STRING(SS_LCTL("a") "\""); }
+ if (leader_sequence_one_key(KC_1)) { SEND_STRING(SS_LCTL("a") "1"); }
+ if (leader_sequence_one_key(KC_2)) { SEND_STRING(SS_LCTL("a") "2"); }
+ if (leader_sequence_one_key(KC_3)) { SEND_STRING(SS_LCTL("a") "3"); }
+ if (leader_sequence_one_key(KC_4)) { SEND_STRING(SS_LCTL("a") "4"); }
+ if (leader_sequence_one_key(KC_5)) { SEND_STRING(SS_LCTL("a") "5"); }
+ if (leader_sequence_one_key(KC_6)) { SEND_STRING(SS_LCTL("a") "6"); }
+ if (leader_sequence_one_key(KC_7)) { SEND_STRING(SS_LCTL("a") "7"); }
+ if (leader_sequence_one_key(KC_8)) { SEND_STRING(SS_LCTL("a") "8"); }
+ if (leader_sequence_one_key(KC_9)) { SEND_STRING(SS_LCTL("a") "9"); }
+
+ // secrets
+ if (leader_sequence_two_keys(KC_SCLN, KC_M)) { send_secret_string(0); }
+ if (leader_sequence_two_keys(KC_SCLN, KC_COMM)) { send_secret_string(1); }
+ if (leader_sequence_two_keys(KC_SCLN, KC_DOT)) { send_secret_string(2); }
+ if (leader_sequence_two_keys(KC_SCLN, KC_J)) { send_secret_string(3); }
+ if (leader_sequence_two_keys(KC_SCLN, KC_K)) { send_secret_string(4); }
+ if (leader_sequence_two_keys(KC_SCLN, KC_L)) { send_secret_string(5); }
+
+ // fast control-C
+ if (leader_sequence_one_key(KC_C)) { tap_code16(C(KC_C)); }
+
+ // neovim: terminal escape
+ if (leader_sequence_one_key(KC_BSLS)) {
+ tap_code16(C(KC_BSLS));
+ tap_code16(C(KC_N));
+ }
+}
void matrix_scan_keymap(void) {
if (rgblight_is_enabled() && timer_elapsed(rgb_timer) > 1000) {
@@ -248,50 +288,6 @@ void matrix_scan_keymap(void) {
bspc_timer = 0;
register_code(KC_BSPC);
}
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- // layer navigation
- SEQ_ONE_KEY(KC_R) { layer_invert(_RPT); }
- SEQ_ONE_KEY(KC_G) { layer_invert(_GAME); }
- SEQ_ONE_KEY(KC_K) { layer_invert(_KP); }
- SEQ_ONE_KEY(KC_KP_5) { layer_invert(_KP); }
-
- // tmux navigation
- SEQ_ONE_KEY(KC_L) { SEND_STRING(SS_LCTL("a") "n"); }
- SEQ_ONE_KEY(KC_H) { SEND_STRING(SS_LCTL("a") "p"); }
- SEQ_ONE_KEY(KC_N) { SEND_STRING(SS_LCTL("a") "c"); }
- SEQ_ONE_KEY(KC_W) { SEND_STRING(SS_LCTL("a") "x"); }
- SEQ_ONE_KEY(KC_MINS) { SEND_STRING(SS_LCTL("a") "-"); }
- SEQ_ONE_KEY(KC_QUOT) { SEND_STRING(SS_LCTL("a") "\""); }
- SEQ_ONE_KEY(KC_1) { SEND_STRING(SS_LCTL("a") "1"); }
- SEQ_ONE_KEY(KC_2) { SEND_STRING(SS_LCTL("a") "2"); }
- SEQ_ONE_KEY(KC_3) { SEND_STRING(SS_LCTL("a") "3"); }
- SEQ_ONE_KEY(KC_4) { SEND_STRING(SS_LCTL("a") "4"); }
- SEQ_ONE_KEY(KC_5) { SEND_STRING(SS_LCTL("a") "5"); }
- SEQ_ONE_KEY(KC_6) { SEND_STRING(SS_LCTL("a") "6"); }
- SEQ_ONE_KEY(KC_7) { SEND_STRING(SS_LCTL("a") "7"); }
- SEQ_ONE_KEY(KC_8) { SEND_STRING(SS_LCTL("a") "8"); }
- SEQ_ONE_KEY(KC_9) { SEND_STRING(SS_LCTL("a") "9"); }
-
- // secrets
- SEQ_TWO_KEYS(KC_SCLN, KC_M) { send_secret_string(0); }
- SEQ_TWO_KEYS(KC_SCLN, KC_COMM) { send_secret_string(1); }
- SEQ_TWO_KEYS(KC_SCLN, KC_DOT) { send_secret_string(2); }
- SEQ_TWO_KEYS(KC_SCLN, KC_J) { send_secret_string(3); }
- SEQ_TWO_KEYS(KC_SCLN, KC_K) { send_secret_string(4); }
- SEQ_TWO_KEYS(KC_SCLN, KC_L) { send_secret_string(5); }
-
- // fast control-C
- SEQ_ONE_KEY(KC_C) { tap_code16(C(KC_C)); }
-
- // neovim: terminal escape
- SEQ_ONE_KEY(KC_BSLS) {
- tap_code16(C(KC_BSLS));
- tap_code16(C(KC_N));
- }
- }
}
bool 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) {
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));
}
-LEADER_EXTERNS();
+void leader_start_user(void) {
+ isLeader = true;
+}
-void matrix_scan_user(void)
-{
- LEADER_DICTIONARY()
- {
- leading = false;
- leader_end();
+void leader_end_user(void) {
+ isLeader = false;
- /* Sequences on layer _MAIN & _MAC */
+ /* Sequences on layer _MAIN & _MAC */
/* éÉ => LdrKey > / */
- SEQ_ONE_KEY(KC_SLSH) {
+ if (leader_sequence_one_key(KC_SLSH)) {
send_french_accent(_E, _ACUTE);
}
/* àÀ => LdrKey > A */
- SEQ_ONE_KEY(KC_A) {
+ if (leader_sequence_one_key(KC_A)) {
send_french_accent(_A, _GRAVE);
}
/* èÈ => LdrKey > E */
- SEQ_ONE_KEY(KC_E) {
+ if (leader_sequence_one_key(KC_E)) {
send_french_accent(_E, _GRAVE);
}
/* ùÙ => LdrKey > U */
- SEQ_ONE_KEY(KC_U) {
+ if (leader_sequence_one_key(KC_U)) {
send_french_accent(_U, _GRAVE);
}
/* â => LdrKey > A > A */
- SEQ_TWO_KEYS(KC_A, KC_A) {
+ if (leader_sequence_two_keys(KC_A, KC_A)) {
send_french_accent(_A, _CIRCUMFLEX);
}
/* êÊ => LdrKey > E > E */
- SEQ_TWO_KEYS(KC_E, KC_E) {
+ if (leader_sequence_two_keys(KC_E, KC_E)) {
send_french_accent(_E, _CIRCUMFLEX);
}
/* îÎ => LdrKey > I > I */
- SEQ_TWO_KEYS(KC_I, KC_I) {
+ if (leader_sequence_two_keys(KC_I, KC_I)) {
send_french_accent(_I, _CIRCUMFLEX);
}
/* ôÔ => LdrKey > O > O */
- SEQ_TWO_KEYS(KC_O, KC_O) {
+ if (leader_sequence_two_keys(KC_O, KC_O)) {
send_french_accent(_O, _CIRCUMFLEX);
}
/* ûÛ => LdrKey > U > U */
- SEQ_TWO_KEYS(KC_U, KC_U) {
+ if (leader_sequence_two_keys(KC_U, KC_U)) {
send_french_accent(_U, _CIRCUMFLEX);
}
/* çÇ => LdrKey > C */
- SEQ_ONE_KEY(KC_C) {
+ if (leader_sequence_one_key(KC_C)) {
if (onMac) {
SEND_STRING(SS_LALT("c"));
} else {
@@ -473,247 +471,238 @@ void matrix_scan_user(void)
}
}
/* CapsLock */
- SEQ_ONE_KEY(QK_LEAD) {
+ if (leader_sequence_one_key(QK_LEAD)) {
tap_code(KC_CAPS);
}
/* ± => LdrKey > = > - */
- SEQ_TWO_KEYS(KC_EQL, KC_MINS) {
+ if (leader_sequence_two_keys(KC_EQL, KC_MINS)) {
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));
}
/* ≤ => LdrKey > - > = */
- SEQ_TWO_KEYS(KC_MINS, KC_EQL) {
+ if (leader_sequence_two_keys(KC_MINS, KC_EQL)) {
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));
}
/* ≥ => LdrKey > = > = */
- SEQ_TWO_KEYS(KC_EQL, KC_EQL) {
+ if (leader_sequence_two_keys(KC_EQL, KC_EQL)) {
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));
}
/* <= => LdrKey > , > , */
- SEQ_TWO_KEYS(KC_COMM, KC_COMM) {
+ if (leader_sequence_two_keys(KC_COMM, KC_COMM)) {
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));
}
/* => => LdrKey > . > . */
- SEQ_TWO_KEYS(KC_DOT, KC_DOT) {
+ if (leader_sequence_two_keys(KC_DOT, KC_DOT)) {
SEND_STRING("=>");
}
/* ", " => LdrKey > " " */
- SEQ_ONE_KEY(KC_SPC) {
+ if (leader_sequence_one_key(KC_SPC)) {
SEND_STRING(", ");
}
/* ". " => LdrKey > " " > " " */
- SEQ_TWO_KEYS(KC_SPC, KC_SPC) {
+ if (leader_sequence_two_keys(KC_SPC, KC_SPC)) {
SEND_STRING(". ");
}
/* Backward delete current word (on cursor) */
- SEQ_TWO_KEYS(KC_BSPC, KC_BSPC) {
+ if (leader_sequence_two_keys(KC_BSPC, KC_BSPC)) {
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));
}
/* Previous word delete */
- SEQ_ONE_KEY(KC_BSPC) {
+ if (leader_sequence_one_key(KC_BSPC)) {
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));
}
/* Forward delete current word (on cursor) */
- SEQ_TWO_KEYS(KC_DEL, KC_DEL) {
+ if (leader_sequence_two_keys(KC_DEL, KC_DEL)) {
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));
}
/* Next word delete */
- SEQ_ONE_KEY(KC_DEL) {
+ if (leader_sequence_one_key(KC_DEL)) {
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));
}
/* ` => LdrKey > Escape */
- SEQ_ONE_KEY(QK_GESC) {
+ if (leader_sequence_one_key(QK_GESC)) {
SEND_STRING("`");
}
/* ``` => LdrKey > Escape > Escape > Escape */
- SEQ_THREE_KEYS(QK_GESC, QK_GESC, QK_GESC) {
+ if (leader_sequence_three_keys(QK_GESC, QK_GESC, QK_GESC)) {
SEND_STRING("```");
}
/* Printscreen => LdrKey > Insert */
- SEQ_ONE_KEY(KC_INS) {
+ if (leader_sequence_one_key(KC_INS)) {
onMac ? SEND_STRING(SS_LGUI(SS_LSFT(SS_TAP(X_4)))) : SEND_STRING(SS_TAP(X_PSCR));
}
/* Home => LdrKey > Page Up */
- SEQ_ONE_KEY(KC_PGUP) {
+ if (leader_sequence_one_key(KC_PGUP)) {
onMac ? SEND_STRING(SS_TAP(X_HOME)) : SEND_STRING(SS_LCTL(SS_TAP(X_HOME)));
}
/* End => LdrKey > Page Down */
- SEQ_ONE_KEY(KC_PGDN) {
+ if (leader_sequence_one_key(KC_PGDN)) {
onMac ? SEND_STRING(SS_TAP(X_END)) : SEND_STRING(SS_LCTL(SS_TAP(X_END)));
}
/* Close Curernt File/Tab => LdrKey > W */
- SEQ_ONE_KEY(KC_W) {
+ if (leader_sequence_one_key(KC_W)) {
onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_W))) : SEND_STRING(SS_LCTL(SS_TAP(X_W)));
}
/* Close Current App => LdrKey > Q */
- SEQ_ONE_KEY(KC_Q) {
+ if (leader_sequence_one_key(KC_Q)) {
onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_Q))) : SEND_STRING(SS_LALT(SS_TAP(X_F4)));
}
/* " => LdrKey > ' */
- SEQ_ONE_KEY(KC_QUOT) {
+ if (leader_sequence_one_key(KC_QUOT)) {
SEND_STRING("\"");
}
/* "|" => LdrKey > ' > ' */
- SEQ_TWO_KEYS(KC_QUOT, KC_QUOT) {
+ if (leader_sequence_two_keys(KC_QUOT, KC_QUOT)) {
SEND_STRING("\"\"" SS_TAP(X_LEFT));
}
/* "X" wrap => LdrKey > ' > ' > ' */
- SEQ_THREE_KEYS(KC_QUOT, KC_QUOT, KC_QUOT) {
+ if (leader_sequence_three_keys(KC_QUOT, KC_QUOT, KC_QUOT)) {
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)) "\"");
}
/* ( => LdrKey > Left Shift */
- SEQ_ONE_KEY(KC_LSFT) {
+ if (leader_sequence_one_key(KC_LSFT)) {
SEND_STRING("(");
}
/* ) => LdrKey > Right Shift */
- SEQ_ONE_KEY(KC_RSFT) {
+ if (leader_sequence_one_key(KC_RSFT)) {
SEND_STRING(")");
}
/* (|) => LdrKey > Left Shift > Left Shift */
- SEQ_TWO_KEYS(KC_LSFT, KC_LSFT) {
+ if (leader_sequence_two_keys(KC_LSFT, KC_LSFT)) {
ldrkey_send_paranthesis_wrap_ini();
}
/* (|) => LdrKey > Right Shift > Right Shift */
- SEQ_TWO_KEYS(KC_RSFT, KC_RSFT) {
+ if (leader_sequence_two_keys(KC_RSFT, KC_RSFT)) {
ldrkey_send_paranthesis_wrap_ini();
}
/* (X) wrap => LdrKey > Left Shift > W */
- SEQ_TWO_KEYS(KC_LSFT, KC_W) {
+ if (leader_sequence_two_keys(KC_LSFT, KC_W)) {
ldrkey_send_paranthesis_wrap_word();
}
/* (X) wrap => LdrKey > Right Shift > W */
- SEQ_TWO_KEYS(KC_RSFT, KC_W) {
+ if (leader_sequence_two_keys(KC_RSFT, KC_W)) {
ldrkey_send_paranthesis_wrap_word();
}
/* (X) wrap selection => LdrKey > Left Shift > W > W */
- SEQ_THREE_KEYS(KC_LSFT, KC_W, KC_W) {
+ if (leader_sequence_three_keys(KC_LSFT, KC_W, KC_W)) {
ldrkey_send_paranthesis_wrap_selection();
}
/* (X) wrap selection => LdrKey > Right Shift > W > W */
- SEQ_THREE_KEYS(KC_RSFT, KC_W, KC_W) {
+ if (leader_sequence_three_keys(KC_RSFT, KC_W, KC_W)) {
ldrkey_send_paranthesis_wrap_selection();
}
/* [ => LdrKey > Left CTL */
- SEQ_ONE_KEY(KC_LCTL) {
+ if (leader_sequence_one_key(KC_LCTL)) {
SEND_STRING("[");
}
/* ] => LdrKey > Right CTL */
- SEQ_ONE_KEY(KC_RCTL) {
+ if (leader_sequence_one_key(KC_RCTL)) {
SEND_STRING("]");
}
/* [|] => LdrKey > Left CTL > Left CTL */
- SEQ_TWO_KEYS(KC_LCTL, KC_LCTL) {
+ if (leader_sequence_two_keys(KC_LCTL, KC_LCTL)) {
ldrkey_send_bracket_wrap_ini();
}
/* [|] => LdrKey > Right CTL > Right CTL */
- SEQ_TWO_KEYS(KC_RCTL, KC_RCTL) {
+ if (leader_sequence_two_keys(KC_RCTL, KC_RCTL)) {
ldrkey_send_bracket_wrap_ini();
}
/* [X] wrap => LdrKey > Left CTL > W */
- SEQ_TWO_KEYS(KC_LCTL, KC_W) {
+ if (leader_sequence_two_keys(KC_LCTL, KC_W)) {
ldrkey_send_bracket_wrap_word();
}
/* [X] wrap => LdrKey > Right CTL > W */
- SEQ_TWO_KEYS(KC_RCTL, KC_W) {
+ if (leader_sequence_two_keys(KC_RCTL, KC_W)) {
ldrkey_send_bracket_wrap_word();
}
/* [X] wrap selection => LdrKey > Left CTL > W > W */
- SEQ_THREE_KEYS(KC_LCTL, KC_W, KC_W) {
+ if (leader_sequence_three_keys(KC_LCTL, KC_W, KC_W)) {
ldrkey_send_bracket_wrap_selection();
}
/* [X] wrap selection => LdrKey > Right CTL > W > W */
- SEQ_THREE_KEYS(KC_RCTL, KC_W, KC_W) {
+ if (leader_sequence_three_keys(KC_RCTL, KC_W, KC_W)) {
ldrkey_send_bracket_wrap_selection();
}
/* { => LdrKey > Left ALT */
- SEQ_ONE_KEY(KC_LALT) {
+ if (leader_sequence_one_key(KC_LALT)) {
SEND_STRING("{");
}
/* } => LdrKey > Right ALT */
- SEQ_ONE_KEY(KC_RALT) {
+ if (leader_sequence_one_key(KC_RALT)) {
SEND_STRING("}");
}
/* {|} => LdrKey > Left ALT > Left ALT */
- SEQ_TWO_KEYS(KC_LALT, KC_LALT) {
+ if (leader_sequence_two_keys(KC_LALT, KC_LALT)) {
ldrkey_send_curlybrace_wrap_ini();
}
/* {|} => LdrKey > Right ALT > Right ALT */
- SEQ_TWO_KEYS(KC_RALT, KC_RALT) {
+ if (leader_sequence_two_keys(KC_RALT, KC_RALT)) {
ldrkey_send_curlybrace_wrap_ini();
}
/* {X} wrap => LdrKey > Left ALT > W */
- SEQ_TWO_KEYS(KC_LALT, KC_W) {
+ if (leader_sequence_two_keys(KC_LALT, KC_W)) {
ldrkey_send_curlybrace_wrap_word();
}
/* {X} wrap => LdrKey > Right ALT > W */
- SEQ_TWO_KEYS(KC_RALT, KC_W) {
+ if (leader_sequence_two_keys(KC_RALT, KC_W)) {
ldrkey_send_curlybrace_wrap_word();
}
/* {X} wrap selection => LdrKey > Left ALT > W > W */
- SEQ_THREE_KEYS(KC_LALT, KC_W, KC_W) {
+ if (leader_sequence_three_keys(KC_LALT, KC_W, KC_W)) {
ldrkey_send_curlybrace_wrap_selection();
}
/* {X} wrap selection => LdrKey > Right ALT > W > W */
- SEQ_THREE_KEYS(KC_RALT, KC_W, KC_W) {
+ if (leader_sequence_three_keys(KC_RALT, KC_W, KC_W)) {
ldrkey_send_curlybrace_wrap_selection();
}
/* Select everything on this line before cursor => LdrKey > Left */
- SEQ_ONE_KEY(KC_LEFT) {
+ if (leader_sequence_one_key(KC_LEFT)) {
onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_LEFT)))) : SEND_STRING(SS_LSFT(SS_TAP(X_HOME)));
}
/* Select everything on this line after cursor => LdrKey > Right */
- SEQ_ONE_KEY(KC_RIGHT) {
+ if (leader_sequence_one_key(KC_RIGHT)) {
onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_RIGHT)))) : SEND_STRING(SS_LSFT(SS_TAP(X_END)));
}
/* Select everything on this line before cursor and bring on previous line => LdrKey > Left > Left */
- SEQ_TWO_KEYS(KC_LEFT, KC_LEFT) {
+ if (leader_sequence_two_keys(KC_LEFT, KC_LEFT)) {
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)));
}
/* Select everything on this line => LdrKey > Right > Left */
- SEQ_TWO_KEYS(KC_RIGHT, KC_LEFT) {
+ if (leader_sequence_two_keys(KC_RIGHT, KC_LEFT)) {
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)));
}
/* Select 1x Page Up on the page before the cursor => LdrKey > Up */
- SEQ_ONE_KEY(KC_UP) {
+ if (leader_sequence_one_key(KC_UP)) {
SEND_STRING(SS_LSFT(SS_TAP(X_PGUP)));
}
/* Select 1x Page Down on the page after the cursor => LdrKey > Down */
- SEQ_ONE_KEY(KC_DOWN) {
+ if (leader_sequence_one_key(KC_DOWN)) {
SEND_STRING(SS_LSFT(SS_TAP(X_PGDN)));
}
/* Select everything on the page before the cursor => LdrKey > Up > Up */
- SEQ_TWO_KEYS(KC_UP, KC_UP) {
+ if (leader_sequence_two_keys(KC_UP, KC_UP)) {
onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_UP)))) : SEND_STRING(SS_LSFT(SS_LCTL(SS_TAP(X_HOME))));
}
/* Select everything on the page after the cursor => LdrKey > Down > Down */
- SEQ_TWO_KEYS(KC_DOWN, KC_DOWN) {
+ if (leader_sequence_two_keys(KC_DOWN, KC_DOWN)) {
onMac ? SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_DOWN)))) : SEND_STRING(SS_LSFT(SS_LCTL(SS_TAP(X_END))));
}
/* HELPER => spit out the url of the layout description page on github */
- SEQ_FIVE_KEYS(QK_GESC, QK_GESC, QK_GESC, QK_GESC, QK_GESC) {
+ if (leader_sequence_five_keys(QK_GESC, QK_GESC, QK_GESC, QK_GESC, QK_GESC)) {
SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/keyboards/dztech/dz65rgb/keymaps/drootz");
}
/* google.ca => LdrKey > G > G */
- SEQ_TWO_KEYS(KC_G, KC_G) {
+ if (leader_sequence_two_keys(KC_G, KC_G)) {
SEND_STRING("https://google.ca" SS_TAP(X_ENT));
}
/* @gmail => LdrKey > M > L > T */
- SEQ_THREE_KEYS(KC_M, KC_L, KC_T) {
+ if (leader_sequence_three_keys(KC_M, KC_L, KC_T)) {
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");
}
/* Show Desktop => LdrKey > D */
- SEQ_ONE_KEY(KC_D) {
+ if (leader_sequence_one_key(KC_D)) {
onMac ? SEND_STRING(SS_LGUI(SS_TAP(X_SPC)) "Mission" SS_TAP(X_ENT)) : SEND_STRING(SS_LGUI(SS_TAP(X_D)));
}
- }
-}
-
-void leader_start_user(void) {
- isLeader = true;
-}
-
-void leader_end_user(void) {
- isLeader = false;
}
#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 @@
-LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY(TD(APMR_PIPE)) {
- register_code(KC_LCTL);
- register_code(KC_LSFT);
- register_code(KC_U);
-
- unregister_code(KC_U);
- unregister_code(KC_LSFT);
- unregister_code(KC_LCTL);
- }
-}
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 @@
-LEADER_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 @@
-#include "../leader/leader_setup.c"
-
bool MATRIX_SCANNED = false;
void matrix_scan_user(void) {
@@ -7,6 +5,16 @@ void matrix_scan_user(void) {
rgblight_sethsv_noeeprom(HSV_GREEN);
MATRIX_SCANNED = true;
}
-
- #include "../leader/leader_dictionary.c"
};
+
+void leader_end_user(void) {
+ if (leader_sequence_one_key(TD(APMR_PIPE))) {
+ register_code(KC_LCTL);
+ register_code(KC_LSFT);
+ register_code(KC_U);
+
+ unregister_code(KC_U);
+ unregister_code(KC_LSFT);
+ unregister_code(KC_LCTL);
+ }
+}
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) {
}
}
-LEADER_EXTERNS();
+void leader_end_user(void) {
+ if (leader_sequence_one_key(KC_F)) {
+ SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
+ }
+ if (leader_sequence_one_key(KC_S)) {
+ SEND_STRING ("sudo -i\n");
+ }
+ if (leader_sequence_one_key(KC_H)) {
+ SEND_STRING ("--help\n");
+ }
+ if (leader_sequence_two_keys(KC_D, KC_D)) {
+ SEND_STRING(SS_LGUI("ac"));
+ /* SEND_STRING(SS_LGUI("a") SS_LGUI("c")); */
+ }
+ if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
+ SEND_STRING("https://start.duckduckgo.com\n");
+ }
+ if (leader_sequence_two_keys(KC_A, KC_S)) {
+ register_code(KC_LGUI);
+ register_code(KC_S);
+ unregister_code(KC_S);
+ unregister_code(KC_LGUI);
+ }
+}
void matrix_scan_user(void) {
if (is_alt_tab_active) {
@@ -253,31 +276,4 @@ void matrix_scan_user(void) {
is_alt_tab_active = false;
}
}
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY(KC_F) {
- SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
- }
- SEQ_ONE_KEY(KC_S) {
- SEND_STRING ("sudo -i\n");
- }
- SEQ_ONE_KEY(KC_H) {
- SEND_STRING ("--help\n");
- }
- SEQ_TWO_KEYS(KC_D, KC_D) {
- SEND_STRING(SS_LGUI("ac"));
- /* SEND_STRING(SS_LGUI("a") SS_LGUI("c")); */
- }
- SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
- SEND_STRING("https://start.duckduckgo.com\n");
- }
- SEQ_TWO_KEYS(KC_A, KC_S) {
- register_code(KC_LGUI);
- register_code(KC_S);
- unregister_code(KC_S);
- unregister_code(KC_LGUI);
- }
- }
}
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] = {
)
};
-void matrix_init_user(void) {
-
-}
-
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
-
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- // Close a program in i3wm
- SEQ_ONE_KEY(KC_Q) {
- register_code(KC_LGUI);
- register_code(KC_LSFT);
- register_code(KC_Q);
- unregister_code(KC_Q);
- unregister_code(KC_LSFT);
- unregister_code(KC_LGUI);
- }
- // Exit i3wm
- SEQ_ONE_KEY(KC_E) {
- register_code(KC_LGUI);
- register_code(KC_LSFT);
- register_code(KC_E);
- unregister_code(KC_E);
- unregister_code(KC_LSFT);
- unregister_code(KC_LGUI);
- }
- // Copy selected text in suckless terminal
- SEQ_ONE_KEY(KC_C) {
- register_code(KC_LCTL);
- register_code(KC_LSFT);
- register_code(KC_C);
- unregister_code(KC_C);
- unregister_code(KC_LSFT);
- unregister_code(KC_LCTL);
- }
- // Paste text in suckless terminal
- SEQ_ONE_KEY(KC_V) {
- register_code(KC_LCTL);
- register_code(KC_LSFT);
- register_code(KC_V);
- unregister_code(KC_V);
- unregister_code(KC_LSFT);
- unregister_code(KC_LCTL);
- }
- // FZF shortcut to fuzzy switch directories
- SEQ_ONE_KEY(KC_D) {
- register_code(KC_LALT);
- register_code(KC_C);
- unregister_code(KC_C);
- unregister_code(KC_LALT);
- }
- // Send keys to bring up fuzzy process kill
- SEQ_ONE_KEY(KC_K) {
- SEND_STRING("kill " SS_TAP(X_TAB));
- }
- // Send keys to start neovim and fuzzy search for filename
- SEQ_ONE_KEY(KC_T) {
- SEND_STRING("nvim ");
- register_code(KC_LCTL);
- register_code(KC_T);
- unregister_code(KC_T);
- unregister_code(KC_LCTL);
- }
- // Switch between windows in tmux
- SEQ_ONE_KEY(KC_L) {
- register_code(KC_LCTL);
- register_code(KC_B);
- unregister_code(KC_B);
- unregister_code(KC_LCTL);
- register_code(KC_L);
- unregister_code(KC_L);
- }
+void leader_end_user() {
+ // Close a program in i3wm
+ if (leader_sequence_one_key(KC_Q)) {
+ register_code(KC_LGUI);
+ register_code(KC_LSFT);
+ register_code(KC_Q);
+ unregister_code(KC_Q);
+ unregister_code(KC_LSFT);
+ unregister_code(KC_LGUI);
+ }
+ // Exit i3wm
+ if (leader_sequence_one_key(KC_E)) {
+ register_code(KC_LGUI);
+ register_code(KC_LSFT);
+ register_code(KC_E);
+ unregister_code(KC_E);
+ unregister_code(KC_LSFT);
+ unregister_code(KC_LGUI);
+ }
+ // Copy selected text in suckless terminal
+ if (leader_sequence_one_key(KC_C)) {
+ register_code(KC_LCTL);
+ register_code(KC_LSFT);
+ register_code(KC_C);
+ unregister_code(KC_C);
+ unregister_code(KC_LSFT);
+ unregister_code(KC_LCTL);
+ }
+ // Paste text in suckless terminal
+ if (leader_sequence_one_key(KC_V)) {
+ register_code(KC_LCTL);
+ register_code(KC_LSFT);
+ register_code(KC_V);
+ unregister_code(KC_V);
+ unregister_code(KC_LSFT);
+ unregister_code(KC_LCTL);
+ }
+ // FZF shortcut to fuzzy switch directories
+ if (leader_sequence_one_key(KC_D)) {
+ register_code(KC_LALT);
+ register_code(KC_C);
+ unregister_code(KC_C);
+ unregister_code(KC_LALT);
+ }
+ // Send keys to bring up fuzzy process kill
+ if (leader_sequence_one_key(KC_K)) {
+ SEND_STRING("kill " SS_TAP(X_TAB));
+ }
+ // Send keys to start neovim and fuzzy search for filename
+ if (leader_sequence_one_key(KC_T)) {
+ SEND_STRING("nvim ");
+ register_code(KC_LCTL);
+ register_code(KC_T);
+ unregister_code(KC_T);
+ unregister_code(KC_LCTL);
+ }
+ // Switch between windows in tmux
+ if (leader_sequence_one_key(KC_L)) {
+ register_code(KC_LCTL);
+ register_code(KC_B);
+ unregister_code(KC_B);
+ unregister_code(KC_LCTL);
+ register_code(KC_L);
+ unregister_code(KC_L);
}
-}
-
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- return true;
-}
-
-void led_set_user(uint8_t usb_led) {
-
}
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] = {
_______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PSCR, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_LEFT, KC_RGHT, _______, KC_PENT,
_______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______)};
-
-/*void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY(KC_RSFT) {
- register_code(KC_S);
- unregister_code(KC_S);
- }
- SEQ_TWO_KEYS(KC_A, KC_S) {
- register_code(KC_H);
- unregister_code(KC_H);
- }
- SEQ_THREE_KEYS(KC_A, KC_S, KC_D) {
- register_code(KC_LGUI);
- register_code(KC_S);
- unregister_code(KC_S);
- unregister_code(KC_LGUI);
- }
- }
-}*/
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] = {
),
};
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY(KC_U) {
- SEND_STRING(":luvu:\n");
+void leader_end_user(void) {
+ if (leader_sequence_one_key(KC_U)) {
+ SEND_STRING(":luvu:\n");
}
- }
}
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
};
+void leader_end_user(void) {
+ if (leader_sequence_one_key(KC_1)) {
+ // ¯\_(ツ)_/¯
+ unicode_input_start(); register_hex(0xaf); unicode_input_finish();
+ register_code (KC_RALT); TAP_ONCE (KC_MINS); unregister_code (KC_RALT);
+ register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT);
+ unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
+ register_code (KC_RSFT); TAP_ONCE (KC_9); TAP_ONCE(KC_7); unregister_code (KC_RSFT);
+ unicode_input_start (); register_hex(0xaf); unicode_input_finish();
+ }
+
+ if (leader_sequence_one_key(KC_2)) {
+ // 凸(ツ)凸
+ unicode_input_start(); register_hex(0x51F8); unicode_input_finish();
+ register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT);
+ unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
+ register_code (KC_RSFT); TAP_ONCE (KC_9); unregister_code (KC_RSFT);
+ unicode_input_start (); register_hex(0x51F8); unicode_input_finish();
+ }
+}
+
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
set_unicode_input_mode(UNICODE_MODE_LINUX);
};
-
-
-LEADER_EXTERNS();
-
-// Runs constantly in the background, in a loop.
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY (KC_1) {
- // ¯\_(ツ)_/¯
- unicode_input_start(); register_hex(0xaf); unicode_input_finish();
- register_code (KC_RALT); TAP_ONCE (KC_MINS); unregister_code (KC_RALT);
- register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT);
- unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
- register_code (KC_RSFT); TAP_ONCE (KC_9); TAP_ONCE(KC_7); unregister_code (KC_RSFT);
- unicode_input_start (); register_hex(0xaf); unicode_input_finish();
- }
-
- SEQ_ONE_KEY (KC_2) {
- // 凸(ツ)凸
- unicode_input_start(); register_hex(0x51F8); unicode_input_finish();
- register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT);
- unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
- register_code (KC_RSFT); TAP_ONCE (KC_9); unregister_code (KC_RSFT);
- unicode_input_start (); register_hex(0x51F8); unicode_input_finish();
- }
- }
-}
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 {
#define MW_L KC_MS_WH_LEFT
#define MW_R KC_MS_WH_RIGHT
-//// only uncomment the below line when you enable leader key in rules.mk
-//LEADER_EXTERNS();
-
//Tap Dance Declarations
enum {
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;
static uint16_t wiggle_timer;
static uint16_t next_wiggle;
+void leader_end_user(void) {
+ if (leader_sequence_one_key(QK_LEAD)) {
+ tap_code(KC_CAPS);
+ }
-LEADER_EXTERNS();
+ if (leader_sequence_four_keys(KC_I, KC_D, KC_L, KC_E)) {
+ wiggle_mouse = !wiggle_mouse;
+ wiggle_timer = timer_read();
+ }
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY(QK_LEAD) {
- tap_code(KC_CAPS);
- }
-
- SEQ_FOUR_KEYS(KC_I, KC_D, KC_L, KC_E) {
- wiggle_mouse = !wiggle_mouse;
- wiggle_timer = timer_read();
- }
-
- SEQ_TWO_KEYS(KC_O, KC_K) {
- send_unicode_string("👍");
- }
-
- SEQ_THREE_KEYS(KC_S, KC_A, KC_D) {
- send_unicode_string("😞");
- }
-
- SEQ_FIVE_KEYS(KC_C, KC_H, KC_E, KC_C, KC_K) {
- send_unicode_string("✅");
- }
-
- SEQ_FIVE_KEYS(KC_C, KC_R, KC_O, KC_S, KC_S) {
- send_unicode_string("❎");
- }
-
- SEQ_FIVE_KEYS(KC_T, KC_H, KC_A, KC_N, KC_K) {
- send_unicode_string("🙏");
- }
-
- SEQ_FIVE_KEYS(KC_S, KC_M, KC_I, KC_L, KC_E) {
- send_unicode_string("😊");
- }
-
- SEQ_FIVE_KEYS(KC_P, KC_A, KC_R, KC_T, KC_Y) {
- send_unicode_string("🎉");
- }
-
- SEQ_FOUR_KEYS(KC_E, KC_Y, KC_E, KC_S) {
- send_unicode_string("(ಠ_ಠ)");
- }
-
- SEQ_FIVE_KEYS(KC_M, KC_A, KC_G, KC_I, KC_C) {
- send_unicode_string("(ಠ_ಠ) 🪄 ⠁⭒*.✫.*⭒⠁");
- }
-
- SEQ_FIVE_KEYS(KC_T, KC_A, KC_B, KC_L, KC_E) {
- send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻");
- }
-
- SEQ_FIVE_KEYS(KC_S, KC_H, KC_R, KC_U, KC_G) {
- send_unicode_string("¯\\_(ツ)_/¯");
- }
+ if (leader_sequence_two_keys(KC_O, KC_K)) {
+ send_unicode_string("👍");
+ }
+
+ if (leader_sequence_three_keys(KC_S, KC_A, KC_D)) {
+ send_unicode_string("😞");
+ }
+
+ if (leader_sequence_five_keys(KC_C, KC_H, KC_E, KC_C, KC_K)) {
+ send_unicode_string("✅");
+ }
+
+ if (leader_sequence_five_keys(KC_C, KC_R, KC_O, KC_S, KC_S)) {
+ send_unicode_string("❎");
+ }
+
+ if (leader_sequence_five_keys(KC_T, KC_H, KC_A, KC_N, KC_K)) {
+ send_unicode_string("🙏");
+ }
+
+ if (leader_sequence_five_keys(KC_S, KC_M, KC_I, KC_L, KC_E)) {
+ send_unicode_string("😊");
+ }
+
+ if (leader_sequence_five_keys(KC_P, KC_A, KC_R, KC_T, KC_Y)) {
+ send_unicode_string("🎉");
+ }
+
+ if (leader_sequence_four_keys(KC_E, KC_Y, KC_E, KC_S)) {
+ send_unicode_string("(ಠ_ಠ)");
+ }
+
+ if (leader_sequence_five_keys(KC_M, KC_A, KC_G, KC_I, KC_C)) {
+ send_unicode_string("(ಠ_ಠ) 🪄 ⠁⭒*.✫.*⭒⠁");
}
+ if (leader_sequence_five_keys(KC_T, KC_A, KC_B, KC_L, KC_E)) {
+ send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻");
+ }
+
+ if (leader_sequence_five_keys(KC_S, KC_H, KC_R, KC_U, KC_G)) {
+ send_unicode_string("¯\\_(ツ)_/¯");
+ }
+}
+
+void matrix_scan_user(void) {
if (wiggle_mouse && timer_elapsed(wiggle_timer) > next_wiggle) {
wiggle_timer = timer_read();
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) {
return false;
}
-#ifdef LEADER_ENABLE
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY(KC_F) {
- // Anything you can do in a macro.
- SEND_STRING("QMK is awesome.");
- }
- SEQ_TWO_KEYS(KC_D, KC_D) {
- SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
- }
- SEQ_TWO_KEYS(KC_S, KC_S) {
- SEND_STRING(SS_LCTL("v"));
- }
- SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
- SEND_STRING("https://start.duckduckgo.com\n");
- }
+void leader_end_user(void) {
+ if (leader_sequence_one_key(KC_F)) {
+ // Anything you can do in a macro.
+ SEND_STRING("QMK is awesome.");
+ }
+ if (leader_sequence_two_keys(KC_D, KC_D)) {
+ SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
+ }
+ if (leader_sequence_two_keys(KC_S, KC_S)) {
+ SEND_STRING(SS_LCTL("v"));
+ }
+ if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
+ SEND_STRING("https://start.duckduckgo.com\n");
}
}
-#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) {
return false;
}
-#ifdef LEADER_ENABLE
-LEADER_EXTERNS();
-
-//SEND_STRING seems to be local dependent.
-//For swiss-german layout I have to send "ctrl+." to get ":"
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY(KC_F) {
- // Anything you can do in a macro.
- SEND_STRING("QMK is awesome.");
- }
- SEQ_TWO_KEYS(KC_D, KC_D) {
- SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
- }
- SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
- SEND_STRING("https");
- register_code(KC_LSFT);
- SEND_STRING(".77");
- unregister_code(KC_LSFT);
- SEND_STRING("start.duckduckgo.com\n");
- }
+void leader_end_user(void) {
+ if (leader_sequence_one_key(KC_F)) {
+ // Anything you can do in a macro.
+ SEND_STRING("QMK is awesome.");
+ }
+ if (leader_sequence_two_keys(KC_D, KC_D)) {
+ SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
+ }
+ if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
+ SEND_STRING("https");
+ register_code(KC_LSFT);
+ SEND_STRING(".77");
+ unregister_code(KC_LSFT);
+ SEND_STRING("start.duckduckgo.com\n");
}
}
-#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) {
}
}
+void leader_end_user(void) {
+ if (leader_sequence_one_key(KC_K)) {
+ layer_invert(_KP);
+ }
+ if (leader_sequence_one_key(KC_G)) {
+ layer_invert(_GAME);
+ }
+ if (leader_sequence_one_key(KC_KP_5)) {
+ layer_invert(_KP);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_1)) {
+ send_secret_string(0);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_2)) {
+ send_secret_string(1);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_3)) {
+ send_secret_string(2);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_4)) {
+ send_secret_string(3);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_5)) {
+ send_secret_string(4);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_6)) {
+ send_secret_string(5);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_M)) {
+ send_secret_string(0);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_COMM)) {
+ send_secret_string(1);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_DOT)) {
+ send_secret_string(2);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_J)) {
+ send_secret_string(3);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_K)) {
+ send_secret_string(4);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_L)) {
+ send_secret_string(5);
+ }
+}
+
// Runs just one time when the keyboard initializes.
void matrix_init_keymap(void) {
// force numlock on upon startup
@@ -264,8 +312,6 @@ void matrix_init_keymap(void) {
}
};
-LEADER_EXTERNS();
-
// Runs constantly in the background, in a loop.
void matrix_scan_keymap(void) {
if (rgb_matrix_get_flags() != LED_FLAG_NONE && timer_elapsed(rgb_timer) > 1000) {
@@ -282,56 +328,6 @@ void matrix_scan_keymap(void) {
else
rgb_matrix_set_color(15, 0, 0, 0);
}
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY(KC_K) {
- layer_invert(_KP);
- }
- SEQ_ONE_KEY(KC_G) {
- layer_invert(_GAME);
- }
- SEQ_ONE_KEY(KC_KP_5) {
- layer_invert(_KP);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_1) {
- send_secret_string(0);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_2) {
- send_secret_string(1);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_3) {
- send_secret_string(2);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_4) {
- send_secret_string(3);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_5) {
- send_secret_string(4);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_6) {
- send_secret_string(5);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_M) {
- send_secret_string(0);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_COMM) {
- send_secret_string(1);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_DOT) {
- send_secret_string(2);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_J) {
- send_secret_string(3);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_K) {
- send_secret_string(4);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_L) {
- send_secret_string(5);
- }
- }
};
layer_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) {
return true;
};
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_TWO_KEYS(KC_G, KC_P) {
- SEND_STRING("git push");
- }
- SEQ_THREE_KEYS(KC_G, KC_F, KC_P) {
- SEND_STRING("git push --force-with-lease");
- }
+void leader_end_user(void) {
+ if (leader_sequence_two_keys(KC_G, KC_P)) {
+ SEND_STRING("git push");
+ }
+ if (leader_sequence_three_keys(KC_G, KC_F, KC_P)) {
+ SEND_STRING("git push --force-with-lease");
}
}
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] = {
};
//Leader maps
-
-
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY(KC_F) {
- // Anything you can do in a macro.
- SEND_STRING("QMK is awesome.");
+void leader_end_user(void) {
+ if (leader_sequence_one_key(KC_F)) {
+ // Anything you can do in a macro.
+ SEND_STRING("QMK is awesome.");
}
//tableflip (LEADER - TF)
- SEQ_TWO_KEYS(KC_T, KC_F) {
+ if (leader_sequence_two_keys(KC_T, KC_F)) {
set_unicode_input_mode(UNICODE_MODE_MACOS);
send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻");
}
//screencap (LEADER - SC)
- SEQ_TWO_KEYS(KC_S, KC_C) {
- SEND_STRING(SS_LGUI(SS_LSFT(SS_TAP(X_4))));
+ if (leader_sequence_two_keys(KC_S, KC_C)) {
+ SEND_STRING(SS_LGUI(SS_LSFT(SS_TAP(X_4))));
}
//screencap (LEADER - TM)
- SEQ_TWO_KEYS(KC_T, KC_M) {
+ if (leader_sequence_two_keys(KC_T, KC_M)) {
set_unicode_input_mode(UNICODE_MODE_MACOS);
register_unicode(0x2122); // ™
}
/*
- SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
- SEND_STRING("https://start.duckduckgo.com"SS_TAP(X_ENTER));
+ if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
+ SEND_STRING("https://start.duckduckgo.com"SS_TAP(X_ENTER));
}
*/
- }
}
//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) {
return true;
}
-LEADER_EXTERNS();
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- // Screenshot
- SEQ_ONE_KEY(KC_S) {
- tap_code16(G(C(S(KC_4))));
- }
- // Record Screen
- SEQ_TWO_KEYS(KC_S, KC_S) {
- tap_code16(S(G(KC_5)));
- }
- // 1Pass browser
- SEQ_ONE_KEY(KC_A) {
- tap_code16(G(A(KC_BSLS)));
- }
- // 1Pass mini
- SEQ_TWO_KEYS(KC_A, KC_A) {
- tap_code16(G(KC_BSLS));
- }
- // Comment out
- SEQ_ONE_KEY(KC_F) {
- tap_code16(G(KC_SLSH));
- }
- // Spotlight
- SEQ_ONE_KEY(KC_SPC) {
- tap_code16(G(KC_SPC));
- }
- // Auto format
- SEQ_ONE_KEY(KC_ENT) {
- tap_code16(S(G(A(KC_F))));
- }
- // Focus file tree
- SEQ_ONE_KEY(KC_TAB) {
- tap_code16(G(KC_1));
- }
- // Caps-lock
- SEQ_TWO_KEYS(KC_TAB, KC_TAB) {
- tap_code16(KC_CAPS);
- }
+void leader_end_user(void) {
+ // Screenshot
+ if (leader_sequence_one_key(KC_S)) {
+ tap_code16(G(C(S(KC_4))));
+ }
+ // Record Screen
+ if (leader_sequence_two_keys(KC_S, KC_S)) {
+ tap_code16(S(G(KC_5)));
+ }
+ // 1Pass browser
+ if (leader_sequence_one_key(KC_A)) {
+ tap_code16(G(A(KC_BSLS)));
+ }
+ // 1Pass mini
+ if (leader_sequence_two_keys(KC_A, KC_A)) {
+ tap_code16(G(KC_BSLS));
+ }
+ // Comment out
+ if (leader_sequence_one_key(KC_F)) {
+ tap_code16(G(KC_SLSH));
+ }
+ // Spotlight
+ if (leader_sequence_one_key(KC_SPC)) {
+ tap_code16(G(KC_SPC));
+ }
+ // Auto format
+ if (leader_sequence_one_key(KC_ENT)) {
+ tap_code16(S(G(A(KC_F))));
+ }
+ // Focus file tree
+ if (leader_sequence_one_key(KC_TAB)) {
+ tap_code16(G(KC_1));
+ }
+ // Caps-lock
+ if (leader_sequence_two_keys(KC_TAB, KC_TAB)) {
+ tap_code16(KC_CAPS);
}
}
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)
#endif
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY (KC_R) {
- tap_random_base64();
- tap_random_base64();
- tap_random_base64();
- tap_random_base64();
- tap_random_base64();
- tap_random_base64();
- tap_random_base64();
- tap_random_base64();
- tap_random_base64();
- }
- SEQ_ONE_KEY (KC_V) {
- SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
- }
- SEQ_ONE_KEY(KC_F) {
- SEND_STRING("if yes\n\tpeanut butter\nelse\n\trice snacks");
- }
- SEQ_TWO_KEYS(KC_A, KC_S) {
- register_code(KC_H);
- unregister_code(KC_H);
- }
- SEQ_THREE_KEYS(KC_A, KC_S, KC_D) {
- register_code(KC_LGUI);
- register_code(KC_S);
- unregister_code(KC_S);
- unregister_code(KC_LGUI);
- }
+void leader_end_user(void) {
+ if (leader_sequence_one_key(KC_R)) {
+ tap_random_base64();
+ tap_random_base64();
+ tap_random_base64();
+ tap_random_base64();
+ tap_random_base64();
+ tap_random_base64();
+ tap_random_base64();
+ tap_random_base64();
+ tap_random_base64();
+ }
+ if (leader_sequence_one_key(KC_V)) {
+ SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
+ }
+ if (leader_sequence_one_key(KC_F)) {
+ SEND_STRING("if yes\n\tpeanut butter\nelse\n\trice snacks");
+ }
+ if (leader_sequence_two_keys(KC_A, KC_S)) {
+ register_code(KC_H);
+ unregister_code(KC_H);
+ }
+ if (leader_sequence_three_keys(KC_A, KC_S, KC_D)) {
+ register_code(KC_LGUI);
+ register_code(KC_S);
+ unregister_code(KC_S);
+ unregister_code(KC_LGUI);
}
}
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) {
bspc_timer = 0;
}
-LEADER_EXTERNS();
+void leader_end_user(void) {
+ if (leader_sequence_one_key(KC_K)) {
+ layer_invert(_KP);
+ }
+ if (leader_sequence_one_key(KC_G)) {
+ layer_invert(_GAME);
+ }
+ if (leader_sequence_one_key(KC_KP_5)) {
+ layer_invert(_KP);
+ }
+ if (leader_sequence_one_key(KC_5)) {
+ layer_invert(_KP);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_1)) {
+ send_secret_string(0);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_2)) {
+ send_secret_string(1);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_3)) {
+ send_secret_string(2);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_4)) {
+ send_secret_string(3);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_5)) {
+ send_secret_string(4);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_6)) {
+ send_secret_string(5);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_M)) {
+ send_secret_string(0);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_COMM)) {
+ send_secret_string(1);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_DOT)) {
+ send_secret_string(2);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_J)) {
+ send_secret_string(3);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_K)) {
+ send_secret_string(4);
+ }
+ if (leader_sequence_two_keys(KC_SCLN, KC_L)) {
+ send_secret_string(5);
+ }
+ if (leader_sequence_one_key(KC_C)) {
+ tap_code16(C(KC_C));
+ }
+ // neovim: terminal escape
+ if (leader_sequence_one_key(KC_QUOT)) {
+ tap_code16(C(KC_BSLS));
+ tap_code16(C(KC_N));
+ }
+}
void matrix_scan_keymap(void) {
#ifdef AUDIO_ENABLE
@@ -436,67 +493,6 @@ void matrix_scan_keymap(void) {
bspc_timer = 0;
register_code(KC_BSPC);
}
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY(KC_K) {
- layer_invert(_KP);
- }
- SEQ_ONE_KEY(KC_G) {
- layer_invert(_GAME);
- }
- SEQ_ONE_KEY(KC_KP_5) {
- layer_invert(_KP);
- }
- SEQ_ONE_KEY(KC_5) {
- layer_invert(_KP);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_1) {
- send_secret_string(0);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_2) {
- send_secret_string(1);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_3) {
- send_secret_string(2);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_4) {
- send_secret_string(3);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_5) {
- send_secret_string(4);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_6) {
- send_secret_string(5);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_M) {
- send_secret_string(0);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_COMM) {
- send_secret_string(1);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_DOT) {
- send_secret_string(2);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_J) {
- send_secret_string(3);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_K) {
- send_secret_string(4);
- }
- SEQ_TWO_KEYS(KC_SCLN, KC_L) {
- send_secret_string(5);
- }
- SEQ_ONE_KEY(KC_C) {
- tap_code16(C(KC_C));
- }
- // neovim: terminal escape
- SEQ_ONE_KEY(KC_QUOT) {
- tap_code16(C(KC_BSLS));
- tap_code16(C(KC_N));
- }
- }
}
bool 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) {
return true;
}
-
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY(KC_F) {
+void leader_end_user(void) {
+ if (leader_sequence_one_key(KC_F)) {
// Anything you can do in a macro.
SEND_STRING("QMK is awesome.");
}
- SEQ_TWO_KEYS(KC_D, KC_D) {
+ if (leader_sequence_two_keys(KC_D, KC_D)) {
SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
}
- SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
+ if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
SEND_STRING("https://start.duckduckgo.com\n");
}
- SEQ_TWO_KEYS(KC_A, KC_S) {
+ if (leader_sequence_two_keys(KC_A, KC_S)) {
register_code(KC_LGUI);
register_code(KC_S);
unregister_code(KC_S);
unregister_code(KC_LGUI);
}
- }
+}
+
+void matrix_scan_user(void) {
#ifdef AUDIO_ENABLE
if (muse_mode) {
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;
// Used by Leader key chords
bool did_leader_succeed;
-LEADER_EXTERNS();
// Tap-Dance stuffs, initializing functions that are coded further below
td_state_t cur_dance(tap_dance_state_t* state);
@@ -1404,6 +1403,81 @@ void leader_start_user(void) {
}
// Called when either the leader sequence is completed, or the leader timeout is hit
void leader_end_user(void) {
+ did_leader_succeed = false;
+
+ if (leader_sequence_one_key(KC_E)) {
+ SEND_STRING(SS_LCTL(SS_LSFT("t")));
+ did_leader_succeed = true;
+ }
+ if (leader_sequence_one_key(KC_C)) {
+ SEND_STRING(SS_LGUI("r") SS_DELAY(250) "calc\n");
+ did_leader_succeed = true;
+ }
+ else if (leader_sequence_one_key(KC_V)) {
+ SEND_STRING(SS_LCTL("v"));
+ did_leader_succeed = true;
+ }
+ else if (leader_sequence_two_keys(KC_E, KC_D)) {
+ SEND_STRING(SS_LGUI("r") "cmd\n" SS_LCTL("c"));
+ did_leader_succeed = true;
+ }
+ else if (leader_sequence_two_keys(KC_A, KC_C)) {
+ SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
+ did_leader_succeed = true;
+ }
+ else if (leader_sequence_three_keys(KC_C, KC_A, KC_T)) {
+ send_unicode_string("😸");
+ did_leader_succeed = true;
+ }
+ else if (leader_sequence_three_keys(KC_B, KC_A, KC_T)) {
+ send_unicode_string("🦇");
+ did_leader_succeed = true;
+ }
+ else if (leader_sequence_three_keys(KC_D, KC_O, KC_G)) {
+ send_unicode_string("🐶");
+ did_leader_succeed = true;
+ }
+ else if (leader_sequence_five_keys(KC_S, KC_M, KC_I, KC_L, KC_E)) {
+ send_unicode_string("🙂");
+ did_leader_succeed = true;
+ }
+ else if (leader_sequence_four_keys(KC_H, KC_A, KC_P, KC_Y)) {
+ send_unicode_string("🙂");
+ did_leader_succeed = true;
+ }
+ else if (leader_sequence_five_keys(KC_H, KC_A, KC_P, KC_P, KC_Y)) {
+ send_unicode_string("🙂");
+ did_leader_succeed = true;
+ }
+ else if (leader_sequence_three_keys(KC_S, KC_A, KC_D)) {
+ send_unicode_string("🙁");
+ did_leader_succeed = true;
+ }
+ else if (leader_sequence_three_keys(KC_Y, KC_E, KC_S)) {
+ send_unicode_string("👍");
+ did_leader_succeed = true;
+ }
+ else if (leader_sequence_two_keys(KC_N, KC_O)) {
+ send_unicode_string("👎");
+ did_leader_succeed = true;
+ }
+ else if (leader_sequence_three_keys(KC_W, KC_O, KC_W)) {
+ send_unicode_string("🤯");
+ did_leader_succeed = true;
+ }
+ else if (leader_sequence_three_keys(KC_P, KC_O, KC_O)) {
+ send_unicode_string("💩");
+ did_leader_succeed = true;
+ }
+ else if (leader_sequence_four_keys(KC_P, KC_O, KC_O, KC_P)) {
+ send_unicode_string("💩");
+ did_leader_succeed = true;
+ }
+ else if (leader_sequence_four_keys(KC_B, KC_O, KC_A, KC_T)) {
+ send_unicode_string("⛵");
+ did_leader_succeed = true;
+ }
+
if (did_leader_succeed) {
#ifdef AUDIO_ENABLE
PLAY_SONG(leader_succeed);
@@ -1758,84 +1832,6 @@ void matrix_scan_user(void) {
is_alt_tab_active = false;
}
}
- // Monitor and perform leader-key chords
- LEADER_DICTIONARY() {
- did_leader_succeed = leading = false;
-
- SEQ_ONE_KEY(KC_E) {
- SEND_STRING(SS_LCTL(SS_LSFT("t")));
- did_leader_succeed = true;
- }
- SEQ_ONE_KEY(KC_C) {
- SEND_STRING(SS_LGUI("r") SS_DELAY(250) "calc\n");
- did_leader_succeed = true;
- }
- else SEQ_ONE_KEY(KC_V) {
- SEND_STRING(SS_LCTL("v"));
- did_leader_succeed = true;
- }
- else SEQ_TWO_KEYS(KC_E, KC_D) {
- SEND_STRING(SS_LGUI("r") "cmd\n" SS_LCTL("c"));
- did_leader_succeed = true;
- }
- else SEQ_TWO_KEYS(KC_A, KC_C) {
- SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
- did_leader_succeed = true;
- }
- else SEQ_THREE_KEYS(KC_C, KC_A, KC_T) {
- send_unicode_string("😸");
- did_leader_succeed = true;
- }
- else SEQ_THREE_KEYS(KC_B, KC_A, KC_T) {
- send_unicode_string("🦇");
- did_leader_succeed = true;
- }
- else SEQ_THREE_KEYS(KC_D, KC_O, KC_G) {
- send_unicode_string("🐶");
- did_leader_succeed = true;
- }
- else SEQ_FIVE_KEYS(KC_S, KC_M, KC_I, KC_L, KC_E) {
- send_unicode_string("🙂");
- did_leader_succeed = true;
- }
- else SEQ_FOUR_KEYS(KC_H, KC_A, KC_P, KC_Y) {
- send_unicode_string("🙂");
- did_leader_succeed = true;
- }
- else SEQ_FIVE_KEYS(KC_H, KC_A, KC_P, KC_P, KC_Y) {
- send_unicode_string("🙂");
- did_leader_succeed = true;
- }
- else SEQ_THREE_KEYS(KC_S, KC_A, KC_D) {
- send_unicode_string("🙁");
- did_leader_succeed = true;
- }
- else SEQ_THREE_KEYS(KC_Y, KC_E, KC_S) {
- send_unicode_string("👍");
- did_leader_succeed = true;
- }
- else SEQ_TWO_KEYS(KC_N, KC_O) {
- send_unicode_string("👎");
- did_leader_succeed = true;
- }
- else SEQ_THREE_KEYS(KC_W, KC_O, KC_W) {
- send_unicode_string("🤯");
- did_leader_succeed = true;
- }
- else SEQ_THREE_KEYS(KC_P, KC_O, KC_O) {
- send_unicode_string("💩");
- did_leader_succeed = true;
- }
- else SEQ_FOUR_KEYS(KC_P, KC_O, KC_O, KC_P) {
- send_unicode_string("💩");
- did_leader_succeed = true;
- }
- else SEQ_FOUR_KEYS(KC_B, KC_O, KC_A, KC_T) {
- send_unicode_string("⛵");
- did_leader_succeed = true;
- }
- leader_end();
- }
// Run the wake-up RGB animation if performing wake-up
if (do_wake_animation) {
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) {
}
bool leader_found;
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_found = false;
- SEQ_ONE_KEY(L_RESET) {
- leader_found = true;
- reset_keyboard();
- }
- else
- SEQ_ONE_KEY(KC_DEL) {
- leader_found = true;
- layer_clear();
- }
- else
- SEQ_ONE_KEY(LOWER) {
- leader_found = true;
- layer_on(_LOWER);
- }
- else
- SEQ_ONE_KEY(RAISE) {
- leader_found = true;
- layer_on(_RAISE);
- }
- leader_end();
- }
-}
void leader_end_user(void) {
+ leader_found = false;
+
+ if (leader_sequence_one_key(L_RESET)) {
+ leader_found = true;
+ reset_keyboard();
+ } else if (leader_sequence_one_key(KC_DEL)) {
+ leader_found = true;
+ layer_clear();
+ } else if (leader_sequence_one_key(LOWER)) {
+ leader_found = true;
+ layer_on(_LOWER);
+ } else if (leader_sequence_one_key(RAISE)) {
+ leader_found = true;
+ layer_on(_RAISE);
+ }
+
// Plays sound on if leader sequence found.
if (leader_found) {
#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) {
return true;
}
-LEADER_EXTERNS();
-
static inline void register_ctrl_sequence(uint16_t keycode) {
tap_code16(RCTL(keycode));
}
-static inline void leader_bindings(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_THREE_KEYS(KC_A, KC_C, KC_K) {
- SEND_STRING("Acked-by: Christian Brauner <brauner@kernel.org>");
- }
+void leader_end_user(void) {
+ if (leader_sequence_three_keys(KC_A, KC_C, KC_K)) {
+ SEND_STRING("Acked-by: Christian Brauner <brauner@kernel.org>");
+ }
- SEQ_THREE_KEYS(KC_R, KC_V, KC_B) {
- SEND_STRING("Reviewed-by: Christian Brauner <brauner@kernel.org>");
- }
+ if (leader_sequence_three_keys(KC_R, KC_V, KC_B)) {
+ SEND_STRING("Reviewed-by: Christian Brauner <brauner@kernel.org>");
+ }
- SEQ_THREE_KEYS(KC_S, KC_O, KC_B) {
- SEND_STRING("Signed-off-by: Christian Brauner <brauner@kernel.org>");
- }
+ if (leader_sequence_three_keys(KC_S, KC_O, KC_B)) {
+ SEND_STRING("Signed-off-by: Christian Brauner <brauner@kernel.org>");
+ }
- /* Support vim-style copy. */
- SEQ_ONE_KEY(KC_Y) {
- tap_code16(C(S(KC_C)));
- }
+ /* Support vim-style copy. */
+ if (leader_sequence_one_key(KC_Y)) {
+ tap_code16(C(S(KC_C)));
+ }
- /* Support vim-style paste. */
- SEQ_ONE_KEY(KC_P) {
- tap_code16(C(S(KC_V)));
- }
+ /* Support vim-style paste. */
+ if (leader_sequence_one_key(KC_P)) {
+ tap_code16(C(S(KC_V)));
}
}
void matrix_scan_user(void) {
- leader_bindings();
-
#ifdef AUDIO_ENABLE
if (muse_mode) {
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);
//float leader_fail_song[][2] = SONG(GOODBYE_SOUND);
float leader_fail_song[][2] = SONG(NO_SOUND);
#endif
-LEADER_EXTERNS();
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- did_leader_succeed = leading = false;
-
- // tap dance
- // sort by first key
+void leader_start_user(void) {
+#ifdef AUDIO_ENABLE
+ PLAY_SONG(leader_start_song);
+#endif
+}
- SEQ_ONE_KEY(KC_C) {
- SEND_STRING(SS_TAP(X_CAPS));
- did_leader_succeed = true;
- }
+void leader_end_user(void) {
+ did_leader_succeed = false;
- SEQ_ONE_KEY(KC_BSPC) {
- SEND_STRING(SS_TAP(X_DEL));
- did_leader_succeed = true;
- }
+ // tap dance
+ // sort by first key
- SEQ_ONE_KEY(KC_D) {
- SEND_STRING("{}"SS_TAP(X_LEFT));
- did_leader_succeed = true;
- }
- SEQ_TWO_KEYS(KC_D, KC_B) {
- SEND_STRING("Dear Brother");
- did_leader_succeed = true;
- }
- SEQ_THREE_KEYS(KC_D, KC_B, KC_S) {
- SEND_STRING("Dear Brothers and Sister");
- did_leader_succeed = true;
- }
- SEQ_TWO_KEYS(KC_D, KC_D) {
- SEND_STRING("{");
- did_leader_succeed = true;
- }
- SEQ_THREE_KEYS(KC_D, KC_D, KC_D) {
- SEND_STRING("}");
- did_leader_succeed = true;
- }
- SEQ_TWO_KEYS(KC_D, KC_S) {
- SEND_STRING("Dear Sister");
- did_leader_succeed = true;
- }
+ if (leader_sequence_one_key(KC_C)) {
+ SEND_STRING(SS_TAP(X_CAPS));
+ did_leader_succeed = true;
+ }
- // Html Tags
- SEQ_TWO_KEYS(KC_H, KC_T) {
- SEND_STRING("<></>"SS_TAP(X_LEFT));
- did_leader_succeed = true;
- }
+ if (leader_sequence_one_key(KC_BSPC)) {
+ SEND_STRING(SS_TAP(X_DEL));
+ did_leader_succeed = true;
+ }
- SEQ_TWO_KEYS(KC_I, KC_C) {
- SEND_STRING("In Christ,");
- did_leader_succeed = true;
- }
+ if (leader_sequence_one_key(KC_D)) {
+ SEND_STRING("{}"SS_TAP(X_LEFT));
+ did_leader_succeed = true;
+ }
+ if (leader_sequence_two_keys(KC_D, KC_B)) {
+ SEND_STRING("Dear Brother");
+ did_leader_succeed = true;
+ }
+ if (leader_sequence_three_keys(KC_D, KC_B, KC_S)) {
+ SEND_STRING("Dear Brothers and Sister");
+ did_leader_succeed = true;
+ }
+ if (leader_sequence_two_keys(KC_D, KC_D)) {
+ SEND_STRING("{");
+ did_leader_succeed = true;
+ }
+ if (leader_sequence_three_keys(KC_D, KC_D, KC_D)) {
+ SEND_STRING("}");
+ did_leader_succeed = true;
+ }
+ if (leader_sequence_two_keys(KC_D, KC_S)) {
+ SEND_STRING("Dear Sister");
+ did_leader_succeed = true;
+ }
- SEQ_ONE_KEY(KC_J) {
- SEND_STRING("<>"SS_TAP(X_LEFT));
- did_leader_succeed = true;
- }
- SEQ_TWO_KEYS(KC_J, KC_J) {
- SEND_STRING("<");
- did_leader_succeed = true;
- }
- SEQ_THREE_KEYS(KC_J, KC_J, KC_J) {
- SEND_STRING(">");
- did_leader_succeed = true;
- }
+ // Html Tags
+ if (leader_sequence_two_keys(KC_H, KC_T)) {
+ SEND_STRING("<></>"SS_TAP(X_LEFT));
+ did_leader_succeed = true;
+ }
- SEQ_TWO_KEYS(KC_T, KC_S) {
- SEND_STRING("Thanks!");
- did_leader_succeed = true;
- }
- SEQ_TWO_KEYS(KC_T, KC_Y) {
- SEND_STRING("Thank you!");
- did_leader_succeed = true;
- }
+ if (leader_sequence_two_keys(KC_I, KC_C)) {
+ SEND_STRING("In Christ,");
+ did_leader_succeed = true;
+ }
- SEQ_ONE_KEY(KC_X) {
- SEND_STRING("()"SS_TAP(X_LEFT));
- did_leader_succeed = true;
- }
- SEQ_TWO_KEYS(KC_X, KC_X) {
- SEND_STRING("(");
- did_leader_succeed = true;
- }
- SEQ_THREE_KEYS(KC_X, KC_X, KC_X) {
- SEND_STRING(")");
- did_leader_succeed = true;
- }
+ if (leader_sequence_one_key(KC_J)) {
+ SEND_STRING("<>"SS_TAP(X_LEFT));
+ did_leader_succeed = true;
+ }
+ if (leader_sequence_two_keys(KC_J, KC_J)) {
+ SEND_STRING("<");
+ did_leader_succeed = true;
+ }
+ if (leader_sequence_three_keys(KC_J, KC_J, KC_J)) {
+ SEND_STRING(">");
+ did_leader_succeed = true;
+ }
- SEQ_ONE_KEY(KC_Z) {
- SEND_STRING("[]"SS_TAP(X_LEFT));
- did_leader_succeed = true;
- }
- SEQ_TWO_KEYS(KC_Z, KC_Z) {
- SEND_STRING("[");
- did_leader_succeed = true;
- }
- SEQ_THREE_KEYS(KC_Z, KC_Z, KC_Z) {
- SEND_STRING("]");
- did_leader_succeed = true;
- }
+ if (leader_sequence_two_keys(KC_T, KC_S)) {
+ SEND_STRING("Thanks!");
+ did_leader_succeed = true;
+ }
+ if (leader_sequence_two_keys(KC_T, KC_Y)) {
+ SEND_STRING("Thank you!");
+ did_leader_succeed = true;
+ }
- leader_end();
+ if (leader_sequence_one_key(KC_X)) {
+ SEND_STRING("()"SS_TAP(X_LEFT));
+ did_leader_succeed = true;
+ }
+ if (leader_sequence_two_keys(KC_X, KC_X)) {
+ SEND_STRING("(");
+ did_leader_succeed = true;
+ }
+ if (leader_sequence_three_keys(KC_X, KC_X, KC_X)) {
+ SEND_STRING(")");
+ did_leader_succeed = true;
}
-}
-void leader_start_user(void) {
-#ifdef AUDIO_ENABLE
- PLAY_SONG(leader_start_song);
-#endif
-}
+ if (leader_sequence_one_key(KC_Z)) {
+ SEND_STRING("[]"SS_TAP(X_LEFT));
+ did_leader_succeed = true;
+ }
+ if (leader_sequence_two_keys(KC_Z, KC_Z)) {
+ SEND_STRING("[");
+ did_leader_succeed = true;
+ }
+ if (leader_sequence_three_keys(KC_Z, KC_Z, KC_Z)) {
+ SEND_STRING("]");
+ did_leader_succeed = true;
+ }
-void leader_end_user(void) {
if (did_leader_succeed) {
#ifdef AUDIO_ENABLE
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) {
}
bool leader_found;
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_found = false;
- SEQ_ONE_KEY(L_RESET) {
- leader_found = true;
- reset_keyboard();
- }
- else
- SEQ_ONE_KEY(KC_DEL) {
- leader_found = true;
- layer_clear();
- }
- else
- SEQ_ONE_KEY(LOWER) {
- leader_found = true;
- layer_on(_LOWER);
- }
- else
- SEQ_ONE_KEY(RAISE) {
- leader_found = true;
- layer_on(_RAISE);
- }
- leader_end();
- }
-}
void leader_end_user(void) {
+ leader_found = false;
+
+ if (leader_sequence_one_key(L_RESET)) {
+ leader_found = true;
+ reset_keyboard();
+ } else if (leader_sequence_one_key(KC_DEL)) {
+ leader_found = true;
+ layer_clear();
+ } else if (leader_sequence_one_key(LOWER)) {
+ leader_found = true;
+ layer_on(_LOWER);
+ } else if (leader_sequence_one_key(RAISE)) {
+ leader_found = true;
+ layer_on(_RAISE);
+ }
+
// Plays sound on if leader sequence found.
if (leader_found) {
#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) {
return true;
}
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- // Cancel task CTRL+C
- SEQ_ONE_KEY(KC_C) { tap_code16(C(KC_C)); }
- // copy
- SEQ_ONE_KEY(KC_Y) { tap_code16(G(KC_C)); }
- // cut
- SEQ_ONE_KEY(KC_X) { tap_code16(G(KC_X)); }
- // paste
- SEQ_ONE_KEY(KC_P) { tap_code16(G(KC_V)); }
- // undo
- SEQ_ONE_KEY(KC_U) { tap_code16(G(KC_Z)); }
- // redo
- SEQ_ONE_KEY(KC_R) { tap_code16(S(G(KC_Z))); }
- // delete line
- SEQ_TWO_KEYS(KC_D, KC_D) {
- register_code(KC_LGUI);
+void leader_end_user(void) {
+ // Cancel task CTRL+C
+ if (leader_sequence_one_key(KC_C)) {
+ tap_code16(C(KC_C));
+ }
+ // copy
+ if (leader_sequence_one_key(KC_Y)) {
+ tap_code16(G(KC_C));
+ }
+ // cut
+ if (leader_sequence_one_key(KC_X)) {
+ tap_code16(G(KC_X));
+ }
+ // paste
+ if (leader_sequence_one_key(KC_P)) {
+ tap_code16(G(KC_V));
+ }
+ // undo
+ if (leader_sequence_one_key(KC_U)) {
+ tap_code16(G(KC_Z));
+ }
+ // redo
+ if (leader_sequence_one_key(KC_R)) {
+ tap_code16(S(G(KC_Z)));
+ }
+ // delete line
+ if (leader_sequence_two_keys(KC_D, KC_D)) {
+ register_code(KC_LGUI);
- tap_code(KC_RIGHT);
+ tap_code(KC_RIGHT);
- tap_code(KC_BACKSPACE);
+ tap_code(KC_BACKSPACE);
- unregister_code(KC_LGUI);
- }
- // go to the beginning of the string
- SEQ_ONE_KEY(KC_H) { tap_code16(G(KC_LEFT)); }
- // go to the end of the string
- SEQ_ONE_KEY(KC_L) { tap_code16(G(KC_RIGHT)); }
+ unregister_code(KC_LGUI);
+ }
+ // go to the beginning of the string
+ if (leader_sequence_one_key(KC_H)) {
+ tap_code16(G(KC_LEFT));
}
+ // go to the end of the string
+ if (leader_sequence_one_key(KC_L)) {
+ tap_code16(G(KC_RIGHT));
+ }
+}
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) {
return true;
}
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY(KC_F) { // Shift + Ctrl + F
- tap_code16(S(C(KC_F)));
- }
+void leader_end_user(void) {
+ if (leader_sequence_one_key(KC_F)) { // Shift + Ctrl + F
+ tap_code16(S(C(KC_F)));
}
}
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] = {
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
};
-LEADER_EXTERNS();
-
void keyboard_post_init_user(void) {
led_t led_state = host_keyboard_led_state();
if (!led_state.num_lock) {
@@ -44,25 +42,20 @@ layer_state_t layer_state_set_user(layer_state_t state) {
return update_tri_layer_state(state, _SYMBOLS, _NUMBERS, _SPECIALS);
}
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- // Lock screen (macOS)
- SEQ_ONE_KEY(KC_ESC) {
- tap_code16(LCTL(LGUI(KC_Q)));
- }
+void leader_end_user(void) {
+ // Lock screen (macOS)
+ if (leader_sequence_one_key(KC_ESC)) {
+ tap_code16(LCTL(LGUI(KC_Q)));
+ }
- // Escape-Shift-Z-Z (VIM)
- SEQ_ONE_KEY(KC_Z) {
- SEND_STRING(SS_TAP(X_ESC) SS_LSFT("zz"));
- }
+ // Escape-Shift-Z-Z (VIM)
+ if (leader_sequence_one_key(KC_Z)) {
+ SEND_STRING(SS_TAP(X_ESC) SS_LSFT("zz"));
+ }
- // Dead grave accent (macOS)
- SEQ_ONE_KEY(KC_E) {
- tap_code16(LALT(KC_GRAVE));
- }
+ // Dead grave accent (macOS)
+ if (leader_sequence_one_key(KC_E)) {
+ tap_code16(LALT(KC_GRAVE));
}
}
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) {
return true;
};
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
+void leader_end_user(void) {
+ // Set current OS indicator to macOs
+ if (leader_sequence_one_key(KC_M)) {
+ user_config.osIsWindows = false;
+ eeconfig_update_user(user_config.raw);
+ }
- // Set current OS indicator to macOs
- SEQ_ONE_KEY(KC_M) {
- user_config.osIsWindows = false;
- eeconfig_update_user(user_config.raw);
- }
+ // Set current OS indicator to Windows
+ if (leader_sequence_one_key(KC_W)) {
+ user_config.osIsWindows = true;
+ eeconfig_update_user(user_config.raw);
+ }
- // Set current OS indicator to Windows
- SEQ_ONE_KEY(KC_W) {
- user_config.osIsWindows = true;
- eeconfig_update_user(user_config.raw);
- }
-
- // Screenshot
- SEQ_ONE_KEY(KC_S) {
- if (user_config.osIsWindows == 1) {
- tap_code16(S(G(KC_S)));
- } else if (user_config.osIsWindows == 0) {
- tap_code16(S(G(KC_4)));
- }
+ // Screenshot
+ if (leader_sequence_one_key(KC_S)) {
+ if (user_config.osIsWindows == 1) {
+ tap_code16(S(G(KC_S)));
+ } else if (user_config.osIsWindows == 0) {
+ tap_code16(S(G(KC_4)));
}
+ }
- // Video
- SEQ_ONE_KEY(KC_V) {
- if (user_config.osIsWindows == 0) {
- tap_code16(S(G(KC_5)));
- }
+ // Video
+ if (leader_sequence_one_key(KC_V)) {
+ if (user_config.osIsWindows == 0) {
+ tap_code16(S(G(KC_5)));
}
+ }
- // Sleep
- SEQ_ONE_KEY(KC_P) {
- if (user_config.osIsWindows == 1) {
- SEND_STRING(SS_LGUI("x") "u" "h");
- } else if (user_config.osIsWindows == 0) {
- tap_code16(A(G(KC_PWR)));
- }
+ // Sleep
+ if (leader_sequence_one_key(KC_P)) {
+ if (user_config.osIsWindows == 1) {
+ SEND_STRING(SS_LGUI("x") "u" "h");
+ } else if (user_config.osIsWindows == 0) {
+ tap_code16(A(G(KC_PWR)));
}
}
}
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] = {
),
};
+void leader_end_user(void) {
+ if (leader_sequence_one_key(KC_A)) {
+ tap_code16(SGUI(KC_L));
+ }
+ if (leader_sequence_two_keys(KC_S, KC_S)) {
+ tap_code16(SGUI(KC_5));
+ }
+}
+
bool is_cmd_tab_active = false;
uint16_t cmd_tab_timer = 0;
-LEADER_EXTERNS();
-
void matrix_scan_user(void) {
if (is_cmd_tab_active) {
if (timer_elapsed(cmd_tab_timer) > 1000) {
@@ -68,18 +75,6 @@ void matrix_scan_user(void) {
is_cmd_tab_active = false;
}
}
-
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY(KC_A) {
- tap_code16(SGUI(KC_L));
- }
- SEQ_TWO_KEYS(KC_S, KC_S) {
- tap_code16(SGUI(KC_5));
- }
- }
}
#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] = {
),
};
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY(KC_A) {
- tap_code16(SGUI(KC_L));
- }
- SEQ_TWO_KEYS(KC_S, KC_S) {
- tap_code16(SGUI(KC_5));
- }
+void leader_end_user(void) {
+ if (leader_sequence_one_key(KC_A)) {
+ tap_code16(SGUI(KC_L));
+ }
+ if (leader_sequence_two_keys(KC_S, KC_S)) {
+ tap_code16(SGUI(KC_5));
}
}
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) {
}
#endif
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
- // Sway navigation
- SEQ_ONE_KEY(KC_Q) { // Jump to workspace 1
- SEND_STRING(SS_LGUI("1"));
- }
- SEQ_ONE_KEY(KC_W) { // Jump to workspace 2
- SEND_STRING(SS_LGUI("2"));
- }
- SEQ_ONE_KEY(KC_E) { // Jump to workspace 3
- SEND_STRING(SS_LGUI("3"));
- }
- SEQ_ONE_KEY(KC_R) { // Jump to workspace 4
- SEND_STRING(SS_LGUI("4"));
- }
- SEQ_ONE_KEY(KC_T) { // Jump to workspace 5
- SEND_STRING(SS_LGUI("5"));
- }
+void leader_end_user(void) {
+ // Sway navigation
+ if (leader_sequence_one_key(KC_Q)) { // Jump to workspace 1
+ SEND_STRING(SS_LGUI("1"));
+ }
+ if (leader_sequence_one_key(KC_W)) { // Jump to workspace 2
+ SEND_STRING(SS_LGUI("2"));
+ }
+ if (leader_sequence_one_key(KC_E)) { // Jump to workspace 3
+ SEND_STRING(SS_LGUI("3"));
+ }
+ if (leader_sequence_one_key(KC_R)) { // Jump to workspace 4
+ SEND_STRING(SS_LGUI("4"));
+ }
+ if (leader_sequence_one_key(KC_T)) { // Jump to workspace 5
+ SEND_STRING(SS_LGUI("5"));
+ }
- SEQ_ONE_KEY(KC_Y) { // Jump to workspace 6
- SEND_STRING(SS_LGUI("6"));
- }
- SEQ_ONE_KEY(KC_U) { // Jump to workspace 7
- SEND_STRING(SS_LGUI("7"));
- }
- SEQ_ONE_KEY(KC_I) { // Jump to workspace 8
- SEND_STRING(SS_LGUI("8"));
- }
- SEQ_ONE_KEY(KC_O) { // Jump to workspace 9
- SEND_STRING(SS_LGUI("9"));
- }
- SEQ_ONE_KEY(KC_P) { // Jump to workspace 0
- SEND_STRING(SS_LGUI("0"));
- }
- SEQ_ONE_KEY(KC_G) { // View scratch pad
- SEND_STRING(SS_LGUI("-"));
- }
+ if (leader_sequence_one_key(KC_Y)) { // Jump to workspace 6
+ SEND_STRING(SS_LGUI("6"));
+ }
+ if (leader_sequence_one_key(KC_U)) { // Jump to workspace 7
+ SEND_STRING(SS_LGUI("7"));
+ }
+ if (leader_sequence_one_key(KC_I)) { // Jump to workspace 8
+ SEND_STRING(SS_LGUI("8"));
+ }
+ if (leader_sequence_one_key(KC_O)) { // Jump to workspace 9
+ SEND_STRING(SS_LGUI("9"));
+ }
+ if (leader_sequence_one_key(KC_P)) { // Jump to workspace 0
+ SEND_STRING(SS_LGUI("0"));
+ }
+ if (leader_sequence_one_key(KC_G)) { // View scratch pad
+ SEND_STRING(SS_LGUI("-"));
+ }
- // Sway move window
- SEQ_TWO_KEYS(KC_M, KC_Q) { // Move to workspace 1
- SEND_STRING(SS_LSFT(SS_LGUI("1")));
- }
- SEQ_TWO_KEYS(KC_M, KC_W) { // Move to workspace 2
- SEND_STRING(SS_LSFT(SS_LGUI("2")));
- }
- SEQ_TWO_KEYS(KC_M, KC_E) { // Move to workspace 3
- SEND_STRING(SS_LSFT(SS_LGUI("3")));
- }
- SEQ_TWO_KEYS(KC_M, KC_R) { // Move to workspace 4
- SEND_STRING(SS_LSFT(SS_LGUI("4")));
- }
- SEQ_TWO_KEYS(KC_M, KC_T) { // Move to workspace 5
- SEND_STRING(SS_LSFT(SS_LGUI("5")));
- }
+ // Sway move window
+ if (leader_sequence_two_keys(KC_M, KC_Q)) { // Move to workspace 1
+ SEND_STRING(SS_LSFT(SS_LGUI("1")));
+ }
+ if (leader_sequence_two_keys(KC_M, KC_W)) { // Move to workspace 2
+ SEND_STRING(SS_LSFT(SS_LGUI("2")));
+ }
+ if (leader_sequence_two_keys(KC_M, KC_E)) { // Move to workspace 3
+ SEND_STRING(SS_LSFT(SS_LGUI("3")));
+ }
+ if (leader_sequence_two_keys(KC_M, KC_R)) { // Move to workspace 4
+ SEND_STRING(SS_LSFT(SS_LGUI("4")));
+ }
+ if (leader_sequence_two_keys(KC_M, KC_T)) { // Move to workspace 5
+ SEND_STRING(SS_LSFT(SS_LGUI("5")));
+ }
- SEQ_TWO_KEYS(KC_M, KC_Y) { // Move to workspace 6
- SEND_STRING(SS_LSFT(SS_LGUI("6")));
- }
- SEQ_TWO_KEYS(KC_M, KC_U) { // Move to workspace 7
- SEND_STRING(SS_LSFT(SS_LGUI("7")));
- }
- SEQ_TWO_KEYS(KC_M, KC_I) { // Move to workspace 8
- SEND_STRING(SS_LSFT(SS_LGUI("8")));
- }
- SEQ_TWO_KEYS(KC_M, KC_O) { // Move to workspace 9
- SEND_STRING(SS_LSFT(SS_LGUI("9")));
- }
- SEQ_TWO_KEYS(KC_M, KC_P) { // Move to workspace 0
- SEND_STRING(SS_LSFT(SS_LGUI("0")));
- }
- SEQ_TWO_KEYS(KC_M, KC_G) { // Move to scratch pad
- SEND_STRING(SS_LSFT(SS_LGUI("-")));
- }
+ if (leader_sequence_two_keys(KC_M, KC_Y)) { // Move to workspace 6
+ SEND_STRING(SS_LSFT(SS_LGUI("6")));
+ }
+ if (leader_sequence_two_keys(KC_M, KC_U)) { // Move to workspace 7
+ SEND_STRING(SS_LSFT(SS_LGUI("7")));
+ }
+ if (leader_sequence_two_keys(KC_M, KC_I)) { // Move to workspace 8
+ SEND_STRING(SS_LSFT(SS_LGUI("8")));
+ }
+ if (leader_sequence_two_keys(KC_M, KC_O)) { // Move to workspace 9
+ SEND_STRING(SS_LSFT(SS_LGUI("9")));
+ }
+ if (leader_sequence_two_keys(KC_M, KC_P)) { // Move to workspace 0
+ SEND_STRING(SS_LSFT(SS_LGUI("0")));
+ }
+ if (leader_sequence_two_keys(KC_M, KC_G)) { // Move to scratch pad
+ SEND_STRING(SS_LSFT(SS_LGUI("-")));
}
}
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) {
return true;
}
+void leader_end_user(void) {
+ if (leader_sequence_one_key(KC_C)) { // Inline Code
+ SEND_STRING("`` " SS_TAP(X_LEFT) SS_TAP(X_LEFT));
+ }
+ if (leader_sequence_one_key(KC_P)) { // Invoke Password Manager
+ SEND_STRING(SS_LCTL(SS_LALT("\\")));
+ }
+ if (leader_sequence_one_key(KC_S)) { // Windows screenshot
+ SEND_STRING(SS_LGUI("\nS"));
+ }
+ if (leader_sequence_two_keys(KC_F, KC_P)) { // Fusion Projection prefix
+ SEND_STRING("[Projection] ");
+ }
+ if (leader_sequence_two_keys(KC_B, KC_B)) { // Basecone invoice description
+ SEND_STRING("[Leveranciersnaam] [Factuurnummer]");
+ }
+ if (leader_sequence_two_keys(KC_E, KC_S)) { // Support email splitkb
+ SEND_STRING("support@splitkb.com");
+ }
+ if (leader_sequence_two_keys(KC_E, KC_T)) { // Email splitkb
+ SEND_STRING("thomas@splitkb.com");
+ }
+ if (leader_sequence_two_keys(KC_E, KC_P)) { // Email personal
+ SEND_STRING("mail@thomasbaart.nl");
+ }
+ if (leader_sequence_two_keys(KC_S, KC_D)) { // Splitkb documentation
+ SEND_STRING("https://docs.splitkb.com/");
+ }
+ if (leader_sequence_two_keys(KC_S, KC_V)) { // Splitkb VAT number
+ SEND_STRING("NL210593349B01");
+ }
+ if (leader_sequence_two_keys(KC_B, KC_C)) { // Discord bongocat
+ SEND_STRING(":bongocat:\n");
+ }
+ if (leader_sequence_two_keys(KC_C, KC_B)) { // Discord code block
+ SEND_STRING("```c" SS_LSFT("\n\n") "``` " SS_TAP(X_UP));
+ }
+ if (leader_sequence_two_keys(KC_Y, KC_S)) { // Greeting
+ SEND_STRING("Yours sincerely,\n\nThomas Baart");
+ }
+ if (leader_sequence_three_keys(KC_M, KC_V, KC_G)) { // Greeting
+ SEND_STRING("Met vriendelijke groet,\n\nThomas Baart");
+ }
+}
bool is_alt_tab_active = false;
uint16_t alt_tab_timer = 0;
-LEADER_EXTERNS();
-
void matrix_scan_user(void) {
if (is_alt_tab_active) {
if (timer_elapsed(alt_tab_timer) > 1000) {
@@ -186,54 +228,6 @@ void matrix_scan_user(void) {
is_alt_tab_active = false;
}
}
-
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_ONE_KEY(KC_C) { // Inline Code
- SEND_STRING("`` " SS_TAP(X_LEFT) SS_TAP(X_LEFT));
- }
- SEQ_ONE_KEY(KC_P) { // Invoke Password Manager
- SEND_STRING(SS_LCTL(SS_LALT("\\")));
- }
- SEQ_ONE_KEY(KC_S) { // Windows screenshot
- SEND_STRING(SS_LGUI("\nS"));
- }
- SEQ_TWO_KEYS(KC_F, KC_P) { // Fusion Projection prefix
- SEND_STRING("[Projection] ");
- }
- SEQ_TWO_KEYS(KC_B, KC_B) { // Basecone invoice description
- SEND_STRING("[Leveranciersnaam] [Factuurnummer]");
- }
- SEQ_TWO_KEYS(KC_E, KC_S) { // Support email splitkb
- SEND_STRING("support@splitkb.com");
- }
- SEQ_TWO_KEYS(KC_E, KC_T) { // Email splitkb
- SEND_STRING("thomas@splitkb.com");
- }
- SEQ_TWO_KEYS(KC_E, KC_P) { // Email personal
- SEND_STRING("mail@thomasbaart.nl");
- }
- SEQ_TWO_KEYS(KC_S, KC_D) { // Splitkb documentation
- SEND_STRING("https://docs.splitkb.com/");
- }
- SEQ_TWO_KEYS(KC_S, KC_V) { // Splitkb VAT number
- SEND_STRING("NL210593349B01");
- }
- SEQ_TWO_KEYS(KC_B, KC_C) { // Discord bongocat
- SEND_STRING(":bongocat:\n");
- }
- SEQ_TWO_KEYS(KC_C, KC_B) { // Discord code block
- SEND_STRING("```c" SS_LSFT("\n\n") "``` " SS_TAP(X_UP));
- }
- SEQ_TWO_KEYS(KC_Y, KC_S) { // Greeting
- SEND_STRING("Yours sincerely,\n\nThomas Baart");
- }
- SEQ_THREE_KEYS(KC_M, KC_V, KC_G) { // Greeting
- SEND_STRING("Met vriendelijke groet,\n\nThomas Baart");
- }
- }
}
#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 @@
#define _BL 0
#define _FL 1
-LEADER_EXTERNS();
-
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap _BL: (Base Layer) Default Layer
* ,----------------------------------------------------------------.
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/>.
#ifdef CAPS_WORD_ENABLE
# include "caps_word.h"
#endif
+#ifdef LEADER_ENABLE
+# include "leader.h"
+#endif
static uint32_t last_input_modification_time = 0;
uint32_t last_input_activity_time(void) {
@@ -546,6 +549,10 @@ void quantum_task(void) {
combo_task();
#endif
+#ifdef LEADER_ENABLE
+ leader_task();
+#endif
+
#ifdef WPM_ENABLE
decay_wpm();
#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 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "leader.h"
+#include "timer.h"
+#include "util.h"
+
+#include <string.h>
+
+#ifndef LEADER_TIMEOUT
+# define LEADER_TIMEOUT 300
+#endif
+
+// Leader key stuff
+bool leading = false;
+uint16_t leader_time = 0;
+uint16_t leader_sequence[5] = {0, 0, 0, 0, 0};
+uint8_t leader_sequence_size = 0;
+
+__attribute__((weak)) void leader_start_user(void) {}
+
+__attribute__((weak)) void leader_end_user(void) {}
+
+void leader_start(void) {
+ if (leading) {
+ return;
+ }
+ leader_start_user();
+ leading = true;
+ leader_time = timer_read();
+ leader_sequence_size = 0;
+ memset(leader_sequence, 0, sizeof(leader_sequence));
+}
+
+void leader_end(void) {
+ leading = false;
+ leader_end_user();
+}
+
+void leader_task(void) {
+ if (leader_sequence_active() && leader_sequence_timed_out()) {
+ leader_end();
+ }
+}
+
+bool leader_sequence_active(void) {
+ return leading;
+}
+
+bool leader_sequence_add(uint16_t keycode) {
+ if (leader_sequence_size >= ARRAY_SIZE(leader_sequence)) {
+ return false;
+ }
+
+#if defined(LEADER_NO_TIMEOUT)
+ if (leader_sequence_size == 0) {
+ leader_reset_timer();
+ }
+#endif
+
+ leader_sequence[leader_sequence_size] = keycode;
+ leader_sequence_size++;
+
+ return true;
+}
+
+bool leader_sequence_timed_out(void) {
+#if defined(LEADER_NO_TIMEOUT)
+ return leader_sequence_size > 0 && timer_elapsed(leader_time) > LEADER_TIMEOUT;
+#else
+ return timer_elapsed(leader_time) > LEADER_TIMEOUT;
+#endif
+}
+
+void leader_reset_timer(void) {
+ leader_time = timer_read();
+}
+
+bool leader_sequence_is(uint16_t kc1, uint16_t kc2, uint16_t kc3, uint16_t kc4, uint16_t kc5) {
+ return leader_sequence[0] == kc1 && leader_sequence[1] == kc2 && leader_sequence[2] == kc3 && leader_sequence[3] == kc4 && leader_sequence[4] == kc5;
+}
+
+bool leader_sequence_one_key(uint16_t kc) {
+ return leader_sequence_is(kc, 0, 0, 0, 0);
+}
+
+bool leader_sequence_two_keys(uint16_t kc1, uint16_t kc2) {
+ return leader_sequence_is(kc1, kc2, 0, 0, 0);
+}
+
+bool leader_sequence_three_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3) {
+ return leader_sequence_is(kc1, kc2, kc3, 0, 0);
+}
+
+bool leader_sequence_four_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3, uint16_t kc4) {
+ return leader_sequence_is(kc1, kc2, kc3, kc4, 0);
+}
+
+bool leader_sequence_five_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3, uint16_t kc4, uint16_t kc5) {
+ return leader_sequence_is(kc1, kc2, kc3, kc4, kc5);
+}
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 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <stdbool.h>
+#include <stdint.h>
+
+/**
+ * \defgroup leader
+ *
+ * Leader Key
+ * \{
+ */
+
+/**
+ * \brief User callback, invoked when the leader sequence begins.
+ */
+void leader_start_user(void);
+
+/**
+ * \brief User callback, invoked when the leader sequence ends.
+ */
+void leader_end_user(void);
+
+/**
+ * Begin the leader sequence, resetting the buffer and timer.
+ */
+void leader_start(void);
+
+/**
+ * End the leader sequence.
+ */
+void leader_end(void);
+
+void leader_task(void);
+
+/**
+ * Whether the leader sequence is active.
+ */
+bool leader_sequence_active(void);
+
+/**
+ * Add the given keycode to the sequence buffer.
+ *
+ * If `LEADER_NO_TIMEOUT` is defined, the timer is reset if the buffer is empty.
+ *
+ * \param keycode The keycode to add.
+ *
+ * \return `true` if the keycode was added, `false` if the buffer is full.
+ */
+bool leader_sequence_add(uint16_t keycode);
+
+/**
+ * Whether the leader sequence has reached the timeout.
+ *
+ * If `LEADER_NO_TIMEOUT` is defined, the buffer must also contain at least one key.
+ */
+bool leader_sequence_timed_out(void);
+
+/**
+ * Reset the leader sequence timer.
+ */
+void leader_reset_timer(void);
+
+/**
+ * Check the sequence buffer for the given keycode.
+ *
+ * \param kc The keycode to check.
+ *
+ * \return `true` if the sequence buffer matches.
+ */
+bool leader_sequence_one_key(uint16_t kc);
+
+/**
+ * Check the sequence buffer for the given keycodes.
+ *
+ * \param kc1 The first keycode to check.
+ * \param kc2 The second keycode to check.
+ *
+ * \return `true` if the sequence buffer matches.
+ */
+bool leader_sequence_two_keys(uint16_t kc1, uint16_t kc2);
+
+/**
+ * Check the sequence buffer for the given keycodes.
+ *
+ * \param kc1 The first keycode to check.
+ * \param kc2 The second keycode to check.
+ * \param kc3 The third keycode to check.
+ *
+ * \return `true` if the sequence buffer matches.
+ */
+bool leader_sequence_three_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3);
+
+/**
+ * Check the sequence buffer for the given keycodes.
+ *
+ * \param kc1 The first keycode to check.
+ * \param kc2 The second keycode to check.
+ * \param kc3 The third keycode to check.
+ * \param kc4 The fourth keycode to check.
+ *
+ * \return `true` if the sequence buffer matches.
+ */
+bool leader_sequence_four_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3, uint16_t kc4);
+
+/**
+ * Check the sequence buffer for the given keycodes.
+ *
+ * \param kc1 The first keycode to check.
+ * \param kc2 The second keycode to check.
+ * \param kc3 The third keycode to check.
+ * \param kc4 The fourth keycode to check.
+ * \param kc5 The fifth keycode to check.
+ *
+ * \return `true` if the sequence buffer matches.
+ */
+bool leader_sequence_five_keys(uint16_t kc1, uint16_t kc2, uint16_t kc3, uint16_t kc4, uint16_t kc5);
+
+/** \} */
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 @@
*/
#include "process_leader.h"
-#include <string.h>
+#include "leader.h"
-#ifndef LEADER_TIMEOUT
-# define LEADER_TIMEOUT 300
+bool process_leader(uint16_t keycode, keyrecord_t *record) {
+ if (record->event.pressed) {
+ if (leader_sequence_active() && !leader_sequence_timed_out()) {
+#ifndef LEADER_KEY_STRICT_KEY_PROCESSING
+ if (IS_QK_MOD_TAP(keycode)) {
+ keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode);
+ } else if (IS_QK_LAYER_TAP(keycode)) {
+ keycode = QK_LAYER_TAP_GET_TAP_KEYCODE(keycode);
+ }
#endif
-__attribute__((weak)) void leader_start_user(void) {}
-
-__attribute__((weak)) void leader_end_user(void) {}
-
-// Leader key stuff
-bool leading = false;
-uint16_t leader_time = 0;
-
-uint16_t leader_sequence[5] = {0, 0, 0, 0, 0};
-uint8_t leader_sequence_size = 0;
-
-void leader_start(void) {
- if (leading) {
- return;
- }
- leader_start_user();
- leading = true;
- leader_time = timer_read();
- leader_sequence_size = 0;
- memset(leader_sequence, 0, sizeof(leader_sequence));
-}
+ if (!leader_sequence_add(keycode)) {
+ leader_end();
-void leader_end(void) {
- leader_end_user();
-}
+ return true;
+ }
-bool process_leader(uint16_t keycode, keyrecord_t *record) {
- // Leader key set-up
- if (record->event.pressed) {
- if (leading) {
-#ifndef LEADER_NO_TIMEOUT
- if (timer_elapsed(leader_time) < LEADER_TIMEOUT)
-#endif // LEADER_NO_TIMEOUT
- {
-#ifndef LEADER_KEY_STRICT_KEY_PROCESSING
- if (IS_QK_MOD_TAP(keycode)) {
- keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode);
- } else if (IS_QK_LAYER_TAP(keycode)) {
- keycode = QK_LAYER_TAP_GET_TAP_KEYCODE(keycode);
- }
-#endif // LEADER_KEY_STRICT_KEY_PROCESSING
- if (leader_sequence_size < ARRAY_SIZE(leader_sequence)) {
- leader_sequence[leader_sequence_size] = keycode;
- leader_sequence_size++;
- } else {
- leading = false;
- leader_end_user();
- return true;
- }
#ifdef LEADER_PER_KEY_TIMING
- leader_time = timer_read();
+ leader_reset_timer();
#endif
- return false;
- }
- } else {
- if (keycode == QK_LEADER) {
- leader_start();
- }
+
+ return false;
+ } else if (keycode == QK_LEADER) {
+ leader_start();
}
}
+
return true;
}
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 @@
#include "quantum.h"
bool process_leader(uint16_t keycode, keyrecord_t *record);
-
-void leader_start_user(void);
-void leader_end_user(void);
-
-void leader_start(void);
-void leader_end(void);
-
-#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)
-#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)
-#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)
-#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)
-#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))
-
-#define LEADER_EXTERNS() \
- extern bool leading; \
- extern uint16_t leader_time; \
- extern uint16_t leader_sequence[5]; \
- extern uint8_t leader_sequence_size
-
-#ifdef LEADER_NO_TIMEOUT
-# define LEADER_DICTIONARY() if (leading && leader_sequence_size > 0 && timer_elapsed(leader_time) > LEADER_TIMEOUT)
-#else
-# define LEADER_DICTIONARY() if (leading && timer_elapsed(leader_time) > LEADER_TIMEOUT)
-#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;
#endif
#ifdef LEADER_ENABLE
+# include "leader.h"
# include "process_leader.h"
#endif
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 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#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 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "test_common.h"
+
+#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 @@
+# --------------------------------------------------------------------------------
+# Keep this file, even if it is empty, as a marker that this folder contains tests
+# --------------------------------------------------------------------------------
+
+LEADER_ENABLE = yes
+
+SRC += ../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 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "keyboard_report_util.hpp"
+#include "keycode.h"
+#include "test_common.hpp"
+#include "test_keymap_key.hpp"
+
+using testing::_;
+
+class Leader : public TestFixture {};
+
+TEST_F(Leader, does_not_timeout_until_next_key_pressed) {
+ TestDriver driver;
+
+ auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
+ auto key_a = KeymapKey(0, 1, 0, KC_A);
+
+ set_keymap({key_leader, key_a});
+
+ EXPECT_EQ(leader_sequence_active(), false);
+
+ EXPECT_NO_REPORT(driver);
+ tap_key(key_leader);
+
+ EXPECT_EQ(leader_sequence_active(), true);
+
+ idle_for(1000);
+
+ EXPECT_EQ(leader_sequence_active(), true);
+ EXPECT_EQ(leader_sequence_timed_out(), false);
+
+ EXPECT_REPORT(driver, (KC_1));
+ EXPECT_EMPTY_REPORT(driver);
+ tap_key(key_a);
+
+ EXPECT_EQ(leader_sequence_active(), true);
+ EXPECT_EQ(leader_sequence_timed_out(), false);
+
+ idle_for(300);
+
+ EXPECT_EQ(leader_sequence_active(), false);
+ EXPECT_EQ(leader_sequence_timed_out(), true);
+
+ EXPECT_REPORT(driver, (KC_A));
+ EXPECT_EMPTY_REPORT(driver);
+ tap_key(key_a);
+}
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 @@
+#pragma once
+
+#include "test_common.h"
+
+#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 @@
+# --------------------------------------------------------------------------------
+# Keep this file, even if it is empty, as a marker that this folder contains tests
+# --------------------------------------------------------------------------------
+
+LEADER_ENABLE = yes
+
+SRC += ../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 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "keyboard_report_util.hpp"
+#include "keycode.h"
+#include "test_common.hpp"
+#include "test_keymap_key.hpp"
+
+using testing::_;
+
+class Leader : public TestFixture {};
+
+TEST_F(Leader, does_not_timeout_during_sequence) {
+ TestDriver driver;
+
+ auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
+ auto key_a = KeymapKey(0, 1, 0, KC_A);
+ auto key_b = KeymapKey(0, 2, 0, KC_B);
+ auto key_c = KeymapKey(0, 3, 0, KC_C);
+
+ set_keymap({key_leader, key_a, key_b, key_c});
+
+ tap_key(key_leader);
+
+ EXPECT_NO_REPORT(driver);
+ tap_key(key_a);
+
+ idle_for(150);
+
+ EXPECT_NO_REPORT(driver);
+ tap_key(key_b);
+
+ idle_for(150);
+
+ EXPECT_REPORT(driver, (KC_3));
+ EXPECT_EMPTY_REPORT(driver);
+ tap_key(key_c);
+
+ idle_for(300);
+}
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 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "quantum.h"
+
+void leader_end_user(void) {
+ if (leader_sequence_one_key(KC_A)) {
+ tap_code(KC_1);
+ }
+
+ if (leader_sequence_two_keys(KC_A, KC_B)) {
+ tap_code(KC_2);
+ }
+
+ if (leader_sequence_three_keys(KC_A, KC_B, KC_C)) {
+ tap_code(KC_3);
+ }
+
+ if (leader_sequence_four_keys(KC_A, KC_B, KC_C, KC_D)) {
+ tap_code(KC_4);
+ }
+
+ if (leader_sequence_five_keys(KC_A, KC_B, KC_C, KC_D, KC_E)) {
+ tap_code(KC_5);
+ }
+}
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 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "test_common.h"
+
+#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 @@
+# --------------------------------------------------------------------------------
+# Keep this file, even if it is empty, as a marker that this folder contains tests
+# --------------------------------------------------------------------------------
+
+LEADER_ENABLE = yes
+
+SRC += ../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 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "keyboard_report_util.hpp"
+#include "keycode.h"
+#include "test_common.hpp"
+#include "test_keymap_key.hpp"
+
+using testing::_;
+
+class Leader : public TestFixture {};
+
+TEST_F(Leader, does_not_extract_mod_tap_keycode) {
+ TestDriver driver;
+
+ auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
+ auto key_mt = KeymapKey(0, 1, 0, LSFT_T(KC_A));
+
+ set_keymap({key_leader, key_mt});
+
+ tap_key(key_leader);
+
+ EXPECT_NO_REPORT(driver);
+ tap_key(key_mt);
+
+ EXPECT_EQ(leader_sequence_one_key(KC_A), false);
+ EXPECT_EQ(leader_sequence_one_key(LSFT_T(KC_A)), true);
+}
+
+TEST_F(Leader, does_not_extract_layer_tap_keycode) {
+ TestDriver driver;
+
+ auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
+ auto key_lt = KeymapKey(0, 1, 0, LT(1, KC_A));
+
+ set_keymap({key_leader, key_lt});
+
+ tap_key(key_leader);
+
+ EXPECT_NO_REPORT(driver);
+ tap_key(key_lt);
+
+ EXPECT_EQ(leader_sequence_one_key(KC_A), false);
+ EXPECT_EQ(leader_sequence_one_key(LT(1, KC_A)), true);
+}
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 @@
+# --------------------------------------------------------------------------------
+# Keep this file, even if it is empty, as a marker that this folder contains tests
+# --------------------------------------------------------------------------------
+
+LEADER_ENABLE = yes
+
+SRC += 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 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "keyboard_report_util.hpp"
+#include "keycode.h"
+#include "test_common.hpp"
+#include "test_keymap_key.hpp"
+
+using testing::_;
+
+class Leader : public TestFixture {};
+
+TEST_F(Leader, triggers_one_key_sequence) {
+ TestDriver driver;
+
+ auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
+ auto key_a = KeymapKey(0, 1, 0, KC_A);
+
+ set_keymap({key_leader, key_a});
+
+ EXPECT_EQ(leader_sequence_active(), false);
+
+ EXPECT_NO_REPORT(driver);
+ tap_key(key_leader);
+
+ EXPECT_EQ(leader_sequence_active(), true);
+
+ EXPECT_REPORT(driver, (KC_1));
+ EXPECT_EMPTY_REPORT(driver);
+ tap_key(key_a);
+
+ EXPECT_EQ(leader_sequence_timed_out(), false);
+
+ idle_for(300);
+
+ EXPECT_EQ(leader_sequence_active(), false);
+ EXPECT_EQ(leader_sequence_timed_out(), true);
+
+ EXPECT_REPORT(driver, (KC_A));
+ EXPECT_EMPTY_REPORT(driver);
+ tap_key(key_a);
+}
+
+TEST_F(Leader, triggers_two_key_sequence) {
+ TestDriver driver;
+
+ auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
+ auto key_a = KeymapKey(0, 1, 0, KC_A);
+ auto key_b = KeymapKey(0, 2, 0, KC_B);
+
+ set_keymap({key_leader, key_a, key_b});
+
+ EXPECT_EQ(leader_sequence_active(), false);
+
+ EXPECT_NO_REPORT(driver);
+ tap_key(key_leader);
+
+ EXPECT_EQ(leader_sequence_active(), true);
+
+ EXPECT_REPORT(driver, (KC_2));
+ EXPECT_EMPTY_REPORT(driver);
+ tap_key(key_a);
+ tap_key(key_b);
+
+ EXPECT_EQ(leader_sequence_timed_out(), false);
+
+ idle_for(300);
+
+ EXPECT_EQ(leader_sequence_active(), false);
+ EXPECT_EQ(leader_sequence_timed_out(), true);
+
+ EXPECT_REPORT(driver, (KC_A));
+ EXPECT_EMPTY_REPORT(driver);
+ tap_key(key_a);
+}
+
+TEST_F(Leader, triggers_three_key_sequence) {
+ TestDriver driver;
+
+ auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
+ auto key_a = KeymapKey(0, 1, 0, KC_A);
+ auto key_b = KeymapKey(0, 2, 0, KC_B);
+ auto key_c = KeymapKey(0, 3, 0, KC_C);
+
+ set_keymap({key_leader, key_a, key_b, key_c});
+
+ EXPECT_EQ(leader_sequence_active(), false);
+
+ EXPECT_NO_REPORT(driver);
+ tap_key(key_leader);
+
+ EXPECT_EQ(leader_sequence_active(), true);
+
+ EXPECT_REPORT(driver, (KC_3));
+ EXPECT_EMPTY_REPORT(driver);
+ tap_key(key_a);
+ tap_key(key_b);
+ tap_key(key_c);
+
+ EXPECT_EQ(leader_sequence_timed_out(), false);
+
+ idle_for(300);
+
+ EXPECT_EQ(leader_sequence_active(), false);
+ EXPECT_EQ(leader_sequence_timed_out(), true);
+
+ EXPECT_REPORT(driver, (KC_A));
+ EXPECT_EMPTY_REPORT(driver);
+ tap_key(key_a);
+}
+
+TEST_F(Leader, triggers_four_key_sequence) {
+ TestDriver driver;
+
+ auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
+ auto key_a = KeymapKey(0, 1, 0, KC_A);
+ auto key_b = KeymapKey(0, 2, 0, KC_B);
+ auto key_c = KeymapKey(0, 3, 0, KC_C);
+ auto key_d = KeymapKey(0, 4, 0, KC_D);
+
+ set_keymap({key_leader, key_a, key_b, key_c, key_d});
+
+ EXPECT_EQ(leader_sequence_active(), false);
+
+ EXPECT_NO_REPORT(driver);
+ tap_key(key_leader);
+
+ EXPECT_EQ(leader_sequence_active(), true);
+
+ EXPECT_REPORT(driver, (KC_4));
+ EXPECT_EMPTY_REPORT(driver);
+ tap_key(key_a);
+ tap_key(key_b);
+ tap_key(key_c);
+ tap_key(key_d);
+
+ EXPECT_EQ(leader_sequence_timed_out(), false);
+
+ idle_for(300);
+
+ EXPECT_EQ(leader_sequence_active(), false);
+ EXPECT_EQ(leader_sequence_timed_out(), true);
+
+ EXPECT_REPORT(driver, (KC_A));
+ EXPECT_EMPTY_REPORT(driver);
+ tap_key(key_a);
+}
+
+TEST_F(Leader, triggers_five_key_sequence) {
+ TestDriver driver;
+
+ auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
+ auto key_a = KeymapKey(0, 1, 0, KC_A);
+ auto key_b = KeymapKey(0, 2, 0, KC_B);
+ auto key_c = KeymapKey(0, 3, 0, KC_C);
+ auto key_d = KeymapKey(0, 4, 0, KC_D);
+ auto key_e = KeymapKey(0, 5, 0, KC_E);
+
+ set_keymap({key_leader, key_a, key_b, key_c, key_d, key_e});
+
+ EXPECT_EQ(leader_sequence_active(), false);
+
+ EXPECT_NO_REPORT(driver);
+ tap_key(key_leader);
+
+ EXPECT_EQ(leader_sequence_active(), true);
+
+ EXPECT_REPORT(driver, (KC_5));
+ EXPECT_EMPTY_REPORT(driver);
+ tap_key(key_a);
+ tap_key(key_b);
+ tap_key(key_c);
+ tap_key(key_d);
+ tap_key(key_e);
+
+ EXPECT_EQ(leader_sequence_timed_out(), false);
+
+ idle_for(300);
+
+ EXPECT_EQ(leader_sequence_active(), false);
+ EXPECT_EQ(leader_sequence_timed_out(), true);
+
+ EXPECT_REPORT(driver, (KC_A));
+ EXPECT_EMPTY_REPORT(driver);
+ tap_key(key_a);
+}
+
+TEST_F(Leader, extracts_mod_tap_keycode) {
+ TestDriver driver;
+
+ auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
+ auto key_mt = KeymapKey(0, 1, 0, LSFT_T(KC_A));
+
+ set_keymap({key_leader, key_mt});
+
+ tap_key(key_leader);
+
+ EXPECT_REPORT(driver, (KC_1));
+ EXPECT_EMPTY_REPORT(driver);
+ tap_key(key_mt);
+
+ EXPECT_EQ(leader_sequence_one_key(KC_A), true);
+
+ idle_for(300);
+}
+
+TEST_F(Leader, extracts_layer_tap_keycode) {
+ TestDriver driver;
+
+ auto key_leader = KeymapKey(0, 0, 0, QK_LEADER);
+ auto key_lt = KeymapKey(0, 1, 0, LT(1, KC_A));
+
+ set_keymap({key_leader, key_lt});
+
+ tap_key(key_leader);
+
+ EXPECT_REPORT(driver, (KC_1));
+ EXPECT_EMPTY_REPORT(driver);
+ tap_key(key_lt);
+
+ EXPECT_EQ(leader_sequence_one_key(KC_A), true);
+
+ idle_for(300);
+}
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;
uint8_t muse_offset = 70;
uint16_t muse_tempo = 50;
-LEADER_EXTERNS();
+void leader_end_user(void) {
+ // reset keyboard to bootloader
+ if (leader_sequence_five_keys(KC_R, KC_E, KC_S, KC_E, KC_T)) {
+ reset_keyboard();
+ }
+}
void matrix_scan_user(void) {
#ifdef AUDIO_ENABLE
@@ -28,15 +33,6 @@ void matrix_scan_user(void) {
}
}
#endif
-
- LEADER_DICTIONARY() {
- leading = false;
- // reset keyboard to bootloader
- SEQ_FIVE_KEYS(KC_R, KC_E, KC_S, KC_E, KC_T) {
- reset_keyboard();
- }
- leader_end();
- }
}
bool 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) {
pri_mod(false);
}
+void leader_end_user(void) {
+ // begin OS functions
+ if (leader_sequence_two_keys(KC_P, KC_B)) {
+ if (current_os == OS_WIN) {
+ long_keystroke(2, (uint16_t[]){KC_LGUI, KC_PAUSE});
+ } else {
+ return;
+ }
+ }
+ if (leader_sequence_two_keys(KC_S, KC_S)) {
+ if (current_os == OS_MAC) {
+ long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_4});
+ } else if (current_os == OS_WIN) {
+ long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_S});
+ } else {
+ return;
+ }
+ }
+ if (leader_sequence_three_keys(KC_C, KC_A, KC_D)) {
+ if (current_os == OS_WIN) {
+ long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_DEL});
+ } else {
+ }
+ }
+ if (leader_sequence_three_keys(KC_C, KC_A, KC_E)) {
+ if (current_os == OS_WIN) {
+ long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_END});
+ } else {
+ }
+ }
+ // end OS functions
+
+ // begin format functions
+ if (leader_sequence_one_key(KC_B)) {
+ surround_type(2, KC_8, true);
+ }
+ if (leader_sequence_one_key(KC_I)) {
+ surround_type(2, KC_MINS, true);
+ }
+ if (leader_sequence_one_key(KC_U)) {
+ surround_type(4, KC_MINS, true);
+ }
+ if (leader_sequence_one_key(KC_S)) {
+ surround_type(4, KC_GRAVE, true);
+ }
+ if (leader_sequence_one_key(KC_C)) {
+ register_unicode(0x00E7); // ç
+ }
+ if (leader_sequence_two_keys(KC_A, KC_V)) {
+ surround_type(2, KC_QUOT, true);
+ pair_surround_type(2, KC_LCBR, true);
+ surround_type(2, KC_SPC, false);
+ }
+ if (leader_sequence_two_keys(KC_M, KC_L)) {
+ pair_surround_type(1, KC_LBRC, false);
+ SEND_STRING("LINK_NAME");
+ tap_code(KC_RGHT);
+ pair_surround_type(1, KC_LPRN, true);
+ pri_mod_keystroke(KC_V);
+ }
+ if (leader_sequence_two_keys(KC_C, KC_C)) {
+ surround_type(2, KC_GRAVE, false);
+ }
+ if (leader_sequence_three_keys(KC_C, KC_C, KC_C)) {
+ surround_type(6, KC_GRAVE, false);
+ }
+ if (leader_sequence_one_key(KC_E)) {
+ register_unicode(0x00E8); // è
+ }
+ if (leader_sequence_two_keys(KC_E, KC_E)) {
+ register_unicode(0x00E9); // é
+ }
+ // end format functions
+
+ // start fancy functions
+ if (leader_sequence_two_keys(KC_V, KC_P)) {
+ SEND_STRING("ggvG}x:set paste\ni");
+ pri_mod_keystroke(KC_V);
+ }
+ if (leader_sequence_three_keys(KC_C, KC_C, KC_ENT)) {
+ surround_type(6, KC_GRAVE, false);
+ pri_mod_keystroke(KC_V);
+ multi_tap(3, KC_RGHT, false);
+ tap_code(KC_ENTER);
+ }
+ if (leader_sequence_three_keys(KC_T, KC_C, KC_ENT)) {
+ multi_tap(3, KC_GRAVE, false);
+ pri_mod_keystroke(KC_V);
+ multi_tap(2, KC_ENTER, false);
+ }
+ // end fancy functions
+
+ // start typing functions
+ if (leader_sequence_two_keys(KC_T, KC_M)) {
+ register_unicode(0x2122); // ™
+ }
+ if (leader_sequence_two_keys(KC_D, KC_D)) {
+ SEND_STRING(".\\Administrator");
+ }
+ if (leader_sequence_three_keys(KC_D, KC_D, KC_D)) {
+ SEND_STRING(".\\Administrator");
+ tap_code(KC_TAB);
+ pri_mod_keystroke(KC_V);
+ tap_code(KC_ENTER);
+ }
+ if (leader_sequence_three_keys(KC_L, KC_O, KC_D)) {
+ send_unicode_string("ಠ__ಠ");
+ }
+ if (leader_sequence_three_keys(KC_M, KC_A, KC_P)) {
+ SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/users/arkag");
+ }
+ if (leader_sequence_two_keys(KC_F, KC_F)) {
+ send_unicode_string("(╯‵Д′)╯彡┻━┻");
+ }
+ if (leader_sequence_three_keys(KC_F, KC_F, KC_F)) {
+ send_unicode_string("┬─┬ノ( º _ º ノ)");
+ }
+ if (leader_sequence_three_keys(KC_L, KC_O, KC_L)) {
+ send_unicode_string("( ͡° ͜ʖ ͡°)");
+ }
+ if (leader_sequence_three_keys(KC_S, KC_S, KC_S)) {
+ send_unicode_string("¯\\_(ツ)_/¯");
+ }
+ // end typing functions
+}
+
void matrix_init_user(void) {
current_os = eeprom_read_byte(EECONFIG_USERSPACE);
set_os(current_os, false);
}
-LEADER_EXTERNS();
-
void matrix_scan_user(void) {
check_state();
flash_rgb();
fade_rgb();
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- // begin OS functions
- SEQ_TWO_KEYS(KC_P, KC_B) {
- if (current_os == OS_WIN) {
- long_keystroke(2, (uint16_t[]){KC_LGUI, KC_PAUSE});
- } else {
- return;
- }
- }
- SEQ_TWO_KEYS(KC_S, KC_S) {
- if (current_os == OS_MAC) {
- long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_4});
- } else if (current_os == OS_WIN) {
- long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_S});
- } else {
- return;
- }
- }
- SEQ_THREE_KEYS(KC_C, KC_A, KC_D) {
- if (current_os == OS_WIN) {
- long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_DEL});
- } else {
- }
- }
- SEQ_THREE_KEYS(KC_C, KC_A, KC_E) {
- if (current_os == OS_WIN) {
- long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_END});
- } else {
- }
- }
- // end OS functions
-
- // begin format functions
- SEQ_ONE_KEY(KC_B) {
- surround_type(2, KC_8, true);
- }
- SEQ_ONE_KEY(KC_I) {
- surround_type(2, KC_MINS, true);
- }
- SEQ_ONE_KEY(KC_U) {
- surround_type(4, KC_MINS, true);
- }
- SEQ_ONE_KEY(KC_S) {
- surround_type(4, KC_GRAVE, true);
- }
- SEQ_ONE_KEY(KC_C) {
- register_unicode(0x00E7); // ç
- }
- SEQ_TWO_KEYS(KC_A, KC_V) {
- surround_type(2, KC_QUOT, true);
- pair_surround_type(2, KC_LCBR, true);
- surround_type(2, KC_SPC, false);
- }
- SEQ_TWO_KEYS(KC_M, KC_L) {
- pair_surround_type(1, KC_LBRC, false);
- SEND_STRING("LINK_NAME");
- tap_code(KC_RGHT);
- pair_surround_type(1, KC_LPRN, true);
- pri_mod_keystroke(KC_V);
- }
- SEQ_TWO_KEYS(KC_C, KC_C) {
- surround_type(2, KC_GRAVE, false);
- }
- SEQ_THREE_KEYS(KC_C, KC_C, KC_C) {
- surround_type(6, KC_GRAVE, false);
- }
- SEQ_ONE_KEY(KC_E) {
- register_unicode(0x00E8); // è
- }
- SEQ_TWO_KEYS(KC_E, KC_E) {
- register_unicode(0x00E9); // é
- }
- // end format functions
-
- // start fancy functions
- SEQ_TWO_KEYS(KC_V, KC_P) {
- SEND_STRING("ggvG}x:set paste\ni");
- pri_mod_keystroke(KC_V);
- }
- SEQ_THREE_KEYS(KC_C, KC_C, KC_ENT) {
- surround_type(6, KC_GRAVE, false);
- pri_mod_keystroke(KC_V);
- multi_tap(3, KC_RGHT, false);
- tap_code(KC_ENTER);
- }
- SEQ_THREE_KEYS(KC_T, KC_C, KC_ENT) {
- multi_tap(3, KC_GRAVE, false);
- pri_mod_keystroke(KC_V);
- multi_tap(2, KC_ENTER, false);
- }
- // end fancy functions
-
- // start typing functions
- SEQ_TWO_KEYS(KC_T, KC_M) {
- register_unicode(0x2122); // ™
- }
- SEQ_TWO_KEYS(KC_D, KC_D) {
- SEND_STRING(".\\Administrator");
- }
- SEQ_THREE_KEYS(KC_D, KC_D, KC_D) {
- SEND_STRING(".\\Administrator");
- tap_code(KC_TAB);
- pri_mod_keystroke(KC_V);
- tap_code(KC_ENTER);
- }
- SEQ_THREE_KEYS(KC_L, KC_O, KC_D) {
- send_unicode_string("ಠ__ಠ");
- }
- SEQ_THREE_KEYS(KC_M, KC_A, KC_P) {
- SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/users/arkag");
- }
- SEQ_TWO_KEYS(KC_F, KC_F) {
- send_unicode_string("(╯‵Д′)╯彡┻━┻");
- }
- SEQ_THREE_KEYS(KC_F, KC_F, KC_F) {
- send_unicode_string("┬─┬ノ( º _ º ノ)");
- }
- SEQ_THREE_KEYS(KC_L, KC_O, KC_L) {
- send_unicode_string("( ͡° ͜ʖ ͡°)");
- }
- SEQ_THREE_KEYS(KC_S, KC_S, KC_S) {
- send_unicode_string("¯\\_(ツ)_/¯");
- }
- // end typing functions
-
- }
}
bool 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 @@
-#include "curry.h"
-#include "leader.h"
-
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- static bool has_ran_yet;
- if (!has_ran_yet) {
- has_ran_yet = true;
- startup_user();
- }
-
-#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
- matrix_scan_rgb();
-#endif // RGBLIGHT_ENABLE
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
- SEQ_ONE_KEY(KC_F) { SEND_STRING(SS_LCTL("akf")); } // Select all and format
- SEQ_ONE_KEY(KC_P) { SEND_STRING(SS_LCTL(SS_LSFT("4"))); } // Screenshot region
- SEQ_TWO_KEYS(KC_D, KC_D) { SEND_STRING(SS_LCTL("ac")); } // Copy all
- }
- matrix_scan_keymap();
-}
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 @@
+#include "curry.h"
+#include "leader_user.h"
+
+void leader_end_user(void) {
+ if (leader_sequence_one_key(KC_F)) {
+ // Select all and format
+ SEND_STRING(SS_LCTL("akf"));
+ }
+ if (leader_sequence_one_key(KC_P)) {
+ // Screenshot region
+ SEND_STRING(SS_LCTL(SS_LSFT("4")));
+ }
+ if (leader_sequence_two_keys(KC_D, KC_D)) {
+ // Copy all
+ SEND_STRING(SS_LCTL("ac"));
+ }
+}
+
+void matrix_scan_user(void) {
+ static bool has_ran_yet;
+ if (!has_ran_yet) {
+ has_ran_yet = true;
+ startup_user();
+ }
+
+#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
+ matrix_scan_rgb();
+#endif // RGBLIGHT_ENABLE
+
+ matrix_scan_keymap();
+}
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)
endif
ifeq ($(strip $(LEADER_ENABLE)), yes)
- SRC += leader.c
+ SRC += leader_user.c
endif
ifeq ($(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;
//**************** LEADER *********************//
#ifdef LEADER_ENABLE
-LEADER_EXTERNS();
+void leader_start_user(vodi) {
# ifdef RGBLIGHT_ENABLE
-
-void leader_start_user(void) { rgblight_setrgb_range(5, 100, 199, 10, 15); };
-
-void leader_end_user(void) { rgblight_setrgb_range(200, 200, 255, 10, 15); };
+ rgblight_setrgb_range(5, 100, 199, 10, 15);
# endif
+}
-void matrix_scan_user(void) {
- if (leading && leader_sequence_size > 0 && timer_elapsed(leader_time) > LEADER_TIMEOUT) {
- leading = false;
- SEQ_ONE_KEY(KC_T) { SEND_STRING("``" SS_TAP(X_LEFT)); }
- // Triple ticks
- SEQ_TWO_KEYS(KC_T, KC_T) { SEND_STRING("```" SS_TAP(X_ENTER) SS_TAP(X_ENTER) "```" SS_TAP(X_UP)); }
- // ==== International spanish accent vowels ====
- SEQ_ONE_KEY(KC_A) { SEND_STRING(SS_LALT("e") "a"); }
- SEQ_ONE_KEY(KC_E) { SEND_STRING(SS_LALT("e") "e"); }
- SEQ_ONE_KEY(KC_I) { SEND_STRING(SS_LALT("e") "i"); }
- SEQ_ONE_KEY(KC_O) { SEND_STRING(SS_LALT("e") "o"); }
- SEQ_ONE_KEY(KC_U) { SEND_STRING(SS_LALT("e") "u"); }
- SEQ_ONE_KEY(KC_N) { SEND_STRING(SS_LALT("n") "n"); }
- // ==== MACROS ===
- SEQ_ONE_KEY(KC_G) { SEND_STRING(" | grep "); }
- SEQ_ONE_KEY(KC_K) { onMac ? SEND_STRING(SS_LCTL(" ")) : SEND_STRING(SS_LCTL("f")); }
- // vim delete all
- SEQ_TWO_KEYS(KC_D, KC_G) {
- if (onMac) {
- SEND_STRING(SS_LGUI("a") SS_TAP(X_D));
- } else {
- SEND_STRING(SS_LCTL("a") SS_TAP(X_D));
- }
+void leader_end_user() {
+ if (leader_sequence_one_key(KC_T)) {
+ SEND_STRING("``" SS_TAP(X_LEFT));
+ }
+ // Triple ticks
+ if (leader_sequence_two_keys(KC_T, KC_T)) {
+ SEND_STRING("```" SS_TAP(X_ENTER) SS_TAP(X_ENTER) "```" SS_TAP(X_UP));
+ }
+ // ==== International spanish accent vowels ====
+ if (leader_sequence_one_key(KC_A)) {
+ SEND_STRING(SS_LALT("e") "a");
+ }
+ if (leader_sequence_one_key(KC_E)) {
+ SEND_STRING(SS_LALT("e") "e");
+ }
+ if (leader_sequence_one_key(KC_I)) {
+ SEND_STRING(SS_LALT("e") "i");
+ }
+ if (leader_sequence_one_key(KC_O)) {
+ SEND_STRING(SS_LALT("e") "o");
+ }
+ if (leader_sequence_one_key(KC_U)) {
+ SEND_STRING(SS_LALT("e") "u");
+ }
+ if (leader_sequence_one_key(KC_N)) {
+ SEND_STRING(SS_LALT("n") "n");
+ }
+ // ==== MACROS ===
+ if (leader_sequence_one_key(KC_G)) {
+ SEND_STRING(" | grep ");
+ }
+ if (leader_sequence_one_key(KC_K)) {
+ onMac ? SEND_STRING(SS_LCTL(" ")) : SEND_STRING(SS_LCTL("f"));
+ }
+ // vim delete all
+ if (leader_sequence_two_keys(KC_D, KC_G)) {
+ if (onMac) {
+ SEND_STRING(SS_LGUI("a") SS_TAP(X_D));
+ } else {
+ SEND_STRING(SS_LCTL("a") SS_TAP(X_D));
}
- // tripe delete!
- SEQ_ONE_KEY(KC_BACKSPACE) { SEND_STRING(SS_TAP(X_BACKSPACE) SS_TAP(X_BACKSPACE) SS_TAP(X_BACKSPACE)); }
- SEQ_TWO_KEYS(KC_P, KC_G) { SEND_STRING("ps -ef | grep "); }
- 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)); }
- // this is a pain to type
- SEQ_TWO_KEYS(KC_S, KC_S) { SEND_STRING("~/.ssh/ "); }
- SEQ_TWO_KEYS(KC_F, KC_T) { SEND_STRING("feat():" SS_TAP(X_LEFT) SS_TAP(X_LEFT)); }
- // ### LAYER CHANGE
- SEQ_ONE_KEY(KC_1) { layer_on(1); }
- // control enter, because yes
- SEQ_ONE_KEY(KC_H) { SEND_STRING(SS_DOWN(X_LCTL) SS_TAP(X_ENTER) SS_UP(X_LCTL)); }
- // paste all
- SEQ_ONE_KEY(KC_P) {
- if (onMac) {
- SEND_STRING(SS_LGUI("a") SS_LGUI("v"));
- } else {
- SEND_STRING(SS_LCTL("a") SS_LCTL("v"));
- }
+ }
+ // tripe delete!
+ if (leader_sequence_one_key(KC_BACKSPACE)) {
+ SEND_STRING(SS_TAP(X_BACKSPACE) SS_TAP(X_BACKSPACE) SS_TAP(X_BACKSPACE));
+ }
+ if (leader_sequence_two_keys(KC_P, KC_G)) {
+ SEND_STRING("ps -ef | grep ");
+ }
+ if (leader_sequence_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));
+ }
+ // this is a pain to type
+ if (leader_sequence_two_keys(KC_S, KC_S)) {
+ SEND_STRING("~/.ssh/ ");
+ }
+ if (leader_sequence_two_keys(KC_F, KC_T)) {
+ SEND_STRING("feat():" SS_TAP(X_LEFT) SS_TAP(X_LEFT));
+ }
+ // ### LAYER CHANGE
+ if (leader_sequence_one_key(KC_1)) {
+ layer_on(1);
+ }
+ // control enter, because yes
+ if (leader_sequence_one_key(KC_H)) {
+ SEND_STRING(SS_DOWN(X_LCTL) SS_TAP(X_ENTER) SS_UP(X_LCTL));
+ }
+ // paste all
+ if (leader_sequence_one_key(KC_P)) {
+ if (onMac) {
+ SEND_STRING(SS_LGUI("a") SS_LGUI("v"));
+ } else {
+ SEND_STRING(SS_LCTL("a") SS_LCTL("v"));
}
- SEQ_THREE_KEYS(KC_M, KC_A, KC_C) {
- onMac = true;
+ }
+ if (leader_sequence_three_keys(KC_M, KC_A, KC_C)) {
+ onMac = true;
# ifdef RGBLIGHT_ENABLE
- rgblight_setrgb(255, 255, 255);
+ rgblight_setrgb(255, 255, 255);
# endif
- }
- SEQ_THREE_KEYS(KC_W, KC_I, KC_N) {
- onMac = false;
+ }
+ if (leader_sequence_three_keys(KC_W, KC_I, KC_N)) {
+ onMac = false;
# ifdef RGBLIGHT_ENABLE
- rgblight_setrgb(255, 255, 0);
+ rgblight_setrgb(255, 255, 0);
# endif
+ }
+ /* Copy all */
+ if (leader_sequence_one_key(KC_Y)) {
+ if (onMac) {
+ SEND_STRING(SS_LGUI("a") SS_LGUI("c"));
+ } else {
+ SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
}
- /* Copy all */
- SEQ_ONE_KEY(KC_Y) {
- if (onMac) {
- SEND_STRING(SS_LGUI("a") SS_LGUI("c"));
- } else {
- SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
- }
- }
- // emoji bar
- SEQ_TWO_KEYS(KC_E, KC_E) { SEND_STRING(SS_DOWN(X_LGUI) SS_LCTL(" ") SS_UP(X_LGUI)); }
-
- SEQ_TWO_KEYS(KC_F, KC_F) { SEND_STRING("ps -ef | grep "); }
- SEQ_TWO_KEYS(KC_H, KC_T) { SEND_STRING("https://"); }
+ }
+ // emoji bar
+ if (leader_sequence_two_keys(KC_E, KC_E)) {
+ SEND_STRING(SS_DOWN(X_LGUI) SS_LCTL(" ") SS_UP(X_LGUI));
+ }
- leader_end();
+ if (leader_sequence_two_keys(KC_F, KC_F)) {
+ SEND_STRING("ps -ef | grep ");
}
+ if (leader_sequence_two_keys(KC_H, KC_T)) {
+ SEND_STRING("https://");
+ }
+
+# ifdef RGBLIGHT_ENABLE
+ rgblight_setrgb_range(200, 200, 255, 10, 15);
+# endif
}
#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) {}
__attribute__((weak)) void leader_scan_secrets(void) {}
#ifdef LEADER_ENABLE
- LEADER_EXTERNS();
- void matrix_scan_leader(void) {
- static uint8_t mods = 0;
- mods = get_mods();
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
- clear_mods();
-
- // Website Refresh / XCode "Run"
- SEQ_ONE_KEY(KC_R) {
- SEND_STRING(SS_LGUI("r"));
- }
-
- SEQ_TWO_KEYS(KC_B, KC_D) {
- send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " Built at: " QMK_BUILDDATE), TAP_CODE_DELAY);
- }
-
- SEQ_TWO_KEYS(KC_L, KC_C) {
- send_string_with_delay("/** */", TAP_CODE_DELAY);
- wait_ms(TAPPING_TERM);
- tap_code(KC_LEFT);
- tap_code(KC_LEFT);
- tap_code(KC_LEFT);
- if (!(mods & MOD_MASK_SHIFT)) {
- tap_code(KC_ENT);
- }
- }
-
- set_mods(mods);
- #ifndef NO_SECRETS
- leader_scan_secrets();
- #endif // !NO_SECRETS
+void leader_end_user(void) {
+ static uint8_t mods = 0;
+ mods = get_mods();
+ clear_mods();
+
+ // Website Refresh / XCode "Run"
+ if (leader_sequence_one_key(KC_R)) {
+ SEND_STRING(SS_LGUI("r"));
+ }
+
+ if (leader_sequence_two_keys(KC_B, KC_D)) {
+ send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " Built at: " QMK_BUILDDATE), TAP_CODE_DELAY);
+ }
+
+ if (leader_sequence_two_keys(KC_L, KC_C)) {
+ send_string_with_delay("/** */", TAP_CODE_DELAY);
+ wait_ms(TAPPING_TERM);
+ tap_code(KC_LEFT);
+ tap_code(KC_LEFT);
+ tap_code(KC_LEFT);
+ if (!(mods & MOD_MASK_SHIFT)) {
+ tap_code(KC_ENT);
}
}
+
+ set_mods(mods);
+ #ifndef NO_SECRETS
+ leader_scan_secrets();
+ #endif // !NO_SECRETS
+}
#endif
static bool is_first_run = true;
@@ -66,9 +61,7 @@ void matrix_scan_user(void) {
is_first_run = false;
startup_user();
}
- #ifdef LEADER_ENABLE
- matrix_scan_leader();
- #endif
+
matrix_scan_keymap();
}
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) {
SEND_STRING("z");
}
-LEADER_EXTERNS();
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- // Available seqs
- // SEQ_ONE_KEY, SEQ_TWO_KEYS, SEQ_THREE_KEYS
- // anything you can do in a macro https://docs.qmk.fm/macros.html
- // https://docs.qmk.fm/feature_leader_key.html
-
- // Stop music and lock computer via alfred
- SEQ_ONE_KEY(KC_H) {
- SEND_STRING(SS_LGUI(" ") SS_TAP(X_LGUI) "afk" SS_TAP(X_ENTER));
- }
-
- // Stop music and lock computer via alfred
- SEQ_TWO_KEYS(KC_H, KC_H) {
- SEND_STRING(SS_LGUI(" ") SS_TAP(X_LGUI) "afk" SS_TAP(X_ENTER) SS_TAP(X_MEDIA_PLAY_PAUSE));
- }
-
- // Whole Screen Shot
- SEQ_ONE_KEY(KC_A) {
- SEND_STRING(SS_LGUI(SS_LSFT("3")));
- }
-
- // Selective Screen Shot
- SEQ_ONE_KEY(KC_S) {
- SEND_STRING(SS_LGUI(SS_LSFT("4")));
- }
-
- // TMUX - shift to pane 1 and zoom
- SEQ_ONE_KEY(KC_J) {
- tmux_prefix();
- SEND_STRING("q1");
- tmux_pane_zoom();
- }
-
- // TMUX - shift to first window
- SEQ_TWO_KEYS(KC_J, KC_J) {
- tmux_prefix();
- SEND_STRING("1");
- }
-
- // TMUX - shift to pane 2 and zoom
- SEQ_ONE_KEY(KC_K) {
- tmux_prefix();
- SEND_STRING("q2");
- tmux_pane_zoom();
- }
-
- // TMUX - shift to second window
- SEQ_TWO_KEYS(KC_K, KC_K) {
- tmux_prefix();
- SEND_STRING("2");
- }
-
- // TMUX - shift to pane 3 and zoom
- SEQ_ONE_KEY(KC_L) {
- tmux_prefix();
- SEND_STRING("q3");
- tmux_pane_zoom();
- }
-
- // TMUX - shift to third window
- SEQ_TWO_KEYS(KC_L, KC_L) {
- tmux_prefix();
- SEND_STRING("3");
- }
-
- // TMUX - shift to last pane and zoom
- SEQ_ONE_KEY(KC_SEMICOLON) {
- tmux_prefix();
- SEND_STRING(";");
- tmux_pane_zoom();
- }
+void leader_end_user(void) {
+ // Stop music and lock computer via alfred
+ if (leader_sequence_one_key(KC_H)) {
+ SEND_STRING(SS_LGUI(" ") SS_TAP(X_LGUI) "afk" SS_TAP(X_ENTER));
+ }
+
+ // Stop music and lock computer via alfred
+ if (leader_sequence_two_keys(KC_H, KC_H)) {
+ SEND_STRING(SS_LGUI(" ") SS_TAP(X_LGUI) "afk" SS_TAP(X_ENTER) SS_TAP(X_MEDIA_PLAY_PAUSE));
+ }
+
+ // Whole Screen Shot
+ if (leader_sequence_one_key(KC_A)) {
+ SEND_STRING(SS_LGUI(SS_LSFT("3")));
+ }
+
+ // Selective Screen Shot
+ if (leader_sequence_one_key(KC_S)) {
+ SEND_STRING(SS_LGUI(SS_LSFT("4")));
+ }
+
+ // TMUX - shift to pane 1 and zoom
+ if (leader_sequence_one_key(KC_J)) {
+ tmux_prefix();
+ SEND_STRING("q1");
+ tmux_pane_zoom();
+ }
+
+ // TMUX - shift to first window
+ if (leader_sequence_two_keys(KC_J, KC_J)) {
+ tmux_prefix();
+ SEND_STRING("1");
+ }
+
+ // TMUX - shift to pane 2 and zoom
+ if (leader_sequence_one_key(KC_K)) {
+ tmux_prefix();
+ SEND_STRING("q2");
+ tmux_pane_zoom();
+ }
+
+ // TMUX - shift to second window
+ if (leader_sequence_two_keys(KC_K, KC_K)) {
+ tmux_prefix();
+ SEND_STRING("2");
+ }
+
+ // TMUX - shift to pane 3 and zoom
+ if (leader_sequence_one_key(KC_L)) {
+ tmux_prefix();
+ SEND_STRING("q3");
+ tmux_pane_zoom();
+ }
+
+ // TMUX - shift to third window
+ if (leader_sequence_two_keys(KC_L, KC_L)) {
+ tmux_prefix();
+ SEND_STRING("3");
+ }
+
+ // TMUX - shift to last pane and zoom
+ if (leader_sequence_one_key(KC_SEMICOLON)) {
+ tmux_prefix();
+ SEND_STRING(";");
+ tmux_pane_zoom();
}
}
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 @@
-#include "leader.h"
-#ifdef RGBLIGHT_ENABLE
-extern rgblight_config_t rgblight_config;
-#endif
-bool leader_succeed;
-
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- static bool has_ran_yet;
- if (!has_ran_yet) {
- has_ran_yet = true;
- startup_user();
- }
-#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
-// run_diablo_macro_check();
-#endif
-#ifdef RGBLIGHT_ENABLE
- matrix_scan_rgb();
-#endif
- LEADER_DICTIONARY() {
- leader_succeed = leading = false;
-
- SEQ_ONE_KEY(KC_W) {
- // vim/tmux: Use in command mode in vim: write to file, switch tmux pane in the current session window and repeat the last command
- SEND_STRING(":w" SS_TAP(X_ENTER));
- tmux_pane_switch_repeat();
- leader_succeed = true;
- } else
- SEQ_ONE_KEY(KC_T) {
- // Send the Tmux Prefix
- tmux_prefix();
- leader_succeed = true;
- } else
- SEQ_ONE_KEY(KC_A) {
- // tmux: Send the prefix and press 'right' arrow
- tmux_prefix();
- tap_code(KC_RIGHT);
- leader_succeed = true;
- } else
- SEQ_TWO_KEYS(KC_T, KC_T) {
- // tmux: Send the prefix to a nested session
- tmux_prefix();
- tmux_prefix();
- leader_succeed = true;
- } else
- SEQ_TWO_KEYS(KC_T, KC_R) {
- // tmux: Switch pane and repeat last action
- tmux_pane_switch_repeat();
- leader_succeed = true;
- } else
- SEQ_TWO_KEYS(KC_V, KC_Z){
- // vim: Zoom pane
- tap_code16(LCTL(KC_W));
- tap_code16(LSFT(KC_BSLS));
- leader_succeed = true;
- } else
- SEQ_TWO_KEYS(KC_V, KC_R) {
- // vim: Substitute and place cursor
- SEND_STRING(":%s///g" SS_TAP(X_LEFT));
- tap_code(KC_LEFT);
- tap_code(KC_LEFT);
- leader_succeed = true;
- } else
- SEQ_TWO_KEYS(KC_V, KC_T) {
- // vim: move current pane to new tab
- tap_code16(LCTL(KC_W));
- tap_code16(LSFT(KC_T));
- leader_succeed = true;
- } else
- SEQ_ONE_KEY(KC_R){
- // Toggle RGB Layer indicator
- tap_code16(KC_RGB_T);
- leader_succeed = true;
- } else
- SEQ_ONE_KEY(KC_SPC){
- // One Shot Unicode layer
-//TODO tap_code16(OS_UNI);
- leader_succeed = true;
- } else
- SEQ_TWO_KEYS(KC_SPC, KC_SPC){
- // Toggle _MODS
- tap_code16(TG_MODS);
- leader_succeed = true;
- } else
- SEQ_THREE_KEYS(KC_BSPC, KC_BSPC, KC_BSPC){
- // Reset the keyboard
- reset_keyboard();
- leader_succeed = true;
- }
- leader_end();
- }
-// matrix_scan_keymap();
-}
-
-void leader_start_user(void) {
-#ifdef RGBLIGHT_ENABLE
- rgblight_savebase();
- rgblight_mode_noeeprom(1);
- rgblight_sethsv_noeeprom(HSV_GOLDENROD);
-#endif
-}
-
-void leader_end_user(void) {
-// pick color depending of success /fail
-// fade leader_start from 100 to 0
-// fade new color from 0 to 100 to 0
-// fade old color from 0 to 100
-#ifdef RGBLIGHT_ENABLE
- if (leader_succeed) {
- fadeflash_leds(HSV_GREEN);
- } else {
- fadeflash_leds(HSV_RED);
- }
-#endif
-}
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 @@
+#include "leader_user.h"
+#ifdef RGBLIGHT_ENABLE
+extern rgblight_config_t rgblight_config;
+#endif
+bool leader_succeed;
+
+void matrix_scan_user(void) {
+ static bool has_ran_yet;
+ if (!has_ran_yet) {
+ has_ran_yet = true;
+ startup_user();
+ }
+#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
+// run_diablo_macro_check();
+#endif
+#ifdef RGBLIGHT_ENABLE
+ matrix_scan_rgb();
+#endif
+
+// matrix_scan_keymap();
+}
+
+void leader_start_user(void) {
+#ifdef RGBLIGHT_ENABLE
+ rgblight_savebase();
+ rgblight_mode_noeeprom(1);
+ rgblight_sethsv_noeeprom(HSV_GOLDENROD);
+#endif
+}
+
+void leader_end_user(void) {
+ leader_succeed = false;
+
+ if (leader_sequence_one_key(KC_W)) {
+ // vim/tmux: Use in command mode in vim: write to file, switch tmux pane in the current session window and repeat the last command
+ SEND_STRING(":w" SS_TAP(X_ENTER));
+ tmux_pane_switch_repeat();
+ leader_succeed = true;
+ } else
+ if (leader_sequence_one_key(KC_T)) {
+ // Send the Tmux Prefix
+ tmux_prefix();
+ leader_succeed = true;
+ } else
+ if (leader_sequence_one_key(KC_A)) {
+ // tmux: Send the prefix and press 'right' arrow
+ tmux_prefix();
+ tap_code(KC_RIGHT);
+ leader_succeed = true;
+ } else
+ if (leader_sequence_two_keys(KC_T, KC_T)) {
+ // tmux: Send the prefix to a nested session
+ tmux_prefix();
+ tmux_prefix();
+ leader_succeed = true;
+ } else
+ if (leader_sequence_two_keys(KC_T, KC_R)) {
+ // tmux: Switch pane and repeat last action
+ tmux_pane_switch_repeat();
+ leader_succeed = true;
+ } else
+ if (leader_sequence_two_keys(KC_V, KC_Z)){
+ // vim: Zoom pane
+ tap_code16(LCTL(KC_W));
+ tap_code16(LSFT(KC_BSLS));
+ leader_succeed = true;
+ } else
+ if (leader_sequence_two_keys(KC_V, KC_R)) {
+ // vim: Substitute and place cursor
+ SEND_STRING(":%s///g" SS_TAP(X_LEFT));
+ tap_code(KC_LEFT);
+ tap_code(KC_LEFT);
+ leader_succeed = true;
+ } else
+ if (leader_sequence_two_keys(KC_V, KC_T)) {
+ // vim: move current pane to new tab
+ tap_code16(LCTL(KC_W));
+ tap_code16(LSFT(KC_T));
+ leader_succeed = true;
+ } else
+ if (leader_sequence_one_key(KC_R)){
+ // Toggle RGB Layer indicator
+ tap_code16(KC_RGB_T);
+ leader_succeed = true;
+ } else
+ if (leader_sequence_one_key(KC_SPC)){
+ // One Shot Unicode layer
+//TODO tap_code16(OS_UNI);
+ leader_succeed = true;
+ } else
+ if (leader_sequence_two_keys(KC_SPC, KC_SPC)){
+ // Toggle _MODS
+ tap_code16(TG_MODS);
+ leader_succeed = true;
+ } else
+ if (leader_sequence_three_keys(KC_BSPC, KC_BSPC, KC_BSPC)){
+ // Reset the keyboard
+ reset_keyboard();
+ leader_succeed = true;
+ }
+
+// pick color depending of success /fail
+// fade leader_start from 100 to 0
+// fade new color from 0 to 100 to 0
+// fade old color from 0 to 100
+#ifdef RGBLIGHT_ENABLE
+ if (leader_succeed) {
+ fadeflash_leds(HSV_GREEN);
+ } else {
+ fadeflash_leds(HSV_RED);
+ }
+#endif
+}
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 @@
#pragma once
#include "kuchosauronad0.h"
-#include "leader.h"
+#include "leader_user.h"
void 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}`
## [Leader Key](#leader-key)
To enable set `LEADER_ENABLE = yes` in file *rules.mk*
-|LEADER_DICTIONARY()|program| description |
+|Leader sequence|program| description |
|---|---|---|
| W |vim/tmux| save file, switch pane and repeat last command |
| T |tmux| send default prefix |
@@ -50,7 +50,7 @@ To enable set `LEADER_ENABLE = yes` in file *rules.mk*
|V + T|vim | move current split to its own tab|
|3x Backspace|keyboard| Reset Keyboard |
-`LEADER_DICTIONARY()` is defined in *leader.c*
+Leader sequences are defined in *leader_user.c*
## [Combo Keys](#combo-keys)
To 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){
void fadeflash_leds(uint8_t hue, uint8_t sat, uint8_t val){
// indicate success / fail of a leader sequence
// fade out, set new hue and saturation, fade in, fade out, set old color, fade in
- // this is used in leader.c
+ // this is used in leader_user.c
// TODO: come up with a better name maybe
rgblight_fade_helper(false);
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)
endif
ifeq ($(strip $(LEADER_ENABLE)), yes)
- SRC += leader.c
+ SRC += leader_user.c
endif
ifneq ("$(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) {
eeconfig_update_user(stored_userspace_config.raw);
}
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_TWO_KEYS(KC_F1, KC_L) {
- set_os(_OS_LINUX);
- }
- SEQ_TWO_KEYS(KC_F1, KC_M) {
- set_os(_OS_MACOS);
- }
- SEQ_TWO_KEYS(KC_F1, KC_W) {
- set_os(_OS_WINDOWS);
- }
- SEQ_TWO_KEYS(KC_F1, KC_S) {
- stored_userspace_config.raw = runtime_userspace_config.raw;
- store_userspace_config();
- }
+void leader_end_user(void) {
+ if (leader_sequence_two_keys(KC_F1, KC_L)) {
+ set_os(_OS_LINUX);
+ }
+ if (leader_sequence_two_keys(KC_F1, KC_M)) {
+ set_os(_OS_MACOS);
+ }
+ if (leader_sequence_two_keys(KC_F1, KC_W)) {
+ set_os(_OS_WINDOWS);
+ }
+ if (leader_sequence_two_keys(KC_F1, KC_S)) {
+ stored_userspace_config.raw = runtime_userspace_config.raw;
+ store_userspace_config();
}
}
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) {
}
#ifdef LEADER_ENABLE
-LEADER_EXTERNS();
-
-void matrix_scan_user(void) {
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
+void leader_end_user(void) {
#ifdef UCIS_ENABLE
- SEQ_ONE_KEY(KC_U) {
- ucis_start();
+ if (leader_sequence_one_key(KC_U)) {
+ ucis_start();
}
#endif
- SEQ_ONE_KEY(KC_H) {
- send_unicode_string("ᕕ( ᐛ )ᕗ"); // happy
+ if (leader_sequence_one_key(KC_H)) {
+ send_unicode_string("ᕕ( ᐛ )ᕗ"); // happy
}
- SEQ_ONE_KEY(KC_D) {
- send_unicode_string("ಠ_ಠ"); // disapproval
+ if (leader_sequence_one_key(KC_D)) {
+ send_unicode_string("ಠ_ಠ"); // disapproval
}
- SEQ_ONE_KEY(KC_L) {
- send_unicode_string("( ͡° ͜ʖ ͡°)"); // lenny
+ if (leader_sequence_one_key(KC_L)) {
+ send_unicode_string("( ͡° ͜ʖ ͡°)"); // lenny
}
- SEQ_ONE_KEY(KC_S) {
- send_unicode_string("¯\\_(ツ)_/¯"); // shrug
+ if (leader_sequence_one_key(KC_S)) {
+ send_unicode_string("¯\\_(ツ)_/¯"); // shrug
}
// tableflip (LEADER - TF)
- SEQ_TWO_KEYS(KC_T, KC_F) {
- //set_unicode_input_mode(UNICODE_MODE_LINUX);
- //send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
- send_unicode_string("(╯°□°)╯︵ ┻━┻");
+ if (leader_sequence_two_keys(KC_T, KC_F)) {
+ //set_unicode_input_mode(UNICODE_MODE_LINUX);
+ //send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
+ send_unicode_string("(╯°□°)╯︵ ┻━┻");
}
// untableflip
- SEQ_THREE_KEYS(KC_U, KC_T, KC_F) {
- //set_unicode_input_mode(UNICODE_MODE_LINUX);
- //send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
- send_unicode_string("┬─┬ノ( º _ ºノ)");
+ if (leader_sequence_three_keys(KC_U, KC_T, KC_F)) {
+ //set_unicode_input_mode(UNICODE_MODE_LINUX);
+ //send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
+ send_unicode_string("┬─┬ノ( º _ ºノ)");
}
- }
}
#endif
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 @@
-#include "leader.h"
-
-LEADER_EXTERNS();
-
-// Runs constantly in the background, in a loop.
-void matrix_scan_user(void){
-
-#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
-// run_diablo_macro_check();
-#endif // TAP_DANCE_ENABLE
-
-#ifdef RGBLIGHT_ENABLE
- matrix_scan_rgb();
-#endif // RGBLIGHT_ENABLE
-
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- SEQ_TWO_KEYS(KC_V, KC_Z){
- // vim: Zoom pane
- tap_code16(LCTL(KC_W));
- tap_code16(LSFT(KC_BSLS));
- }
-
- SEQ_TWO_KEYS(KC_V, KC_R) {
- // vim: Substitute and place cursor
- SEND_STRING(":%s///g" SS_TAP(X_LEFT));
- tap_code(KC_LEFT);
- tap_code(KC_LEFT);
- }
-
- SEQ_TWO_KEYS(KC_V, KC_T) {
- // vim: move current pane to new tab
- tap_code16(LCTL(KC_W));
- tap_code16(LSFT(KC_T));
- }
-
- SEQ_THREE_KEYS(KC_BSPC, KC_BSPC, KC_BSPC){
- // Reset the keyboard
- reset_keyboard();
- }
- }
-
- matrix_scan_keymap();
-}
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 @@
+#include "leader_user.h"
+
+void leader_end_user(void) {
+ if (leader_sequence_two_keys(KC_V, KC_Z)){
+ // vim: Zoom pane
+ tap_code16(LCTL(KC_W));
+ tap_code16(LSFT(KC_BSLS));
+ }
+
+ if (leader_sequence_two_keys(KC_V, KC_R)) {
+ // vim: Substitute and place cursor
+ SEND_STRING(":%s///g" SS_TAP(X_LEFT));
+ tap_code(KC_LEFT);
+ tap_code(KC_LEFT);
+ }
+
+ if (leader_sequence_two_keys(KC_V, KC_T)) {
+ // vim: move current pane to new tab
+ tap_code16(LCTL(KC_W));
+ tap_code16(LSFT(KC_T));
+ }
+
+ if (leader_sequence_three_keys(KC_BSPC, KC_BSPC, KC_BSPC)){
+ // Reset the keyboard
+ reset_keyboard();
+ }
+}
+
+// Runs constantly in the background, in a loop.
+void matrix_scan_user(void){
+
+#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
+// run_diablo_macro_check();
+#endif // TAP_DANCE_ENABLE
+
+#ifdef RGBLIGHT_ENABLE
+ matrix_scan_rgb();
+#endif // RGBLIGHT_ENABLE
+
+ matrix_scan_keymap();
+}
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 @@
#pragma once
#include "yet-another-developer.h"
-#include "leader.h"
+#include "leader_user.h"
void 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
ifeq ($(strip $(LEADER_ENABLE)), yes)
- SRC += leader.c
+ SRC += leader_user.c
endif