Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Per Key Leader Timing Option #4026

Merged
merged 3 commits into from
Dec 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/config_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ If you define these options you will enable the associated feature, which may in
* See [Hold after tap](feature_advanced_keycodes.md#hold-after-tap)
* `#define LEADER_TIMEOUT 300`
* how long before the leader key times out
* `#define LEADER_PER_KEY_TIMING`
* sets the timer for leader key chords to run on each key press rather than overall
* `#define ONESHOT_TIMEOUT 300`
* how long before oneshot times out
* `#define ONESHOT_TAP_TOGGLE 2`
Expand Down Expand Up @@ -187,7 +189,7 @@ Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in yo

* `#define SPLIT_HAND_PIN B7`
* For using high/low pin to determine handedness, low = right hand, high = left hand. Replace 'B7' with the pin you are using. This is optional and you can still use the EEHANDS method or MASTER_LEFT / MASTER_RIGHT defines like the stock Let's Split uses.

* `#define USE_I2C`
* For using I2C instead of Serial (defaults to serial)

Expand Down Expand Up @@ -240,6 +242,8 @@ Use these to enable or disable building certain features. The more you have enab
* Enable the audio subsystem.
* `RGBLIGHT_ENABLE`
* Enable keyboard underlight functionality
* `LEADER_ENABLE`
* Enable leader key chording
* `MIDI_ENABLE`
* MIDI controls
* `UNICODE_ENABLE`
Expand Down
23 changes: 23 additions & 0 deletions docs/feature_leader_key.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,26 @@ To add support for Leader Key you simply need to add a single line to your keyma
```
LEADER_ENABLE = yes
```

## Per Key Timing on Leader keys

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).

In order to enable this, place this in your `config.h`:
```
#define LEADER_PER_KEY_TIMING
```

After this, it's recommended that you lower your `LEADER_TIMEOUT` to something less that 300ms.

```
#define LEADER_TIMEOUT 250
```

Now, something like this won't seem impossible to do without a 1000MS leader key timeout:

```
SEQ_THREE_KEYS(KC_C, KC_C, KC_C) {
SEND_STRING("Per key timing is great!!!");
}
```
6 changes: 6 additions & 0 deletions quantum/process_keycode/process_leader.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@ uint8_t leader_sequence_size = 0;
bool process_leader(uint16_t keycode, keyrecord_t *record) {
// Leader key set-up
if (record->event.pressed) {
#ifdef LEADER_PER_KEY_TIMING
leader_time = timer_read();
#endif
if (!leading && keycode == KC_LEAD) {
leader_start();
leading = true;
#ifndef LEADER_PER_KEY_TIMING
leader_time = timer_read();
#endif
leader_time = timer_read();
leader_sequence_size = 0;
leader_sequence[0] = 0;
Expand Down