zmk icon indicating copy to clipboard operation
zmk copied to clipboard

fix: `keydown` and `keyup` event occurs simultaneously when pressing `&kp` while holding `&mo`

Open jjangga0214 opened this issue 4 months ago • 7 comments

Hi!

Let's say I have a keymap like this.

#define LAYER_B 1

/ {
    behaviors {
        hlt: hold_preferred_lt {
            compatible = "zmk,behavior-hold-tap";
            label = "hold_preferred_lt";
            #binding-cells = <2>;
            tapping-term-ms = <160>;
            flavor = "hold-preferred";
            bindings = <&mo>, <&kp>;
        };
    };

    keymap {
        compatible = "zmk,keymap"; 
        a { 
            &kp A        &hlt LAYER_B C
        };
        b { 
            &kp LCMD     &trans
        };       
    };    
};

There're two physical keys. When I hold the second key,

Steps for what I expected

  1. Layer A is active by default.
  2. Keep Holding the second key.
  3. &mo LAYER_B takes effect.
  4. Hold the first key.
  5. keydown event for LCMD occurs.
  6. Stop holding the first key.
  7. keyup event for LCMD occurs.
  8. Stop holding the second key.
  9. Layer A is activated again.

Steps for what actually happens

  1. Layer A is active by default.
  2. Keep Holding the second key.
  3. &mo LAYER_B takes effect.
  4. Hold the first key.
  5. No event occurs.
  6. Stop holding the first key.
  7. keydown and keyup event for LCMD occurs.
  8. Stop holding the second key.
  9. Layer A is activated again.

Step 4 and 6 are different from what I expected. Is this an intended behavior?

jjangga0214 avatar Oct 02 '24 12:10 jjangga0214