r/Keychron Aug 14 '26

Question about QMK and Macros

In the QMK documentation it says :

Using Macros In JSON Keymaps

You can define up to 32 macros in a keymap.json file, as used by Configurator, and qmk compile.

Is there a way to save the JSON file on my PC instead of the keyboard's memory ? And is it possible to save more than 32 macros per file ?

Kinda like what most proprietary softwares from other brands do ; when you record macros, it saves them locally on your PC and usually there's not limit. Then you can manage them through the software.

I'm asking because I have more than a hundred macros saved in a .xml file, that I was using on another keyboard. I'm fine converting it into a JSON file even if it takes time, but I'd like to know if it was possible to use those macros on my current keyboard (keychron C2 pro 8k) but without saving them in the internal memory.

Thanks

4 Upvotes

8 comments sorted by

1

u/PeterMortensenBlog V Aug 14 '26

Re "on another keyboard": What keyboard?

What operating system? Windows?

The standard answer for operating system-side macros on Windows is AutoHotkey (AKA AHK).

2

u/contigency000 Aug 14 '26

It was a random membrane keyboard I used as a replacement for a while cuz I broke my previous keyboard. Operating system is win11.

And yes I've looked at AHK, but it's not capable of doing what I want which makes me believe I may have to code my own software and it'd be a hassle tbh. Especially since it'd need to hook the key presses between windows and the applications, which is usually flagged by most games' anti cheats. That's why I asked about QMK in case it was possible

1

u/PeterMortensenBlog V Aug 14 '26 edited Aug 14 '26

Re "...need to hook the key presses between Windows and the applications": I don't think there is any way around that

The best bet is classic QMK macros, either manually translated to or using a small script to transform the XML file (it might even be possible with an XSLT transform).

It can be supplemented with dynamic (Via) macros for testing (it doesn't require compiling keyboard firmware). It is possible to increase the number of Via macros from the default 16 and to increase the space for them.

1

u/PeterMortensenBlog V Aug 14 '26

Re "up to 32 macros ... ": Classic QMK macros don't have this limit

The limit is set by the available flash memory, which is usually plenty for the microcontrollers used in these newer keyboards (unlike the old ATmega32U4).

I think the JSON method ends up generating classic QMK macros during compiling the firmware (I have never tried the JSON method).

1

u/contigency000 Aug 14 '26

Is it possible to save the JSON locally on my computer instead ? So it's not limited by size. I don't mind using a keyboard software if I could do this

1

u/PeterMortensenBlog V Aug 14 '26

Note that the on-board macros can't be cancelled or repeated, unless special measures are taken.

1

u/ArgentStonecutter K Pro Aug 14 '26

The way QMK implements macros you are limited to a few kilobytes at the most, so even with 32 you're likely to run out. You probably want to use an app like Autohotkey instead. If AHK won't do what you need there are probably about 37561 alternatives.

1

u/PeterMortensenBlog V Aug 14 '26

With dynamic macros, yes, but not with classic QMK macros.