Skip to content

Commit

Permalink
feat: implement leader_no_timeout logic
Browse files Browse the repository at this point in the history
  • Loading branch information
danielo515 committed Mar 19, 2020
1 parent aeab11d commit 559da1f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion quantum/process_keycode/process_leader.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 6 additions & 1 deletion quantum/process_keycode/process_leader.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,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

0 comments on commit 559da1f

Please sign in to comment.