Refactor Leader key feature (#19632)
Co-authored-by: Drashna Jaelre <drashna@live.com>
This commit is contained in:
parent
d10350cd2c
commit
bbf7a20b33
@ -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:
|
||||
|
||||
```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);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
## Adding Leader Key Support
|
||||
|
||||
To enable Leader Key, add the following line to your keymap's `rules.mk`:
|
||||
Add the following to your `rules.mk`:
|
||||
|
||||
```make
|
||||
LEADER_ENABLE = yes
|
||||
```
|
||||
|
||||
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:
|
||||
Then add the `QK_LEAD` keycode to your keymap.
|
||||
|
||||
## Callbacks :id=callbacks
|
||||
|
||||
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.
|
||||
|
||||
```c
|
||||
LEADER_EXTERNS();
|
||||
void leader_start_user(void) {
|
||||
// Do something when the leader key is pressed
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Per Key Timing on Leader keys
|
||||
## Basic Configuration :id=basic-configuration
|
||||
|
||||
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).
|
||||
### 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
|
||||
#define LEADER_TIMEOUT 350
|
||||
```
|
||||
|
||||
### 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 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) {
|
||||
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 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.
|
||||
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.
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
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.
|
||||
### Strict Key Processing :id=strict-key-processing
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
## Customization
|
||||
This gives a more expected behaviour for most users, however you may want to change this.
|
||||
|
||||
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()`.
|
||||
|
||||
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
|
||||
#define LEADER_KEY_STRICT_KEY_PROCESSING
|
||||
```
|
||||
|
||||
## Example :id=example
|
||||
|
||||
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
|
||||
#ifdef AUDIO_ENABLE
|
||||
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
|
||||
|
||||
void leader_start_user(void) {
|
||||
// sequence started
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_SONG(leader_start_song);
|
||||
#endif
|
||||
}
|
||||
|
||||
void leader_end_user(void) {
|
||||
// sequence ended (no success/failure detection)
|
||||
}
|
||||
```
|
||||
bool did_leader_succeed = false;
|
||||
|
||||
### 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.
|
||||
|
||||
```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);
|
||||
#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.
|
||||
if (leader_sequence_one_key(KC_E)) {
|
||||
SEND_STRING(SS_LCTL(SS_LSFT("t")));
|
||||
did_leader_succeed = true;
|
||||
} else
|
||||
SEQ_TWO_KEYS(KC_E, KC_D) {
|
||||
} else if (leader_sequence_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);
|
||||
#endif
|
||||
}
|
||||
|
||||
void leader_end_user(void) {
|
||||
if (did_leader_succeed) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_SONG(leader_succeed);
|
||||
#endif
|
||||
PLAY_SONG(leader_succeed_song);
|
||||
} else {
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_SONG(leader_fail);
|
||||
#endif
|
||||
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.
|
||||
|
@ -78,43 +78,36 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
)
|
||||
};
|
||||
|
||||
LEADER_EXTERNS();
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
void leader_end_user(void) {
|
||||
// qq, alt+f4 close window
|
||||
SEQ_TWO_KEYS(KC_Q, KC_Q) {
|
||||
if (leader_sequence_two_keys(KC_Q, KC_Q)) {
|
||||
tap_code16(A(KC_F4));
|
||||
}
|
||||
|
||||
// ee, open explorer
|
||||
SEQ_TWO_KEYS(KC_E, KC_E) {
|
||||
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) {
|
||||
if (leader_sequence_two_keys(KC_R, KC_R)) {
|
||||
tap_code16(G(KC_R));
|
||||
}
|
||||
|
||||
// ww, maximize window
|
||||
SEQ_TWO_KEYS(KC_W, KC_W) {
|
||||
if (leader_sequence_two_keys(KC_W, KC_W)) {
|
||||
tap_code16(G(KC_UP));
|
||||
}
|
||||
|
||||
// ss, minimize window
|
||||
SEQ_TWO_KEYS(KC_S, KC_S) {
|
||||
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) {
|
||||
if (leader_sequence_two_keys(KC_SPC, KC_SPC)) {
|
||||
tap_code16(G(KC_D));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
|
@ -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) {
|
||||
|
@ -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 */
|
||||
/* éÉ => 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 */
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
LEADER_EXTERNS();
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,20 +49,9 @@ 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();
|
||||
|
||||
void leader_end_user() {
|
||||
// Close a program in i3wm
|
||||
SEQ_ONE_KEY(KC_Q) {
|
||||
if (leader_sequence_one_key(KC_Q)) {
|
||||
register_code(KC_LGUI);
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_Q);
|
||||
@ -71,7 +60,7 @@ void matrix_scan_user(void) {
|
||||
unregister_code(KC_LGUI);
|
||||
}
|
||||
// Exit i3wm
|
||||
SEQ_ONE_KEY(KC_E) {
|
||||
if (leader_sequence_one_key(KC_E)) {
|
||||
register_code(KC_LGUI);
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_E);
|
||||
@ -80,7 +69,7 @@ void matrix_scan_user(void) {
|
||||
unregister_code(KC_LGUI);
|
||||
}
|
||||
// Copy selected text in suckless terminal
|
||||
SEQ_ONE_KEY(KC_C) {
|
||||
if (leader_sequence_one_key(KC_C)) {
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_C);
|
||||
@ -89,7 +78,7 @@ void matrix_scan_user(void) {
|
||||
unregister_code(KC_LCTL);
|
||||
}
|
||||
// Paste text in suckless terminal
|
||||
SEQ_ONE_KEY(KC_V) {
|
||||
if (leader_sequence_one_key(KC_V)) {
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_V);
|
||||
@ -98,18 +87,18 @@ void matrix_scan_user(void) {
|
||||
unregister_code(KC_LCTL);
|
||||
}
|
||||
// FZF shortcut to fuzzy switch directories
|
||||
SEQ_ONE_KEY(KC_D) {
|
||||
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
|
||||
SEQ_ONE_KEY(KC_K) {
|
||||
if (leader_sequence_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) {
|
||||
if (leader_sequence_one_key(KC_T)) {
|
||||
SEND_STRING("nvim ");
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_T);
|
||||
@ -117,7 +106,7 @@ void matrix_scan_user(void) {
|
||||
unregister_code(KC_LCTL);
|
||||
}
|
||||
// Switch between windows in tmux
|
||||
SEQ_ONE_KEY(KC_L) {
|
||||
if (leader_sequence_one_key(KC_L)) {
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_B);
|
||||
unregister_code(KC_B);
|
||||
@ -125,13 +114,4 @@ void matrix_scan_user(void) {
|
||||
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) {
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
@ -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) {
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_one_key(KC_U)) {
|
||||
SEND_STRING(":luvu:\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -255,22 +255,8 @@ L06 -> <TBD>: UNSPECIFIED
|
||||
|
||||
};
|
||||
|
||||
|
||||
// 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) {
|
||||
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);
|
||||
@ -280,7 +266,7 @@ void matrix_scan_user(void) {
|
||||
unicode_input_start (); register_hex(0xaf); unicode_input_finish();
|
||||
}
|
||||
|
||||
SEQ_ONE_KEY (KC_2) {
|
||||
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);
|
||||
@ -288,5 +274,10 @@ void matrix_scan_user(void) {
|
||||
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);
|
||||
};
|
||||
|
@ -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
|
||||
|
@ -76,68 +76,62 @@ static bool wiggle_mouse;
|
||||
static uint16_t wiggle_timer;
|
||||
static uint16_t next_wiggle;
|
||||
|
||||
|
||||
LEADER_EXTERNS();
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
SEQ_ONE_KEY(QK_LEAD) {
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_one_key(QK_LEAD)) {
|
||||
tap_code(KC_CAPS);
|
||||
}
|
||||
|
||||
SEQ_FOUR_KEYS(KC_I, KC_D, KC_L, KC_E) {
|
||||
if (leader_sequence_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) {
|
||||
if (leader_sequence_two_keys(KC_O, KC_K)) {
|
||||
send_unicode_string("👍");
|
||||
}
|
||||
|
||||
SEQ_THREE_KEYS(KC_S, KC_A, KC_D) {
|
||||
if (leader_sequence_three_keys(KC_S, KC_A, KC_D)) {
|
||||
send_unicode_string("😞");
|
||||
}
|
||||
|
||||
SEQ_FIVE_KEYS(KC_C, KC_H, KC_E, KC_C, KC_K) {
|
||||
if (leader_sequence_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) {
|
||||
if (leader_sequence_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) {
|
||||
if (leader_sequence_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) {
|
||||
if (leader_sequence_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) {
|
||||
if (leader_sequence_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) {
|
||||
if (leader_sequence_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) {
|
||||
if (leader_sequence_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) {
|
||||
if (leader_sequence_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) {
|
||||
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();
|
||||
|
||||
|
@ -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) {
|
||||
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_TWO_KEYS(KC_S, KC_S) {
|
||||
if (leader_sequence_two_keys(KC_S, KC_S)) {
|
||||
SEND_STRING(SS_LCTL("v"));
|
||||
}
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -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) {
|
||||
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");
|
||||
register_code(KC_LSFT);
|
||||
SEND_STRING(".77");
|
||||
unregister_code(KC_LSFT);
|
||||
SEND_STRING("start.duckduckgo.com\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_two_keys(KC_G, KC_P)) {
|
||||
SEND_STRING("git push");
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_G, KC_F, KC_P) {
|
||||
if (leader_sequence_three_keys(KC_G, KC_F, KC_P)) {
|
||||
SEND_STRING("git push --force-with-lease");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
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) {
|
||||
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) {
|
||||
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
|
||||
|
@ -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();
|
||||
|
||||
void leader_end_user(void) {
|
||||
// Screenshot
|
||||
SEQ_ONE_KEY(KC_S) {
|
||||
if (leader_sequence_one_key(KC_S)) {
|
||||
tap_code16(G(C(S(KC_4))));
|
||||
}
|
||||
// Record Screen
|
||||
SEQ_TWO_KEYS(KC_S, KC_S) {
|
||||
if (leader_sequence_two_keys(KC_S, KC_S)) {
|
||||
tap_code16(S(G(KC_5)));
|
||||
}
|
||||
// 1Pass browser
|
||||
SEQ_ONE_KEY(KC_A) {
|
||||
if (leader_sequence_one_key(KC_A)) {
|
||||
tap_code16(G(A(KC_BSLS)));
|
||||
}
|
||||
// 1Pass mini
|
||||
SEQ_TWO_KEYS(KC_A, KC_A) {
|
||||
if (leader_sequence_two_keys(KC_A, KC_A)) {
|
||||
tap_code16(G(KC_BSLS));
|
||||
}
|
||||
// Comment out
|
||||
SEQ_ONE_KEY(KC_F) {
|
||||
if (leader_sequence_one_key(KC_F)) {
|
||||
tap_code16(G(KC_SLSH));
|
||||
}
|
||||
// Spotlight
|
||||
SEQ_ONE_KEY(KC_SPC) {
|
||||
if (leader_sequence_one_key(KC_SPC)) {
|
||||
tap_code16(G(KC_SPC));
|
||||
}
|
||||
// Auto format
|
||||
SEQ_ONE_KEY(KC_ENT) {
|
||||
if (leader_sequence_one_key(KC_ENT)) {
|
||||
tap_code16(S(G(A(KC_F))));
|
||||
}
|
||||
// Focus file tree
|
||||
SEQ_ONE_KEY(KC_TAB) {
|
||||
if (leader_sequence_one_key(KC_TAB)) {
|
||||
tap_code16(G(KC_1));
|
||||
}
|
||||
// Caps-lock
|
||||
SEQ_TWO_KEYS(KC_TAB, KC_TAB) {
|
||||
if (leader_sequence_two_keys(KC_TAB, KC_TAB)) {
|
||||
tap_code16(KC_CAPS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -372,14 +372,8 @@ void music_scale_user(void)
|
||||
|
||||
#endif
|
||||
|
||||
LEADER_EXTERNS();
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
SEQ_ONE_KEY (KC_R) {
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_one_key(KC_R)) {
|
||||
tap_random_base64();
|
||||
tap_random_base64();
|
||||
tap_random_base64();
|
||||
@ -390,21 +384,20 @@ void matrix_scan_user(void) {
|
||||
tap_random_base64();
|
||||
tap_random_base64();
|
||||
}
|
||||
SEQ_ONE_KEY (KC_V) {
|
||||
if (leader_sequence_one_key(KC_V)) {
|
||||
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
|
||||
}
|
||||
SEQ_ONE_KEY(KC_F) {
|
||||
if (leader_sequence_one_key(KC_F)) {
|
||||
SEND_STRING("if yes\n\tpeanut butter\nelse\n\trice snacks");
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_A, KC_S) {
|
||||
if (leader_sequence_two_keys(KC_A, KC_S)) {
|
||||
register_code(KC_H);
|
||||
unregister_code(KC_H);
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_A, KC_S, KC_D) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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();
|
||||
|
@ -158,36 +158,24 @@ void keyboard_post_init_user(void) {
|
||||
}
|
||||
|
||||
bool leader_found;
|
||||
LEADER_EXTERNS();
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
void leader_end_user(void) {
|
||||
leader_found = false;
|
||||
SEQ_ONE_KEY(L_RESET) {
|
||||
|
||||
if (leader_sequence_one_key(L_RESET)) {
|
||||
leader_found = true;
|
||||
reset_keyboard();
|
||||
}
|
||||
else
|
||||
SEQ_ONE_KEY(KC_DEL) {
|
||||
} else if (leader_sequence_one_key(KC_DEL)) {
|
||||
leader_found = true;
|
||||
layer_clear();
|
||||
}
|
||||
else
|
||||
SEQ_ONE_KEY(LOWER) {
|
||||
} else if (leader_sequence_one_key(LOWER)) {
|
||||
leader_found = true;
|
||||
layer_on(_LOWER);
|
||||
}
|
||||
else
|
||||
SEQ_ONE_KEY(RAISE) {
|
||||
} else if (leader_sequence_one_key(RAISE)) {
|
||||
leader_found = true;
|
||||
layer_on(_RAISE);
|
||||
}
|
||||
leader_end();
|
||||
}
|
||||
}
|
||||
|
||||
void leader_end_user(void) {
|
||||
// Plays sound on if leader sequence found.
|
||||
if (leader_found) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
|
@ -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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
if (leader_sequence_one_key(KC_Y)) {
|
||||
tap_code16(C(S(KC_C)));
|
||||
}
|
||||
|
||||
/* Support vim-style paste. */
|
||||
SEQ_ONE_KEY(KC_P) {
|
||||
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) {
|
||||
|
@ -362,112 +362,6 @@ 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
|
||||
|
||||
SEQ_ONE_KEY(KC_C) {
|
||||
SEND_STRING(SS_TAP(X_CAPS));
|
||||
did_leader_succeed = true;
|
||||
}
|
||||
|
||||
SEQ_ONE_KEY(KC_BSPC) {
|
||||
SEND_STRING(SS_TAP(X_DEL));
|
||||
did_leader_succeed = true;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// Html Tags
|
||||
SEQ_TWO_KEYS(KC_H, KC_T) {
|
||||
SEND_STRING("<></>"SS_TAP(X_LEFT));
|
||||
did_leader_succeed = true;
|
||||
}
|
||||
|
||||
SEQ_TWO_KEYS(KC_I, KC_C) {
|
||||
SEND_STRING("In Christ,");
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
leader_end();
|
||||
}
|
||||
}
|
||||
|
||||
void leader_start_user(void) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
@ -476,6 +370,105 @@ void leader_start_user(void) {
|
||||
}
|
||||
|
||||
void leader_end_user(void) {
|
||||
did_leader_succeed = false;
|
||||
|
||||
// tap dance
|
||||
// sort by first key
|
||||
|
||||
if (leader_sequence_one_key(KC_C)) {
|
||||
SEND_STRING(SS_TAP(X_CAPS));
|
||||
did_leader_succeed = true;
|
||||
}
|
||||
|
||||
if (leader_sequence_one_key(KC_BSPC)) {
|
||||
SEND_STRING(SS_TAP(X_DEL));
|
||||
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;
|
||||
}
|
||||
|
||||
// Html Tags
|
||||
if (leader_sequence_two_keys(KC_H, KC_T)) {
|
||||
SEND_STRING("<></>"SS_TAP(X_LEFT));
|
||||
did_leader_succeed = true;
|
||||
}
|
||||
|
||||
if (leader_sequence_two_keys(KC_I, KC_C)) {
|
||||
SEND_STRING("In Christ,");
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (did_leader_succeed) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_SONG(leader_succeed_song);
|
||||
|
@ -168,36 +168,24 @@ void keyboard_post_init_user(void) {
|
||||
}
|
||||
|
||||
bool leader_found;
|
||||
LEADER_EXTERNS();
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
void leader_end_user(void) {
|
||||
leader_found = false;
|
||||
SEQ_ONE_KEY(L_RESET) {
|
||||
|
||||
if (leader_sequence_one_key(L_RESET)) {
|
||||
leader_found = true;
|
||||
reset_keyboard();
|
||||
}
|
||||
else
|
||||
SEQ_ONE_KEY(KC_DEL) {
|
||||
} else if (leader_sequence_one_key(KC_DEL)) {
|
||||
leader_found = true;
|
||||
layer_clear();
|
||||
}
|
||||
else
|
||||
SEQ_ONE_KEY(LOWER) {
|
||||
} else if (leader_sequence_one_key(LOWER)) {
|
||||
leader_found = true;
|
||||
layer_on(_LOWER);
|
||||
}
|
||||
else
|
||||
SEQ_ONE_KEY(RAISE) {
|
||||
} else if (leader_sequence_one_key(RAISE)) {
|
||||
leader_found = true;
|
||||
layer_on(_RAISE);
|
||||
}
|
||||
leader_end();
|
||||
}
|
||||
}
|
||||
|
||||
void leader_end_user(void) {
|
||||
// Plays sound on if leader sequence found.
|
||||
if (leader_found) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
|
@ -92,27 +92,33 @@ 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) {
|
||||
// Cancel task CTRL+C
|
||||
SEQ_ONE_KEY(KC_C) { tap_code16(C(KC_C)); }
|
||||
if (leader_sequence_one_key(KC_C)) {
|
||||
tap_code16(C(KC_C));
|
||||
}
|
||||
// copy
|
||||
SEQ_ONE_KEY(KC_Y) { tap_code16(G(KC_C)); }
|
||||
if (leader_sequence_one_key(KC_Y)) {
|
||||
tap_code16(G(KC_C));
|
||||
}
|
||||
// cut
|
||||
SEQ_ONE_KEY(KC_X) { tap_code16(G(KC_X)); }
|
||||
if (leader_sequence_one_key(KC_X)) {
|
||||
tap_code16(G(KC_X));
|
||||
}
|
||||
// paste
|
||||
SEQ_ONE_KEY(KC_P) { tap_code16(G(KC_V)); }
|
||||
if (leader_sequence_one_key(KC_P)) {
|
||||
tap_code16(G(KC_V));
|
||||
}
|
||||
// undo
|
||||
SEQ_ONE_KEY(KC_U) { tap_code16(G(KC_Z)); }
|
||||
if (leader_sequence_one_key(KC_U)) {
|
||||
tap_code16(G(KC_Z));
|
||||
}
|
||||
// redo
|
||||
SEQ_ONE_KEY(KC_R) { tap_code16(S(G(KC_Z))); }
|
||||
if (leader_sequence_one_key(KC_R)) {
|
||||
tap_code16(S(G(KC_Z)));
|
||||
}
|
||||
// delete line
|
||||
SEQ_TWO_KEYS(KC_D, KC_D) {
|
||||
if (leader_sequence_two_keys(KC_D, KC_D)) {
|
||||
register_code(KC_LGUI);
|
||||
|
||||
tap_code(KC_RIGHT);
|
||||
@ -122,7 +128,11 @@ void matrix_scan_user(void) {
|
||||
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)); }
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@ -171,17 +171,10 @@ 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
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_one_key(KC_F)) { // Shift + Ctrl + F
|
||||
tap_code16(S(C(KC_F)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef OLED_ENABLE
|
||||
|
@ -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,26 +42,21 @@ 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();
|
||||
|
||||
void leader_end_user(void) {
|
||||
// Lock screen (macOS)
|
||||
SEQ_ONE_KEY(KC_ESC) {
|
||||
if (leader_sequence_one_key(KC_ESC)) {
|
||||
tap_code16(LCTL(LGUI(KC_Q)));
|
||||
}
|
||||
|
||||
// Escape-Shift-Z-Z (VIM)
|
||||
SEQ_ONE_KEY(KC_Z) {
|
||||
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) {
|
||||
if (leader_sequence_one_key(KC_E)) {
|
||||
tap_code16(LALT(KC_GRAVE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
||||
|
@ -274,27 +274,21 @@ 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
|
||||
SEQ_ONE_KEY(KC_M) {
|
||||
if (leader_sequence_one_key(KC_M)) {
|
||||
user_config.osIsWindows = false;
|
||||
eeconfig_update_user(user_config.raw);
|
||||
}
|
||||
|
||||
// Set current OS indicator to Windows
|
||||
SEQ_ONE_KEY(KC_W) {
|
||||
if (leader_sequence_one_key(KC_W)) {
|
||||
user_config.osIsWindows = true;
|
||||
eeconfig_update_user(user_config.raw);
|
||||
}
|
||||
|
||||
// Screenshot
|
||||
SEQ_ONE_KEY(KC_S) {
|
||||
if (leader_sequence_one_key(KC_S)) {
|
||||
if (user_config.osIsWindows == 1) {
|
||||
tap_code16(S(G(KC_S)));
|
||||
} else if (user_config.osIsWindows == 0) {
|
||||
@ -303,19 +297,18 @@ void matrix_scan_user(void) {
|
||||
}
|
||||
|
||||
// Video
|
||||
SEQ_ONE_KEY(KC_V) {
|
||||
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 (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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_one_key(KC_A)) {
|
||||
tap_code16(SGUI(KC_L));
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_S, KC_S) {
|
||||
if (leader_sequence_two_keys(KC_S, KC_S)) {
|
||||
tap_code16(SGUI(KC_5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
void leader_end_user(void) {
|
||||
// Sway navigation
|
||||
SEQ_ONE_KEY(KC_Q) { // Jump to workspace 1
|
||||
if (leader_sequence_one_key(KC_Q)) { // Jump to workspace 1
|
||||
SEND_STRING(SS_LGUI("1"));
|
||||
}
|
||||
SEQ_ONE_KEY(KC_W) { // Jump to workspace 2
|
||||
if (leader_sequence_one_key(KC_W)) { // Jump to workspace 2
|
||||
SEND_STRING(SS_LGUI("2"));
|
||||
}
|
||||
SEQ_ONE_KEY(KC_E) { // Jump to workspace 3
|
||||
if (leader_sequence_one_key(KC_E)) { // Jump to workspace 3
|
||||
SEND_STRING(SS_LGUI("3"));
|
||||
}
|
||||
SEQ_ONE_KEY(KC_R) { // Jump to workspace 4
|
||||
if (leader_sequence_one_key(KC_R)) { // Jump to workspace 4
|
||||
SEND_STRING(SS_LGUI("4"));
|
||||
}
|
||||
SEQ_ONE_KEY(KC_T) { // Jump to workspace 5
|
||||
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
|
||||
if (leader_sequence_one_key(KC_Y)) { // Jump to workspace 6
|
||||
SEND_STRING(SS_LGUI("6"));
|
||||
}
|
||||
SEQ_ONE_KEY(KC_U) { // Jump to workspace 7
|
||||
if (leader_sequence_one_key(KC_U)) { // Jump to workspace 7
|
||||
SEND_STRING(SS_LGUI("7"));
|
||||
}
|
||||
SEQ_ONE_KEY(KC_I) { // Jump to workspace 8
|
||||
if (leader_sequence_one_key(KC_I)) { // Jump to workspace 8
|
||||
SEND_STRING(SS_LGUI("8"));
|
||||
}
|
||||
SEQ_ONE_KEY(KC_O) { // Jump to workspace 9
|
||||
if (leader_sequence_one_key(KC_O)) { // Jump to workspace 9
|
||||
SEND_STRING(SS_LGUI("9"));
|
||||
}
|
||||
SEQ_ONE_KEY(KC_P) { // Jump to workspace 0
|
||||
if (leader_sequence_one_key(KC_P)) { // Jump to workspace 0
|
||||
SEND_STRING(SS_LGUI("0"));
|
||||
}
|
||||
SEQ_ONE_KEY(KC_G) { // View scratch pad
|
||||
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
|
||||
if (leader_sequence_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
|
||||
if (leader_sequence_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
|
||||
if (leader_sequence_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
|
||||
if (leader_sequence_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
|
||||
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
|
||||
if (leader_sequence_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
|
||||
if (leader_sequence_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
|
||||
if (leader_sequence_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
|
||||
if (leader_sequence_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
|
||||
if (leader_sequence_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
|
||||
if (leader_sequence_two_keys(KC_M, KC_G)) { // Move to scratch pad
|
||||
SEND_STRING(SS_LSFT(SS_LGUI("-")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
* ,----------------------------------------------------------------.
|
||||
|
@ -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
|
||||
|
101
quantum/leader.c
Normal file
101
quantum/leader.c
Normal file
@ -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);
|
||||
}
|
119
quantum/leader.h
Normal file
119
quantum/leader.h
Normal file
@ -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);
|
||||
|
||||
/** \} */
|
@ -15,71 +15,34 @@
|
||||
*/
|
||||
|
||||
#include "process_leader.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifndef LEADER_TIMEOUT
|
||||
# define LEADER_TIMEOUT 300
|
||||
#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));
|
||||
}
|
||||
|
||||
void leader_end(void) {
|
||||
leader_end_user();
|
||||
}
|
||||
#include "leader.h"
|
||||
|
||||
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
|
||||
{
|
||||
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 // 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();
|
||||
#endif
|
||||
|
||||
if (!leader_sequence_add(keycode)) {
|
||||
leader_end();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef LEADER_PER_KEY_TIMING
|
||||
leader_time = timer_read();
|
||||
leader_reset_timer();
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (keycode == QK_LEADER) {
|
||||
} else if (keycode == QK_LEADER) {
|
||||
leader_start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -93,6 +93,7 @@ extern layer_state_t layer_state;
|
||||
#endif
|
||||
|
||||
#ifdef LEADER_ENABLE
|
||||
# include "leader.h"
|
||||
# include "process_leader.h"
|
||||
#endif
|
||||
|
||||
|
6
tests/leader/config.h
Normal file
6
tests/leader/config.h
Normal file
@ -0,0 +1,6 @@
|
||||
// Copyright 2023 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "test_common.h"
|
8
tests/leader/leader_no_initial_timeout/config.h
Normal file
8
tests/leader/leader_no_initial_timeout/config.h
Normal file
@ -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
|
7
tests/leader/leader_no_initial_timeout/test.mk
Normal file
7
tests/leader/leader_no_initial_timeout/test.mk
Normal file
@ -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
|
@ -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);
|
||||
}
|
5
tests/leader/leader_per_key_timeout/config.h
Normal file
5
tests/leader/leader_per_key_timeout/config.h
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "test_common.h"
|
||||
|
||||
#define LEADER_PER_KEY_TIMING
|
7
tests/leader/leader_per_key_timeout/test.mk
Normal file
7
tests/leader/leader_per_key_timeout/test.mk
Normal file
@ -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
|
@ -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);
|
||||
}
|
26
tests/leader/leader_sequences.c
Normal file
26
tests/leader/leader_sequences.c
Normal file
@ -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);
|
||||
}
|
||||
}
|
8
tests/leader/leader_strict_key_processing/config.h
Normal file
8
tests/leader/leader_strict_key_processing/config.h
Normal file
@ -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
|
7
tests/leader/leader_strict_key_processing/test.mk
Normal file
7
tests/leader/leader_strict_key_processing/test.mk
Normal file
@ -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
|
@ -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);
|
||||
}
|
7
tests/leader/test.mk
Normal file
7
tests/leader/test.mk
Normal file
@ -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
|
224
tests/leader/test_leader.cpp
Normal file
224
tests/leader/test_leader.cpp
Normal file
@ -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);
|
||||
}
|
@ -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;
|
||||
|
@ -303,30 +303,16 @@ void pri_mod_keystroke(uint16_t key) {
|
||||
pri_mod(false);
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
void leader_end_user(void) {
|
||||
// begin OS functions
|
||||
SEQ_TWO_KEYS(KC_P, KC_B) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_S, KC_S) {
|
||||
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) {
|
||||
@ -335,13 +321,13 @@ void matrix_scan_user(void) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_C, KC_A, KC_D) {
|
||||
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 {
|
||||
}
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_C, KC_A, KC_E) {
|
||||
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 {
|
||||
@ -350,59 +336,59 @@ void matrix_scan_user(void) {
|
||||
// end OS functions
|
||||
|
||||
// begin format functions
|
||||
SEQ_ONE_KEY(KC_B) {
|
||||
if (leader_sequence_one_key(KC_B)) {
|
||||
surround_type(2, KC_8, true);
|
||||
}
|
||||
SEQ_ONE_KEY(KC_I) {
|
||||
if (leader_sequence_one_key(KC_I)) {
|
||||
surround_type(2, KC_MINS, true);
|
||||
}
|
||||
SEQ_ONE_KEY(KC_U) {
|
||||
if (leader_sequence_one_key(KC_U)) {
|
||||
surround_type(4, KC_MINS, true);
|
||||
}
|
||||
SEQ_ONE_KEY(KC_S) {
|
||||
if (leader_sequence_one_key(KC_S)) {
|
||||
surround_type(4, KC_GRAVE, true);
|
||||
}
|
||||
SEQ_ONE_KEY(KC_C) {
|
||||
if (leader_sequence_one_key(KC_C)) {
|
||||
register_unicode(0x00E7); // ç
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_A, KC_V) {
|
||||
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);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_M, KC_L) {
|
||||
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);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_C, KC_C) {
|
||||
if (leader_sequence_two_keys(KC_C, KC_C)) {
|
||||
surround_type(2, KC_GRAVE, false);
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_C, KC_C, KC_C) {
|
||||
if (leader_sequence_three_keys(KC_C, KC_C, KC_C)) {
|
||||
surround_type(6, KC_GRAVE, false);
|
||||
}
|
||||
SEQ_ONE_KEY(KC_E) {
|
||||
if (leader_sequence_one_key(KC_E)) {
|
||||
register_unicode(0x00E8); // è
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_E, KC_E) {
|
||||
if (leader_sequence_two_keys(KC_E, KC_E)) {
|
||||
register_unicode(0x00E9); // é
|
||||
}
|
||||
// end format functions
|
||||
|
||||
// start fancy functions
|
||||
SEQ_TWO_KEYS(KC_V, KC_P) {
|
||||
if (leader_sequence_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) {
|
||||
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);
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_T, KC_C, KC_ENT) {
|
||||
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);
|
||||
@ -410,39 +396,48 @@ void matrix_scan_user(void) {
|
||||
// end fancy functions
|
||||
|
||||
// start typing functions
|
||||
SEQ_TWO_KEYS(KC_T, KC_M) {
|
||||
if (leader_sequence_two_keys(KC_T, KC_M)) {
|
||||
register_unicode(0x2122); // ™
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_D, KC_D) {
|
||||
if (leader_sequence_two_keys(KC_D, KC_D)) {
|
||||
SEND_STRING(".\\Administrator");
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_D, KC_D, KC_D) {
|
||||
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);
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_L, KC_O, KC_D) {
|
||||
if (leader_sequence_three_keys(KC_L, KC_O, KC_D)) {
|
||||
send_unicode_string("ಠ__ಠ");
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_M, KC_A, KC_P) {
|
||||
if (leader_sequence_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) {
|
||||
if (leader_sequence_two_keys(KC_F, KC_F)) {
|
||||
send_unicode_string("(╯‵Д′)╯彡┻━┻");
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_F, KC_F, KC_F) {
|
||||
if (leader_sequence_three_keys(KC_F, KC_F, KC_F)) {
|
||||
send_unicode_string("┬─┬ノ( º _ º ノ)");
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_L, KC_O, KC_L) {
|
||||
if (leader_sequence_three_keys(KC_L, KC_O, KC_L)) {
|
||||
send_unicode_string("( ͡° ͜ʖ ͡°)");
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_S, KC_S, KC_S) {
|
||||
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);
|
||||
}
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
check_state();
|
||||
flash_rgb();
|
||||
fade_rgb();
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
|
@ -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();
|
||||
}
|
31
users/curry/leader_user.c
Normal file
31
users/curry/leader_user.c
Normal file
@ -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();
|
||||
}
|
@ -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)
|
||||
|
@ -4,32 +4,48 @@ 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)); }
|
||||
void leader_end_user() {
|
||||
if (leader_sequence_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)); }
|
||||
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 ====
|
||||
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"); }
|
||||
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 ===
|
||||
SEQ_ONE_KEY(KC_G) { SEND_STRING(" | grep "); }
|
||||
SEQ_ONE_KEY(KC_K) { onMac ? SEND_STRING(SS_LCTL(" ")) : SEND_STRING(SS_LCTL("f")); }
|
||||
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
|
||||
SEQ_TWO_KEYS(KC_D, KC_G) {
|
||||
if (leader_sequence_two_keys(KC_D, KC_G)) {
|
||||
if (onMac) {
|
||||
SEND_STRING(SS_LGUI("a") SS_TAP(X_D));
|
||||
} else {
|
||||
@ -37,38 +53,52 @@ void matrix_scan_user(void) {
|
||||
}
|
||||
}
|
||||
// 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)); }
|
||||
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
|
||||
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)); }
|
||||
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
|
||||
SEQ_ONE_KEY(KC_1) { layer_on(1); }
|
||||
if (leader_sequence_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)); }
|
||||
if (leader_sequence_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 (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) {
|
||||
if (leader_sequence_three_keys(KC_M, KC_A, KC_C)) {
|
||||
onMac = true;
|
||||
# ifdef RGBLIGHT_ENABLE
|
||||
rgblight_setrgb(255, 255, 255);
|
||||
# endif
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_W, KC_I, KC_N) {
|
||||
if (leader_sequence_three_keys(KC_W, KC_I, KC_N)) {
|
||||
onMac = false;
|
||||
# ifdef RGBLIGHT_ENABLE
|
||||
rgblight_setrgb(255, 255, 0);
|
||||
# endif
|
||||
}
|
||||
/* Copy all */
|
||||
SEQ_ONE_KEY(KC_Y) {
|
||||
if (leader_sequence_one_key(KC_Y)) {
|
||||
if (onMac) {
|
||||
SEND_STRING(SS_LGUI("a") SS_LGUI("c"));
|
||||
} else {
|
||||
@ -76,12 +106,19 @@ void matrix_scan_user(void) {
|
||||
}
|
||||
}
|
||||
// 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://"); }
|
||||
|
||||
leader_end();
|
||||
if (leader_sequence_two_keys(KC_E, KC_E)) {
|
||||
SEND_STRING(SS_DOWN(X_LGUI) SS_LCTL(" ") SS_UP(X_LGUI));
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -23,25 +23,21 @@ __attribute__((weak)) void matrix_scan_keymap(void) {}
|
||||
__attribute__((weak)) void leader_scan_secrets(void) {}
|
||||
|
||||
#ifdef LEADER_ENABLE
|
||||
LEADER_EXTERNS();
|
||||
void matrix_scan_leader(void) {
|
||||
void leader_end_user(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) {
|
||||
if (leader_sequence_one_key(KC_R)) {
|
||||
SEND_STRING(SS_LGUI("r"));
|
||||
}
|
||||
|
||||
SEQ_TWO_KEYS(KC_B, KC_D) {
|
||||
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);
|
||||
}
|
||||
|
||||
SEQ_TWO_KEYS(KC_L, KC_C) {
|
||||
if (leader_sequence_two_keys(KC_L, KC_C)) {
|
||||
send_string_with_delay("/** */", TAP_CODE_DELAY);
|
||||
wait_ms(TAPPING_TERM);
|
||||
tap_code(KC_LEFT);
|
||||
@ -56,8 +52,7 @@ __attribute__((weak)) void leader_scan_secrets(void) {}
|
||||
#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();
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
||||
void leader_end_user(void) {
|
||||
// Stop music and lock computer via alfred
|
||||
SEQ_ONE_KEY(KC_H) {
|
||||
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
|
||||
SEQ_TWO_KEYS(KC_H, KC_H) {
|
||||
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
|
||||
SEQ_ONE_KEY(KC_A) {
|
||||
if (leader_sequence_one_key(KC_A)) {
|
||||
SEND_STRING(SS_LGUI(SS_LSFT("3")));
|
||||
}
|
||||
|
||||
// Selective Screen Shot
|
||||
SEQ_ONE_KEY(KC_S) {
|
||||
if (leader_sequence_one_key(KC_S)) {
|
||||
SEND_STRING(SS_LGUI(SS_LSFT("4")));
|
||||
}
|
||||
|
||||
// TMUX - shift to pane 1 and zoom
|
||||
SEQ_ONE_KEY(KC_J) {
|
||||
if (leader_sequence_one_key(KC_J)) {
|
||||
tmux_prefix();
|
||||
SEND_STRING("q1");
|
||||
tmux_pane_zoom();
|
||||
}
|
||||
|
||||
// TMUX - shift to first window
|
||||
SEQ_TWO_KEYS(KC_J, KC_J) {
|
||||
if (leader_sequence_two_keys(KC_J, KC_J)) {
|
||||
tmux_prefix();
|
||||
SEND_STRING("1");
|
||||
}
|
||||
|
||||
// TMUX - shift to pane 2 and zoom
|
||||
SEQ_ONE_KEY(KC_K) {
|
||||
if (leader_sequence_one_key(KC_K)) {
|
||||
tmux_prefix();
|
||||
SEND_STRING("q2");
|
||||
tmux_pane_zoom();
|
||||
}
|
||||
|
||||
// TMUX - shift to second window
|
||||
SEQ_TWO_KEYS(KC_K, KC_K) {
|
||||
if (leader_sequence_two_keys(KC_K, KC_K)) {
|
||||
tmux_prefix();
|
||||
SEND_STRING("2");
|
||||
}
|
||||
|
||||
// TMUX - shift to pane 3 and zoom
|
||||
SEQ_ONE_KEY(KC_L) {
|
||||
if (leader_sequence_one_key(KC_L)) {
|
||||
tmux_prefix();
|
||||
SEND_STRING("q3");
|
||||
tmux_pane_zoom();
|
||||
}
|
||||
|
||||
// TMUX - shift to third window
|
||||
SEQ_TWO_KEYS(KC_L, KC_L) {
|
||||
if (leader_sequence_two_keys(KC_L, KC_L)) {
|
||||
tmux_prefix();
|
||||
SEND_STRING("3");
|
||||
}
|
||||
|
||||
// TMUX - shift to last pane and zoom
|
||||
SEQ_ONE_KEY(KC_SEMICOLON) {
|
||||
if (leader_sequence_one_key(KC_SEMICOLON)) {
|
||||
tmux_prefix();
|
||||
SEND_STRING(";");
|
||||
tmux_pane_zoom();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
113
users/kuchosauronad0/leader_user.c
Normal file
113
users/kuchosauronad0/leader_user.c
Normal file
@ -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
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "kuchosauronad0.h"
|
||||
|
||||
#include "leader.h"
|
||||
#include "leader_user.h"
|
||||
|
||||
void matrix_scan_user(void);
|
@ -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*.
|
||||
|
@ -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);
|
||||
|
@ -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)","")
|
||||
|
@ -90,27 +90,20 @@ 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) {
|
||||
void leader_end_user(void) {
|
||||
if (leader_sequence_two_keys(KC_F1, KC_L)) {
|
||||
set_os(_OS_LINUX);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_F1, KC_M) {
|
||||
if (leader_sequence_two_keys(KC_F1, KC_M)) {
|
||||
set_os(_OS_MACOS);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_F1, KC_W) {
|
||||
if (leader_sequence_two_keys(KC_F1, KC_W)) {
|
||||
set_os(_OS_WINDOWS);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_F1, KC_S) {
|
||||
if (leader_sequence_two_keys(KC_F1, KC_S)) {
|
||||
stored_userspace_config.raw = runtime_userspace_config.raw;
|
||||
store_userspace_config();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
|
@ -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) {
|
||||
if (leader_sequence_one_key(KC_U)) {
|
||||
ucis_start();
|
||||
}
|
||||
#endif
|
||||
SEQ_ONE_KEY(KC_H) {
|
||||
if (leader_sequence_one_key(KC_H)) {
|
||||
send_unicode_string("ᕕ( ᐛ )ᕗ"); // happy
|
||||
}
|
||||
SEQ_ONE_KEY(KC_D) {
|
||||
if (leader_sequence_one_key(KC_D)) {
|
||||
send_unicode_string("ಠ_ಠ"); // disapproval
|
||||
}
|
||||
SEQ_ONE_KEY(KC_L) {
|
||||
if (leader_sequence_one_key(KC_L)) {
|
||||
send_unicode_string("( ͡° ͜ʖ ͡°)"); // lenny
|
||||
}
|
||||
SEQ_ONE_KEY(KC_S) {
|
||||
if (leader_sequence_one_key(KC_S)) {
|
||||
send_unicode_string("¯\\_(ツ)_/¯"); // shrug
|
||||
}
|
||||
// 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_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) {
|
||||
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
|
||||
|
||||
|
@ -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();
|
||||
}
|
41
users/yet-another-developer/leader_user.c
Normal file
41
users/yet-another-developer/leader_user.c
Normal file
@ -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();
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "yet-another-developer.h"
|
||||
|
||||
#include "leader.h"
|
||||
#include "leader_user.h"
|
||||
|
||||
void matrix_scan_user(void);
|
@ -14,7 +14,7 @@ endif
|
||||
|
||||
|
||||
ifeq ($(strip $(LEADER_ENABLE)), yes)
|
||||
SRC += leader.c
|
||||
SRC += leader_user.c
|
||||
endif
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user