Hello everyone, I recently bought a piantor keyboard and I am having trouble with qmk. I have configured two layer keys(num, nav) each of them switches to different layer and I want to be able to hold both of them to access fourth layer(CzechLayer), but I can’t seem to figure out how to do it. Here is my keymap.c file:

#include QMK_KEYBOARD_H
#include "keymap_czech.h"

enum layers {
    DefaultLayer,
    NumLayer,
    NavLayer,
    CzechLayer,
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    [DefaultLayer] = LAYOUT_split_3x6_3(
        KC_PIPE, KC_Q,         KC_W,         KC_E,         KC_R,         KC_T,          KC_Y,    KC_U,         KC_I,         KC_O,         KC_P,            KC_PPLS,
        KC_ESC,  GUI_T(KC_A),  ALT_T(KC_S),  CTL_T(KC_D),  LSFT_T(KC_F), KC_G,          KC_H,    RSFT_T(KC_J), CTL_T(KC_K),  ALT_T(KC_L),  GUI_T(KC_SCLN),  KC_PEQL,
        KC_UNDS, KC_Z,         KC_X,         KC_C,         KC_V,         KC_B,          KC_N,    KC_M,         KC_COMM,      KC_DOT,       KC_SLSH,         KC_PMNS,

                                             MO(NumLayer), KC_TAB, KC_SPC,                  KC_BSPC,  KC_ENT,  MO(NavLayer)
    ),

    [NumLayer] = LAYOUT_split_3x6_3(
        KC_QUOT, KC_1,         KC_2,         KC_3,         KC_4,         KC_5,          KC_6,    KC_7,         KC_8,         KC_9,         KC_0,            KC_PPLS,
        KC_ESC,  KC_EXLM,      KC_AT,        KC_HASH,      KC_DLR,       KC_PERC,       KC_CIRC, KC_AMPR,      KC_ASTR,      KC_BSLS,      KC_COLN,         KC_PEQL,
        KC_DQUO, KC_TILD,      KC_LABK,      KC_LCBR,      KC_LBRC,      KC_LPRN,       KC_RPRN, KC_RBRC,      KC_RCBR,      KC_RABK,      KC_QUES,         KC_PMNS,

                                             MO(NumLayer), KC_TAB, KC_SPC,                  KC_BSPC,  KC_ENT,  MO(NavLayer)
    ),

    [NavLayer] = LAYOUT_split_3x6_3(
        KC_BRIU, KC_F1,         KC_F2,        KC_F3,        KC_F4,        KC_F5,        KC_F6,   KC_F7,        KC_F8,        KC_F9,        KC_F10,          KC_VOLU,
        KC_ESC,  KC_F11,       _______,      _______,      _______,      _______,       KC_LEFT, KC_DOWN,      KC_UP,        KC_RIGHT,     KC_F12,          KC_MUTE,
        KC_BRID, _______,      _______,      _______,      _______,      QK_BOOT,       QK_MAKE, _______,      _______,      _______,      _______,         KC_VOLD,

                                             MO(NumLayer), KC_TAB, KC_SPC,                  KC_BSPC,  KC_ENT,  MO(NavLayer)
    ),

    [CzechLayer] = LAYOUT_split_3x6_3(
        KC_PIPE, _______,      CZ_EACU,      CZ_ECAR,      CZ_RCAR,      KC_T,          CZ_YACU, KC_U,         CZ_IACU,      KC_O,         _______,         KC_PMNS,
        KC_ESC,  CZ_AACU,      CZ_SCAR,      KC_D,         _______,      _______,       _______, _______,      _______,      _______,      KC_SCLN,         KC_PEQL,
        KC_UNDS, CZ_ZCAR,      _______,      CZ_CCAR,      _______,      _______,       KC_N,    _______,      KC_COMM,      KC_DOT,       KC_SLSH,         KC_PPLS,

                                             MO(NumLayer), KC_TAB, KC_SPC,                  KC_BSPC,  KC_ENT,  MO(NavLayer)
    ),
};
  • obosobM
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    Ideally you want to use QMK’s tri_layer feature as I outlined in this comment.

    Also you can just use the _______ keycode instead of restating MO(...) on every layer as that is the an alias for KC_TRANSPARENT meaning it maintains the function of the layer below.

  • Nibodhika@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    I’m currently assembling my crkbd, looking at the default Configs they do this like so:

    • On layer 0: MO(1) and MO(2)
    • On layer 1: _____ and MO(3)
    • On layer 2: MO(3) and _____
    • On layer 3: _____ and _____

    That way regardless of which button you press, if you press two of them you go to a fourth layer.

    • obosobM
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      This doesn’t work perfectly, IIRC if OP presses MO(1), then MO(2), then releases MO(1) it’ll stay on layer 3. The better way to do it is defining the layer_state_set_user function and calling update_tri_layer_state as documented here

  • dreipunkteinsvier@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    In your num and nav layers you have to change the codes of the opposite layer tap keys. So in your num layer change MO(nav) to MO(chez) and for your num layer change MO(num) to MO(chez). So once you are in either layer hitting to other tap key takes you to your chez layer.

    • puppybox@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      This. Just copy file that’s on GitHub into the keyboard (both sides). The. Start up vial. It’s super easy to edit layout that way.

      • Crandel@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        It’s much easier as you imagine. It always one key and in any layout it works the same. If I need to switch to nums layout I always tap twice. If I hold I switch to chars layout. This is much more intuitive than any key combination