Trying Miryoku layout on a Keychron QMK keyboard

Updated on

Contents:

  1. What?
  2. Setting Up QMK Environment
  3. Flashing firmware
  4. Building firmware with the Miryoku layout

What?

I have a Keychron K3 Pro ANSI keyboard and want to use the following subset of keys to try the Miryoku layout.

photo of a K3 Pro keyboard with some keys highlighted

Setting up QMK environment

As a guide I follow the Ubuntu/WSL track of the official tutorial.

  1. Make sure WSL is installed and open the Ubuntu distribution terminal.
  2. Create a dedicated directory for QMK.

    mkdir qmk && cd qmk

  3. Create a new virtual environment—QMK CLI is a Python package, and I prefer to have isolated environments for Python tools.

    python3 -m venv qmk-venv

    Source the activate shell script to enter the environment; to exit, type deactivate.

    . qmk-venv/bin/activate

  4. Install QMK CLI.

    python3 -m pip install qmk

    Change the default QMK home folder.

    qmk config user.qmk_home=/home/ubuntu/qmk/firmware

  5. Run the QMK setup. Here I point to the Keychron fork of the QMK repository.

    qmk setup Keychron/qmk_firmware

  6. Checkout the bluetooth_playground branch.

    cd firmware && git checkout bluetooth_playground

    Pull the submodules.

    make git-submodule

  7. Build the default firmware.

    qmk compile -kb keychron/k3_pro/ansi/rgb -km default

  8. The command on the step 7 would produce the artifact keychron_k3_pro_ansi_rgb_default.bin in the current directory.
  9. Type explorer.exe . to open Windows File Explorer from Ubuntu.

  10. In the address bar see Windows-friendly path to the directory with the artifact. Mine is \\wsl.localhost\Ubuntu\home\ubuntu\qmk\firmware

Flashing firmware

Use Windows to flash firmware.

  1. Download the QMK Toolbox. Standalone qmk_toolbox.exe is fine.
  2. Run the QMK toolbox. Agree, if it asks you to install drivers.
  3. Select the Open button, go to the directory from the step 10 of the previous section and then select the artifact with the firmware.
  4. Toggle keyboard mode switch to Off, connect the keyboard, hold down the Esc and then toggle the switch to Cable.

    STM32 DFU device connected (WinUSB): STMicroelectronics STM32 BOOTLOADER (0483:DF11:2200)

  5. Release the Esc.
  6. Click the Flash button. Wait.

    Flash complete
    STM32 DFU device disconnected (WinUSB): STMicroelectronics STM32 BOOTLOADER (0483:DF11:2200)

Building firmware with the Miryoku layout

  1. Make sure that the virtual environment is activated and the correct directory is selected.

    . ~/qmk/qmk-venv/bin/activate && cd ~/qmk/firmware

  2. Create new keymap.

    qmk new-keymap -kb keychron/k3_pro/ansi/rgb

  3. When asked, type the name manna-harbour_miryoku
  4. Edit the created keymap.

    notepad.exe keyboards/keychron/k3_pro/ansi/rgb/keymaps/manna-harbour_miryoku/keymap.c

  5. Replace content of the file with (new line at the end of document is needed).
    #define _____ KC_NO
    
    #define LAYOUT_miryoku(\
      K00  ,  K01  ,  K02  ,  K03  ,  K04  ,          K05  ,  K06  ,  K07  ,  K08  ,  K09  ,\
      K10  ,  K11  ,  K12  ,  K13  ,  K14  ,          K15  ,  K16  ,  K17  ,  K18  ,  K19  ,\
      K20  ,  K21  ,  K22  ,  K23  ,  K24  ,          K25  ,  K26  ,  K27  ,  K28  ,  K29  ,\
      N30  ,  N31  ,  K32  ,  K33  ,  K34  ,          K35  ,  K36  ,  K37  ,  N38  ,  N39\
    )\
    LAYOUT_ansi_84(\
     _____ , _____ ,  K00  ,  K01  ,  K02  ,  K03  ,  K04  , _____ ,  K05  ,  K06  ,  K07  ,  K08  ,  K09  , _____ , _____ , _____ ,\
     _____ , _____ ,  K10  ,  K11  ,  K12  ,  K13  ,  K14  , _____ ,  K15  ,  K16  ,  K17  ,  K18  ,  K19  ,     _____     , _____ ,\
       _____   ,  K20  ,  K21  ,  K22  ,  K23  ,  K24  , _____ , _____ ,  K25  ,  K26  ,  K27  ,  K28  ,  K29  ,   _____   , _____ ,\
        _____    , _____ , _____ , _____ ,  K32  ,  K33  ,  K34  ,  K35  ,  K36  ,  K37  , _____ , _____ ,      _____      , _____ ,\
          _____      , _____ , _____ , _____ , _____ , _____ , _____ , _____ , _____ , _____ , _____ ,    _____    , _____ , _____ ,\
      _____  ,  _____  ,  _____  ,                      _____                      , _____ , _____ , _____ , _____ , _____ , _____\
    )
  6. Save the file and close the editor.
  7. Build the firmware.

    qmk compile -kb keychron/k3_pro/ansi/rgb -km manna-harbour_miryoku

  8. Now flash the firmware following the steps from the previous section

Caveat. In the keymap.c I defined what subset of keys on the keyboard I want to use. The actual logic behind the layout is located in the directory users/manna-harbour_miryoku/ and this directory is part of the repository. Because I am using Keychron fork of the QMK repository I might not have the latest version of the Miryoku. Actually the QMK repository itself might not contain the latest version of the Miryoku. I am ok with that.