#How to use a stiky key inside a hold-tap

1 messages · Page 1 of 1 (latest)

ornate river
#

Hi, This is my first zmk project and before i used qmk where i used one-shot-modifiers to achieve ctrl one shot on tap and mo on hold. is there any way to do this in zmk?

ornate river
#

This is the code in qmk:

#

bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case LGUI_T(KC_SPC):
// Do not force the mod-tap key press to be handled as a modifier
// if any other key was pressed while the mod-tap key is held down.
return true;
case LT(NUM, MOD_LCTL):
// Do not force the mod-tap key press to be handled as a modifier
// if any other key was pressed while the mod-tap key is held down.
return true;
case LT(SYM, MOD_LGUI):
// Do not force the mod-tap key press to be handled as a modifier
// if any other key was pressed while the mod-tap key is held down.
return true;
default:
// Force the mod-tap key press to be handled as a modifier if any
// other key was pressed while the mod-tap key is held down.
return false;
}
}

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case LT(NUM, MOD_LCTL):
if (record->tap.count && record->event.pressed) {
set_oneshot_mods(MOD_LCTL); // Send KC_DQUO on tap
return false; // Return false to ignore further processing of key
}
break;
case LT(SYM, MOD_LGUI):
if (record->tap.count && record->event.pressed) {
set_oneshot_mods(MOD_LGUI); // Send KC_DQUO on tap
return false; // Return false to ignore further processing of key
}
break;
}
return true;
}

fleet sierra
#

Yes, you can compose behaviors in arbitrary ways. You’ll need a new hold-tap instance for that. The docs should have an example

#

In your case, you should be able to bind sk and mo in the hold-tap definition without specific key codes/layers. That way you can re-use the hold-tap instance for any combinations of sticky key and layer