QMK Caps Lock does not properly toggle IME

With QMK keyboards there seems to be a problem with the CAPS LOCK key not able to switch the IME on macOS even with the option enabled

Apparently it is a problem with NKRO, QMK either has NKRO enabled by default or set to disabled entirely; it also sends keystrokes through NKRO even without 6 or more keys pressed. All as described in the following issue:

Use Capslock toggle Chinese and English on macOS · Issue #15178 · qmk/qmk_firmware
Hi, I found that qmk firmware use capslock change input between chinese and english on macOS has a issue In a normal case, press capslock will toggle chinese and english, and english input will be ...

The behavior looks something like this:

Abnormal CAPS LOCK IME switching behavior

A workaround for this is to recompile the QMK firmware as described.

For the Keychron Q1, this was done as follows.

Install MSYS and QMK Toolbox

QMK MSYS
A Windows one-click installer for the QMK CLI
GitHub - qmk/qmk_toolbox: A Toolbox companion for QMK Firmware
A Toolbox companion for QMK Firmware. Contribute to qmk/qmk_toolbox development by creating an account on GitHub.
  1. Install both QMK MSYS and QMK Toolbox
  2. run qmk setup through QMK MSYS to download all the keyboard and dependencies

Compiling firmware

Editing keychorn/q1/rev_0100/rules.mk
  1. Edit rules.mk and change NKRO_ENABLE to no (it was keychron/q1/rev_0100 in my case, which is for the non-nob ANSI version)
List of available keymaps
Compiling firmware
  1. Compile firmware with the desired keymap under keychron/q1/rev_0100/keymaps/.
Finished compilation

The end result should look something like this, a .hex file will be created under qmk_firmware/

Flashing

  1. Open QMK Toolbox
QMK Toolbox Flashing
  1. Select the right chip (MCU) for the board, in this case ATMega32U4
  2. Connect the keyboard through DFU mode, (This can be done differently on different keyboards. For Keychron Q1, hold the reset key (located under the space bar) while unplugged and keep holding until plugged in.) QMK Toolbox will say connected
  3. Click flash, the process should finish within a few seconds.

Working CAPS LOCK IME Switch

Now the caps lock key should change the IME normally with no problems!