Macros for beginner


Hello everyone.

At my work i use MicrosoftOffice with alt-codes a lot (that means, press and hold alt, then type a specific numeric code, then release alt). I use this to enter mathematic symbols, fractions, different spaces etc. in Word-Documents.
Now I would like to have a couple of macros for alt-codes I often use. These macros should work the following: press alt, while alt is pressed, press and release different keypad-numbers, then release alt again.
Unfortunately I am a total beginner in programming a keyboardio. Could someone show me, how I can make a macro like these?

Thank you very much,
kind regards


Hey walrus, I’m not a programmer, and I was able to figure this out. You can do it if you like to tinker.

  1. I’m going to assume that you downloaded the latest version of the firmware and flashed it using Arduino IDE, instructions here:

  2. Make sure that you read about creating macros here:

  3. As the instructions say, “To use the plugin, we need to include the header, tell the firmware to use the plugin, place macros on the keymap, and create a special handler function (macroAction) that will tell the plugin what shall happen when macro keys are pressed.”

The following is from my keyboard firmware. It might look confusing at first, but most of those things are already in the firmware. All you have to do is add the macros you want to create, add them somewhere on your keymap, and then tell your keyboard what the macro is supposed to do. For mine, I’ve got a macro for a program launcher (a shortcut I designed to be Ctrl+Cmd+Opt+Shift+L), a macro to activate a program called Moom (Ctrl+Cmd+Opt+Shift+M), a macro to add a reference when I am using Word (Ctrl+Cmd+Opt+Shift+Z), and a macro to add a footnote in Word (Ctrl+Cmd+Opt+Shift+F). Note that for all of these shortcuts, I first defined them either for my operating system or for Microsoft Word. Probably the best thing to do is take a crack at it, and then post your firmware sketch if it doesn’t work.

/* Here is the header (included by default, so you don't have to do anything to this): */
#include <Kaleidoscope.h>
#include <Kaleidoscope-Macros.h>

/* Giving a name to my macros; on your sketch you'll see the default macros named here, and you can just add to the list. I'm pretty sure "enum" is short for "enumerate." */
enum { 

// In the keymap you will include "M(YourMacroName)" (i.e., instead of Key_Gui I might put "M(M_LAUNCH)" 
First M is to tell that this is a macro, the second M is part of the name of the Macro I have created */


// I put this function right after the keycaps in my firmware; it tells the keyboard what to do when handling my macros:

const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
  switch (macroIndex) {
  case M_LAUNCH:
    return MACRODOWN(D(LeftShift), D(LeftAlt), D(LeftControl), D(LeftGui), D(L));

  case M_MOOM:
    return MACRODOWN(D(LeftShift), D(LeftAlt), D(LeftControl), D(LeftGui), D(Tab));

  case M_ZOTERO:
    return MACRODOWN(D(LeftShift), D(LeftAlt), D(LeftControl), D(LeftGui), D(Z));

  case M_FOOTNOTE:
    return MACRODOWN(D(LeftShift), D(LeftAlt), D(LeftControl), D(LeftGui), D(F));

  return MACRO_NONE;


void setup() {
  Kaleidoscope.setup ();

/* You have to include "Macros" in the initialization of your plugins, but again this is done by default */


It occurs to me that for numeric codes, you are probably going to want your keyboard to “tap” those keys rather than hold them all down. So be sure you use T(first_#), T(second_#), etc.


Thanks for the tutorial. I hadn’t time to try it out, but it helped me to understand it.
have a nice day.