]> git.donarmstrong.com Git - qmk_firmware.git/blob - layouts/community/ergodox/nstickney/keymap.c
dc83c2f4d78300b80bf8d0a32c49d330a5ee5510
[qmk_firmware.git] / layouts / community / ergodox / nstickney / keymap.c
1 #include QMK_KEYBOARD_H
2
3 /*
4  * This keymap simulates the key limitations of an Iris on an ErgoDox. See the
5  * matching iris layout (/keyboards/iris/keymaps/nstickney) for further
6  * information.
7  */
8
9 // Layers
10 #define BASE 0 // Base layer
11 #define SYMB 1 // Symbols
12 #define SYSH 2 // Symbols, shifted
13 #define NUMP 4 // Numpad
14 #define FCTN 8 // Function
15
16 // Tap Dancing
17 void dance_lock (qk_tap_dance_state_t *state, void *user_data) {
18         switch (state->count){
19                 case 1: // Press once for LGUI
20                         tap_code(KC_LGUI);
21                         break;
22                 case 2: // Press twice for NUMLOCK
23                         tap_code(KC_NLCK);
24                         break;
25                 case 3: // Press thrice for CAPSLOCK
26                         tap_code(KC_CAPS);
27                         break;
28                 case 4: // Press four times for SCROLLOCK
29                         tap_code(KC_SLCK);
30                         break;
31                 default:
32                         break;
33         }
34 };
35
36 void dance_layer (qk_tap_dance_state_t *state, void *user_data) {
37         switch (state -> count) {
38                 case 1: // Press once for MENU
39                         tap_code(KC_APP);
40                         break;
41                 case 2: // Press twice for NUMPAD
42                         layer_invert(NUMP);
43                         break;
44                 case 3: // Press thrice for SYMBOLS
45                         layer_invert(SYMB);
46                         break;
47                 case 4: // Press four times for SYMBOLS, SHIFTED
48                         layer_invert(SYSH);
49                         break;
50                 default:
51                         break;
52         }
53 };
54
55 enum tap_dances {LOCKS = 0, LAYERS = 1};
56 qk_tap_dance_action_t tap_dance_actions[] = {
57         [LOCKS] = ACTION_TAP_DANCE_FN(dance_lock),
58         [LAYERS] = ACTION_TAP_DANCE_FN(dance_layer)
59 };
60
61 // Make layering more clear
62 enum custom_keycodes {
63         __________ = KC_TRNS,
64         XXX = KC_NO,
65         CC_ESC = LCTL_T(KC_ESC),
66         CC_QUOT = RCTL_T(KC_QUOT),
67         AC_SLSH = LALT_T(KC_SLSH),
68         AC_EQL = RALT_T(KC_EQL),
69         FC_BSLS = LT(FCTN, KC_BSLS),
70         FC_MINS = LT(FCTN, KC_MINS),
71 };
72
73 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
74         [BASE] = LAYOUT_ergodox(
75                 // left hand
76                 KC_GRV,     KC_1,       KC_2,       KC_3,       KC_4,       KC_5,       XXX,
77                 KC_TAB,     KC_Q,       KC_W,       KC_E,       KC_R,       KC_T,       XXX,
78                 CC_ESC,     KC_A,       KC_S,       KC_D,       KC_F,       KC_G,
79                 KC_LSPO,    KC_Z,       KC_X,       KC_C,       KC_V,       KC_B,       XXX,
80                 XXX,        XXX,        XXX,        XXX,        AC_SLSH,
81                                                                             TD(LOCKS),  XXX,
82                                                                                         XXX,
83                                                                 FC_BSLS,    KC_SPC,     XXX,
84                 // right hand
85                 XXX,        KC_6,       KC_7,       KC_8,       KC_9,       KC_0,       KC_BSPC,
86                 XXX,        KC_Y,       KC_U,       KC_I,       KC_O,       KC_P,       KC_DEL,
87                             KC_H,       KC_J,       KC_K,       KC_L,       KC_SCLN,    CC_QUOT,
88                 XXX,        KC_N,       KC_M,       KC_COMM,    KC_DOT,     KC_SLSH,    KC_RSPC,
89                                         AC_EQL,     XXX,        XXX,        XXX,        XXX,
90                 XXX,        TD(LAYERS),
91                 XXX,
92                 XXX,        KC_ENT,     FC_MINS
93         ),
94
95         [SYMB] = LAYOUT_ergodox(
96                 // left hand
97                 UC(0x00EF), UC(0x00A1), UC(0x00B2), UC(0x00B3), UC(0x00A4), UC(0x20AC), __________,
98                 __________, UC(0x00E4), UC(0x00E5), UC(0x00E9), UC(0x00AE), UC(0x00FE), __________,
99                 __________, UC(0x00E1), UC(0x00DF), UC(0x00F0), UC(0x00EC), UC(0x00ED),
100                 __________, UC(0x00E6), UC(0x00E8), UC(0x00A9), UC(0x00EA), UC(0x00EB), __________,
101                 __________, __________, __________, __________, UC(0x00BF),
102                                                                             __________, __________,
103                                                                                         __________,
104                                                                 UC(0x00AC), __________, __________,
105                 // right hand
106                 __________, UC(0x00BC), UC(0x00BD), UC(0x00BE), UC(0x2018), UC(0x2019), __________,
107                 __________, UC(0x00FC), UC(0x00FA), UC(0x00ED), UC(0x00F3), UC(0x00F6), __________,
108                             UC(0x00EE), UC(0x00E0), UC(0x00E2), UC(0x00F8), UC(0x00B6), UC(0x00B4),
109                 __________, UC(0x00F1), UC(0x00FD), UC(0x00E7), UC(0x00F4), UC(0x00BF), __________,
110                                         UC(0x00D7), __________, __________, __________, __________,
111                 __________, __________,
112                 __________,
113                 __________, __________, UC(0x00B1)
114         ),
115
116         [SYSH] = LAYOUT_ergodox(
117                 // left hand
118                 UC(0x00CF), UC(0x00B9), UC(0x2200), UC(0x2201), UC(0x00A3), UC(0x00A5), __________,
119                 __________, UC(0x00C4), UC(0x00C5), UC(0x00C9), UC(0x2122), UC(0x00DE), __________,
120                 __________, UC(0x00C1), UC(0x00A7), UC(0x00D0), UC(0x00CC), UC(0x00CD),
121                 __________, UC(0x00C6), UC(0x00C8), UC(0x00A2), UC(0x00CA), UC(0x00CB), __________,
122                 __________, __________, __________, __________, UC(0x203D),
123                                                                             __________, __________,
124                                                                                         __________,
125                                                                 UC(0x00A6), __________, __________,
126                 // right hand
127                 __________, UC(0x00B5), UC(0x00AB), UC(0x00BB), UC(0x201C), UC(0x201D), __________,
128                 __________, UC(0x00DC), UC(0x00DA), UC(0x00CD), UC(0x00D3), UC(0x00D6), __________,
129                             UC(0x00CE), UC(0x00C1), UC(0x00C2), UC(0x00D8), UC(0x00B0), UC(0x00A8),
130                 __________, UC(0x00D1), UC(0x00DD), UC(0x00C7), UC(0x00D4), UC(0x203D), __________,
131                                         UC(0x00F7), __________, __________, __________, __________,
132                 __________, __________,
133                 __________,
134                 __________, __________, UC(0x00AA)
135         ),
136
137         [NUMP] = LAYOUT_ergodox(
138                 // left hand
139                 __________, __________, KC_P7,      KC_P8,      KC_P9,      KC_PSLS,    __________,
140                 __________, __________, KC_P4,      KC_P5,      KC_P6,      KC_PAST,    __________,
141                 __________, __________, KC_P1,      KC_P2,      KC_P3,      KC_PMNS,
142                 __________, __________, KC_P0,      KC_PCMM,    KC_PDOT,    KC_PPLS,    __________,
143                 __________, __________, __________, __________, __________,
144                                                                             __________, __________,
145                                                                                         __________,
146                                                                 __________, __________, __________,
147                 // right hand
148                 __________, __________, KC_P7,      KC_P8,      KC_P9,      KC_PSLS,    __________,
149                 __________, __________, KC_P4,      KC_P5,      KC_P6,      KC_PAST,    __________,
150                             __________, KC_P1,      KC_P2,      KC_P3,      KC_PMNS,    __________,
151                 __________, __________, KC_P0,      KC_PCMM,    KC_PDOT,    KC_PPLS,    __________,
152                                         __________, __________, __________, __________, __________,
153                 __________, __________,
154                 __________,
155                 __________, KC_PENT,    __________
156         ),
157
158         [FCTN] = LAYOUT_ergodox(
159                 // left hand
160                 KC_ESC,     KC_F1,      KC_F2,      KC_F3,      KC_F4,      KC_F5,      __________,
161                 KC_PSCR,    RGB_TOG,    KC_HOME,    KC_UP,      KC_END,     KC_PGUP,    __________,
162                 KC_PAUS,    __________, KC_LEFT,    KC_DOWN,    KC_RGHT,    KC_PGDN,
163                 __________, KC_MPRV,    KC_MRWD,    KC_MPLY,    KC_MFFD,    KC_MNXT,    __________,
164                 __________, __________, __________, __________, __________,
165                                                                             KC_F11,     __________,
166                                                                                         __________,
167                                                                 __________, __________, __________,
168                 // right hand
169                 __________, KC_F6,      KC_F7,      KC_F8,      KC_F9,      KC_F10,     KC_SYSREQ,
170                 __________, UC(0x2014), KC_LBRC,    KC_RBRC,    S(KC_LBRC), S(KC_RBRC), KC_INS,
171                             KC_LEFT,    KC_DOWN,    KC_UP,      KC_RGHT,    KC_BRIU,    KC_CLR,
172                 __________, KC_MSTP,    KC_MUTE,    KC_VOLD,    KC_VOLU,    KC_BRID,    __________,
173                                         __________, __________, __________, __________, __________,
174                 __________, KC_F12,
175                 __________,
176                 __________, __________, __________
177         ),
178 };
179
180 void eeconfig_init_user(void) {
181         set_unicode_input_mode(UC_LNX); // Linux
182         //set_unicode_input_mode(UC_OSX); // Mac OSX
183         //set_unicode_input_mode(UC_WIN); // Windows (with registry key, see wiki)
184         //set_unicode_input_mode(UC_WINC); // Windows (with WinCompose, see wiki)
185 };
186
187 // Runs just one time when the keyboard initializes.
188 void matrix_init_user(void) {
189         ergodox_board_led_off();
190 };
191
192 // Runs constantly in the background, in a loop.
193 void matrix_scan_user(void) {
194
195         if (IS_LAYER_ON(SYMB) || IS_LAYER_ON(SYSH)) {
196                 ergodox_right_led_1_on();
197         } else {
198                 ergodox_right_led_1_off();
199         }
200
201         if (IS_LAYER_ON(NUMP)) {
202                 ergodox_right_led_2_on();
203         } else {
204                 ergodox_right_led_2_off();
205         }
206
207         if (IS_LAYER_ON(FCTN)) {
208                 ergodox_right_led_3_on();
209         } else {
210                 ergodox_right_led_3_off();
211         }
212
213 };