How to enable reactive lighting/ RGB modes on Keychron keyboards using cli on linux (tested on Keychron v4)
Go to: https://docs.qmk.fm/#/newbs_getting_started
Install the Prerequisites
On arch you can just do pacman -S qmk
or yay -S qmk
Now DON'T run qmk setup, instead clone keychrons fork of the qmk_firmware:
git clone -b playground https://github.com/Keychron/qmk_firmware.git
do this in your home directory, so the qmk toolbox can find it.
Run these commands (change out the keyboard and keymap for yours of course):
qmk config user.keyboard=keychron/v4/ansi
qmk config user.keymap=yourkeymapname
what you have to put in the keyboard option you can find
under qmk_firmware/keyboards/<here>
you can also run qmk list-keyboards
for the keymap you can just set
qmk config user.keymap=default
or
qmk config user.keymap=via
we do this so we can run
qmk flash
later without passing flags, becasue for whatever reason I've ran into a problem where the keymap wouldn't be found by qmk on my machine
Edit the qmk_firmware/keyboards/<your keyboard>/config.h
as an example this is the file I edited:
qmk_firmware/keyboards/keychron/v4/config.h
Now in the config.h there should be a bunch of lines that look something like this:
...
// RGB Matrix Animation modes. Explicitly enabled
// For full list of effects, see:
// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects
#define ENABLE_RGB_MATRIX_ALPHAS_MODS
#define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
#define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
#define ENABLE_RGB_MATRIX_BREATHING
#define ENABLE_RGB_MATRIX_BAND_SAT
#define ENABLE_RGB_MATRIX_BAND_VAL
#define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
#define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
#define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT
#define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
#define ENABLE_RGB_MATRIX_CYCLE_ALL
#define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
...
// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE
...
If not double check if you have the right file opened and the right repo cloned.
What you need to do now is comment out all the effects that you want to have, for example this one:
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE
you should also make sure that these lines are commented out:
...
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_MATRIX_KEYPRESSES
You can of course set the default keymap as your environment's default, but if you haven't you should make sure that you have a rules.mk file in the keymap directory containing VIA_ENABLE = yes
so you don't loose via functionality.
If you have set the defaults for your environment, you should just be able to run
qmk compile
this should create a binary in your qmk_firmware
directory
you can also run
qmk compile -kb <keyboard> -km <keymap>
Get a second keyboard or find some other way to run
qmk flash
without pressing enter on the keyboard you are flashing.
Now make sure that you have your current keymap config backed up somewhere, because it's gonna get overwritten.
- Factory reset the keyboard (unsure if needed, do it to be safe)
press fn + J + Z for 4 Seconds
-
unplug cable
-
Remove the spacebar keycap, there should be a reset button underneeth on the left side
-
press and hold the reset button wile also plugging in the cable
After it's plugged in you can let go of the reset button. The keyboard now should be in DFU mode
- Run
qmk flash
or if you haven't set your keyboard and keymap in the qmk environment:
qmk flash -kb <my_keyboard> -km <my_keymap>
I presonally ran into an issue here where it wasn't able to find the keymap, no matter what I did, but setting the environment worked
This will take a while
- AAAaaaaaand now you should be done
You can now open via and re-import your .json keymap and everything should work. One problem I have is that via indexes the light modes wrong, so I just set RGBMode+ and RGBMode- keys to go through the modes that way. This is probably fixable though.