aboutsummaryrefslogtreecommitdiff
path: root/keymap-wrapper.h
blob: 0cd3f048c3e2dd2b47554fd302a41fe9f68fbdec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// -*- mode: c++ -*- 
#pragma once
 
#include <Kaleidoscope-MouseKeys.h>
#include <Kaleidoscope-Colormap.h>
#include "keymap-layers.h"
 
/* hack hack hack!
 
   for each layer, we need 2 arrays: one for the keys, one for the
   colours. But we want to defined each key next to its
   colour. Therefore we write our keymap using the CK and ColorKeymaps
   macros, and include this file.
 
   First, we define CK as "return the first argument (the key)", and
   ColorKeymaps as "a kaleidoscope keymap", and include our keymaps
   definition.
 
   Then, we *redefine* CK as "return the second argument (the colour)"
   and ColorKeymaps as "a DefaultColormap color map", and include our
   keymaps definition *again* (make sure you don't add a `#pragma
   "once"` in there!)
 */
 
#define CK(k,c) k
 
#define ColorKeymaps(layers...) KEYMAPS(layers)
 
#define MYMAP_STACKED KEYMAP_STACKED
 
#include "keymaps.h"
 
#undef CK
#undef ColorKeymaps
#undef MYMAP_STACKED
 
#define CK(k,c) c
 
#define ColorKeymaps(layers...) COLORMAPS(layers)
 
#define MYMAP_STACKED COLORMAP_STACKED
 
#include "keymaps.h"
 
#undef CK
#undef ColorKeymaps
#undef MYMAP_STACKED