Open jeffsf opened 1 month ago
I think this is a shortcoming of modifier functions. They only seem to work with keyboard usage page, not consumer usage page. I don't know if there is an exact existing issue for this, but #2329 might be related in cause.
Using a macro to send modifiers and the eject key as separate press/release events could be a workaround.
Perhaps I have misunderstood macros, but the following does not provide the behavior that QMK can
ZMK_MACRO(d_slp, bindings = \
<¯o_press &kp LSHFT>, \
<¯o_press &kp LCTRL>, \
<¯o_tap &kp K_EJECT>, \
<¯o_release &kp LCTRL>, \
<¯o_release &kp LSHFT>; \
)
PacketLogger seems to strip the payload, so I can't snoop over Bluetooth. I'm not seeing the Media Eject key in the QMK trace using the QMK browser tool. I'm guessing it is swallowed by the OS before getting to the browser.
Looking into other ways to diagnose. Suggestions welcomed.
From what I can dig up in QMK, it uses a different consumer keycode corresponding to HID_USAGE_CONSUMER_STOP_EJECT
. It looks like the alias C_STOP_EJECT
can be used for that.
It works as expected with
ZMK_MACRO(d_slp, bindings = \
<¯o_press &kp LSHFT>, \
<¯o_press &kp LCTRL>, \
<¯o_tap &kp C_STOP_EJECT>, \
<¯o_release &kp LCTRL>, \
<¯o_release &kp LSHFT>; \
)
The direct form did not immediately work
#define DISPLAY_SLEEP LS(LC(C_STOP_EJECT))
#define D_SLP &kp DISPLAY_SLEEP
I think that's consistent with my theory above, where modifier functions don't work with consumer keycodes.
This key code can be sent by QMK and is used by various macOS shortcuts including lock screen and sleep displays. See further https://support.apple.com/en-us/102650
LS(LC(K_EJECT))
can be seen sending and releasing the modifiers, but the key code forK_EJECT
is not seen.C_EJECT
was briefly checked and did not have apparently different behavior. No logs were collected.QMK VIA support works with
C(S(KC_EJCT))
, sleeping the displays as expected. Confirmed on three different keyboards.Deficiency documented at https://zmk.dev/docs/codes/media and confirmed on