diff options
author | Daniel RodrÃguez Rivero <rdanielo@gmail.com> | 2021-04-25 02:22:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-25 10:22:47 +1000 |
commit | 26b9b3aa2308a24e069f5ae2ab86e3df24492eed (patch) | |
tree | bc6f7d8cf81357a252cd6ec4fcc3966014bea5ab /quantum/process_keycode | |
parent | 8f5cc8d762db8a9a4ce3f41e4b66a8602f2da6f0 (diff) |
feat: infinite timeout for leader key (#6580)
* feat: implement leader_no_timeout logic
* docs(leader_key): infinite leader timeout docs
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r-- | quantum/process_keycode/process_leader.c | 5 | ||||
-rw-r--r-- | quantum/process_keycode/process_leader.h | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/quantum/process_keycode/process_leader.c b/quantum/process_keycode/process_leader.c index 58a615d85a..cf63f25141 100644 --- a/quantum/process_keycode/process_leader.c +++ b/quantum/process_keycode/process_leader.c @@ -49,7 +49,10 @@ bool process_leader(uint16_t keycode, keyrecord_t *record) { // Leader key set-up if (record->event.pressed) { if (leading) { - if (timer_elapsed(leader_time) < LEADER_TIMEOUT) { +# ifndef LEADER_NO_TIMEOUT + if (timer_elapsed(leader_time) < LEADER_TIMEOUT) +# endif // LEADER_NO_TIMEOUT + { # ifndef LEADER_KEY_STRICT_KEY_PROCESSING if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { keycode = keycode & 0xFF; diff --git a/quantum/process_keycode/process_leader.h b/quantum/process_keycode/process_leader.h index 9844f27a1b..5865d65a57 100644 --- a/quantum/process_keycode/process_leader.h +++ b/quantum/process_keycode/process_leader.h @@ -35,4 +35,11 @@ void qk_leader_start(void); extern uint16_t leader_time; \ extern uint16_t leader_sequence[5]; \ extern uint8_t leader_sequence_size -#define LEADER_DICTIONARY() if (leading && timer_elapsed(leader_time) > LEADER_TIMEOUT) + +#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 + +#endif |