-
-
Notifications
You must be signed in to change notification settings - Fork 39.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CTL_T(LCTL(KC_A)) not working #281
Comments
You can't chain those like that! You have to use a custom macro. Here is a simple frame into which you can put your code. case 0:
if (record->event.pressed) {
if (record->tap.count && !record->tap.interrupted) {
// tap press action
}
else {
record->tap.count = 0;
// hold press action
}
}
else {
if (record->tap.count) {
// tap release action
}
else {
// hold release action
}
record->tap.count = 0;
}
break; |
I figured you couldn't since it says it takes a case 0:
if (record->event.pressed) {
if (record->tap.count) {
if (record->tap.interrupted) {
record->tap.count = 0;
// hold press action
register_code(KC_LCTRL);
} else {
// tap press action
return MACRO( D(LCTRL), T(A), U(LCTRL), END );
}
} else {
// hold press action
register_code(KC_LCTRL);
}
} else {
if (record->tap.count) {
// tap release action
return MACRO( D(LCTRL), T(A), U(LCTRL), END );
} else {
// hold release action
unregister_code(KC_LCTRL);
}
record->tap.count = 0;
}
break; |
Oops, I forgot to mention that you have to call the macro in a special way. You have to put |
I did similar things with a Macro using the timer functions, and, if you want to use the full keycode (KC_LCTRL) you can use the Macro-Function DOWN instead of D. Then you can also use international keycodes, e.g. MACRO(DOWN(DE_OSX_AE),TYPE(KC_1),UP(DE_OSX_ACUT)) - you cannot combined keycodes there though. At least as I understand it. Like DE_OSX_QUOT will not work, as it is LSFT(DE_OSX_HASH). The ErgodoxMacroGenerator actually generates macros for that purpose - at least for me, they work. Have a look at the osx_de and osx_de_experimental keymaps, hope that'll help... cheers, Stephan
|
Thanks for all the help! I got everything working. I felt really limited when using the massdrop keyboard configurator. Now I'm overwhelmed with options! I'll make a PR to add my keymap. |
So what was the problem? |
Sorry, the solution was to use the const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_MACRO_TAP(0)
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) // this is the function signature -- just copy/paste it into your keymap file as it is.
{
switch(id) {
case 0:
if (record->event.pressed) {
if (record->tap.count) {
if (record->tap.interrupted) {
record->tap.count = 0;
// hold press action
register_code(KC_LCTL);
} else {
// tap press action
return MACRO( D(LCTL), T(A), U(LCTL), END );
}
} else {
// hold press action
register_code(KC_LCTL);
}
} else {
if (record->tap.count) {
// tap release action
} else {
// hold release action
unregister_code(KC_LCTL);
}
record->tap.count = 0;
}
break;
}
return MACRO_NONE;
}; |
Awesome! |
@jasontwong I updated the code template. |
* feat: added ik75 still error - quantum/vial_ensure_keycode.h:164:1: error: static assertion failed: "" _Static_assert(KC_LSPO == 0x5CD7, ""); * fix: add via settings * fix: disable unused matrix for firmware size - remove matrix that causes error * feat: use home as default layout * fix: rotary click is K4F should be 4,15 not 0,14 * refactor: disable some matrix to free some bytes * feat: remove more bad rgb for bigger memory and add restart button (not bootloader) * fix: undetected keyboard when pc shutdown - sometimes need to replug or reflash
I'm trying to use the code:
CTL_T(LCTL(KC_A))
and it doesn't seem to work. The expected functionality would be to doCTRL + A
on tap andCTRL
on hold. Am I using it incorrectly?The text was updated successfully, but these errors were encountered: