diff options
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/leader.c | 7 | ||||
-rw-r--r-- | quantum/leader.h | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/quantum/leader.c b/quantum/leader.c index 272609ad0c..23e5e8cd6d 100644 --- a/quantum/leader.c +++ b/quantum/leader.c @@ -21,6 +21,10 @@ __attribute__((weak)) void leader_start_user(void) {} __attribute__((weak)) void leader_end_user(void) {} +__attribute__((weak)) bool leader_add_user(uint16_t keycode) { + return false; +} + void leader_start(void) { if (leading) { return; @@ -61,6 +65,9 @@ bool leader_sequence_add(uint16_t keycode) { leader_sequence[leader_sequence_size] = keycode; leader_sequence_size++; + if (leader_add_user(keycode)) { + leader_end(); + } return true; } diff --git a/quantum/leader.h b/quantum/leader.h index 3177fcd196..fba6b287ba 100644 --- a/quantum/leader.h +++ b/quantum/leader.h @@ -22,6 +22,15 @@ void leader_start_user(void); void leader_end_user(void); /** + * \brief User callback, invoked when a keycode is added to the leader sequence. + * + * \param keycode The keycode added to the leader sequence. + * + * \return `true` to finish the key sequence, `false` to continue. + */ +bool leader_add_user(uint16_t keycode); + +/** * Begin the leader sequence, resetting the buffer and timer. */ void leader_start(void); |