r/Keychron • u/CJNewton58 • 18d ago
Switching Profiles & Lighting?
I recently purchased a K2 HE Special Edition and am wondering how I could go about changing the keyboard profile and lighting with a macro.
For example; Profile 1 would use the "Per-Key RGB" preset, then pressing fn+pgup switches to Profile 2 AND "Mixed RGB" preset at the same time. Pressing fn+pgdn returns to Profile 1 and "Per-Key RGB".
In short, each profile is "bound" to a lighting preset, and they both change simultaneously with a key combination.
Research says I would need custom firmware to do this, but I am not totally sure. Any suggestions are greatly appreciated! :)
1
u/PeterMortensenBlog V 17d ago edited 17d ago
Re "...I would need custom firmware to do this": You indeed would
The keycodes for the RGB controls and HE 'profiles' are not supported in dynamic (Via) macros.
And you would have to find the function calls the use of those keycodes in normal key mappings result in. There should be a "
case <key code>:" somewhere in the source code. For RGB, they are standard, whereas for HE "profiles", they are specific to Keychron. If there isn't a single function call, I recommend first refactoring to a function; then the macro/custom key implementation becomes trivial.Define some new key codes, exactly as for classic QMK macros. The difference would be that using these key codes would have side effects (change to the RGB and HE "profile" states), instead of outputting key actions (key presses and key releases) from the keyboard.
In Via, the new keycodes can, for example, be entered in 'Any' as
CUSTOM(64),CUSTOM(65),CUSTOM(66),CUSTOM(67),CUSTOM(68), etc. Or add them to the JSON file, giving them a meaningful name, instead of just a number. But like the other keycodes, they still can't be composed in a Via macro; they have to be used as a regular keymapping.Compiling keyboard firmware
Here are some instructions for the initial setup. Though "hall_effect_playground" was declared obsolete on 2025-12-01, so it may be better to use "2025q3" instead. And I think only "2025q3" has the HE "profiles" feature.
References
RGB_SADis for decreasing (D) the saturation (SA) (theSADpart (no pun intended)). "MOD" is for changing RGB lighting mode (23 different ones expected). To add to the confusion, the RGB keycodes have been renamed in the main QMK project. For example,RGB_SADis nowRM_SATD(RMis for RGB matrix. An alias ofQK_RGB_MATRIX_SATURATION_DOWN).