Closed LuiFerreiraD closed 1 month ago
Good question! LSFT(kc)
is limited to kc
being a basic keycode, which unfortunately excludes custom keycodes like SELWORD
. Other compound keycodes (LCTL
, MT
, LT
, ...) are similarly limited.
The root of the problem is that QMK represents every keycode as a 16-bit integer. When writing a compound keycode like LSFT(kc)
, the base keycode kc
is packed along with metadata indicating the LSFT
mod in the 16-bit keycode To make it all fit in 16 bits, the base keycode it limited to 8 bits.
Here is a potential workaround:
SELLINE
.process_record_user()
, dobool process_record_user(uint16_t keycode, keyrecord_t* record) {
if (!process_select_word(keycode, record, SELWORD)) { return false; }
switch (keycode) {
case SELLINE:
register_mods(MOD_BIT(KC_LSFT)); // Hold LSFT.
process_select_word(keycode, record, SELLINE);
clear_mods(); // Release LSFT.
return false;
// Other macros...
}
return true;
}
Hi, I used your select_word modification to my numpad, and it works perfectly! I am grateful for you posting helpful tricks. I just have a problem; I have a custom keycode (SELWORD) to call the function whenever it's pressed. I have another key on my layout that is LSFT(SELWORD), but when I press it, the usual select word is executed, not the select line. I am sorry if this is a basic question/issue - newbie in qmk here. I should add that I am running on MacOS Ventura, with a custom Keycrhon q0. I do have the #define MAC_HOTKEYS enabled. I really appreciate any help you can provide.