Closed oizehsgl closed 1 year ago
You can call qk_leader_start();
from a custom keycode handler — this will do the same thing as the QK_LEAD
keycode. If you do that in process_record_user()
, you should probably have return false;
after that (if you return true
, your custom keycode will also be a part of the leader key sequence — but you can also use that feature to have multiple leader keys with different behavior).
And you can either use a tap dance or intercept a MT/LT keycode to implement different behavior for tap and hold.
You can call
qk_leader_start();
from a custom keycode handler — this will do the same thing as theQK_LEAD
keycode. If you do that inprocess_record_user()
, you should probably havereturn false;
after that (if you returntrue
, your custom keycode will also be a part of the leader key sequence — but you can also use that feature to have multiple leader keys with different behavior).And you can either use a tap dance or intercept a MT/LT keycode to implement different behavior for tap and hold.
Thank you for your reply! I try it and qk_leader_start() work fine. here is my code
#define LEADER_TIMEOUT 10000
LEADER_EXTERNS();
void matrix_scan_user(void) {
LEADER_DICTIONARY() {
leading = false;
// demo
SEQ_ONE_KEY(KC_F) {
SEND_STRING("QMK is awesome.");
did_leader_succeed = true;
}
leader_end();
}
};
void leader_start(void) {
did_leader_succeed = false;
}
void leader_end(void) {
if (!did_leader_succeed) {
tap_code(KC_ESC);
}
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case MY_LEAD_ESC: if(record->event.pressed) { qk_leader_start(); return false; } else { leader_time=0; return false; } return true; } return true; }
The above code has a bug. When i hold leader and tap another key six times,it will send ESC.
The above code has a bug. When i hold leader and tap another key six times,it will send ESC.
Your code says to send escape if the sequence did not succeed:
void leader_end(void) {
if (!did_leader_succeed) {
tap_code(KC_ESC);
}
}
And it looks like leader keys only supports 5 keys in the sequence, so when you hit the sixth, it ends.
Is there any way to pull this off, while still maintaining a low LEADER_TIMEOUT
? The idea is that when the leader key is held the timeout would be bypassed, at least for the time between the leader key hold and the first key of the leader sequence, in the case that LEADER_PER_KEY_TIMING
is set.
The use case I'm going after is binding Leader + j / k to Page Down / Page Up. Being a key useful for spamming, it would be ideal to be able to hold the leader key and then send multiple leader sequences while held.
Or if there's another feature that would be more appropriate to this use case let me know. I think of Leader as a custom modifier key.
This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in the next 30 days unless it is tagged properly or other activity occurs.
For maintainers: Please label with bug
, in progress
, on hold
, discussion
or to do
to prevent the issue from being re-flagged.
This issue has been automatically closed because it has not had activity in the last 30 days. If this issue is still valid, re-open the issue and let us know. // [stale-action-closed]
Feature Request Type
Description