]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/ergodox_ez/keymaps/skug/keymap.c
Keymap: Update to ergodox layout (#4134)
[qmk_firmware.git] / keyboards / ergodox_ez / keymaps / skug / keymap.c
1 /* Copyright 2018 Andreas Lindhé, Christoffer Holmberg
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15  */
16
17
18
19
20
21 #include QMK_KEYBOARD_H
22 #include "version.h"
23 #include "keymap_swedish.h"
24
25 #define BASE 0 // default layer
26 #define SYMB 1 // symbols
27 #define MDIA 2 // media keys
28 #define ARRW 3 // arrow + soon mouse
29
30 enum custom_keycodes {
31   PLACEHOLDER = SAFE_RANGE, // can always be here
32   EPRM,
33   VRSN,
34   RGB_SLD
35 };
36
37 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
38 /* Keymap 0: Basic layer
39  *
40  * ,--------------------------------------------------.           ,--------------------------------------------------.
41  * |   ½    |   !  |  "   |  #   |  #   |  %   | Ins  |           |  L1  |   &  |  /   |  (   |  )   |  =   |  ?     |
42  * |   §    |   1  |  2 @ |  3 £ |  4 $ |  5   |      |           |      |   6  |  7 { |  8 [ |  9 ] |  0 } |  + \   |
43  * |--------+------+------+------+------+-------------|           |------+------+------+------+------+------+--------|
44  * |  Tab   |   Q  |   W  |   E  |   R  |   T  |  L2  |           |  L2  |   Y  |   U  |   I  |   O  |   P  |   Å    |
45  * |        |      |      |      |      |      |      |           |      |      |      |      |      |      |        |
46  * |--------+------+------+------+------+------|      |           |      |------+------+------+------+------+--------|
47  * |   L4   |   A  |   S  |   D  |   F  |   G  |------|           |------|   H  |   J  |   K  |   L  |Ö / L3|   Ä/L2 |
48  * |        |      |      |      |      |      |      |           |      |      |      |      |      |      |        |
49  * |--------+------+------+------+------+------| Back |           |Forwd |------+------+------+------+------+--------|
50  * | LShift/|  Z   |   X  |   C  |   V  |   B  |      |           |      |   N  |   M  |   ;  |   :  |  _   | RShift/|
51  * |    (   |      |      |      |      |      |      |           |      |      |      |   ,  |   .  |  -   |   )    |
52  * `--------+------+------+------+------+-------------'           `-------------+------+------+------+------+--------'
53  *   | '/   |  `   |Alt   | Left | Right|                                       |  Spc | Bksp | AltGr|  *   |  ~/  |
54  *   | Ctrl |  '   |      |      |      |                                       |      |      |      |      | Ctrl |
55  *   `----------------------------------'                                       `----------------------------------'
56  *                                        ,-------------.       ,---------------.
57  *                                        | <>|  | End  |       | Home |   ^    |
58  *                                 ,------|------|------|       |------+--------+------.
59  *                                 | Left | Right| PgDn |       | PgUp |   Up   | Down |
60  *                                 |------|------|------|       |------|--------|------|
61  *                                 | Ctrl/| Alt/ |      |       |      |  Alt/  | Ctrl/|
62  *                                 | Enter| Esc  | Lgui |       | Lgui |  Esc   | Enter|
63  *                                 `--------------------'       `----------------------'
64  */
65 // If it accepts an argument (i.e, is a function), it doesn't need KC_
66 // Otherwise, it needs KC_*
67 [BASE] = LAYOUT_ergodox_80(  // layer 0 : default
68     // left hand
69     NO_HALF,          KC_1,           KC_2,          KC_3,    KC_4,    KC_5,   KC_INS,
70     KC_TAB,           KC_Q,           KC_W,          KC_E,    KC_R,    KC_T,   TG(SYMB),
71     MO(ARRW),         KC_A,           KC_S,          KC_D,    KC_F,    KC_G,
72     KC_LSPO,          CTL_T(KC_Z),    KC_X,          KC_C,    KC_V,    KC_B,   KC_WBAK,
73     CTL_T(NO_APOS),   NO_ACUT,        KC_LALT,       KC_BSPC, KC_SPC,
74                                                                              NO_LESS,   KC_END,
75                                                               KC_LEFT,      KC_RIGHT,  KC_PGDN,
76                                                         CTL_T(KC_ENT), ALT_T(KC_ESC),  KC_LGUI,
77
78     // right hand
79          TO(ARRW),       KC_6,   KC_7,   KC_8,    KC_9,    KC_0,              NO_PLUS,
80          TG(SYMB),       KC_Y,   KC_U,   KC_I,    KC_O,    KC_P,              NO_AA,
81                          KC_H,   KC_J,   KC_K,    KC_L,    LT(MDIA, NO_OSLH), LT(SYMB, NO_AE),
82          KC_WFWD,        KC_N,   KC_M,   KC_COMM, KC_DOT,  NO_MINS,           KC_RSPC,
83                                  KC_SPC, KC_BSPC, NO_ALGR, NO_ASTR,           CTL_T(NO_TILD),
84         KC_HOME,  NO_CIRC,
85         KC_PGUP,  KC_UP,         KC_DOWN,
86         KC_LGUI,  ALT_T(KC_ESC), CTL_T(KC_ENT)
87 ),
88 /* Keymap: Symbol Layer
89  *
90  * ,--------------------------------------------------.           ,--------------------------------------------------.
91  * |Version |  F1  |  F2  |  F3  |  F4  |  F5  |      |           |      |  F6  |  F7  |  F8  |  F9  |  F10 |   F11  |
92  * |--------+------+------+------+------+-------------|           |------+------+------+------+------+------+--------|
93  * |        |   !  |   @  |   {  |   }  |   |  |      |           |      |   Up |   7  |   8  |   9  |   *  |   F12  |
94  * |--------+------+------+------+------+------|      |           |      |------+------+------+------+------+--------|
95  * |        |   #  |   $  |   (  |   )  |   `  |------|           |------| Down |   4  |   5  |   6  |   +  |        |
96  * |--------+------+------+------+------+------|      |           |      |------+------+------+------+------+--------|
97  * |        |   %  |   ^  |   [  |   ]  |   ~  |      |           |      |   &  |   1  |   2  |   3  |   -  |        |
98  * `--------+------+------+------+------+-------------'           `-------------+------+------+------+------+--------'
99  *   |      |      |      |      |      |                                       |      |    . |   0  |   =  |      |
100  *   `----------------------------------'                                       `----------------------------------'
101  *                                        ,-------------.       ,-------------.
102  *                                        |      |      |       |      |      |
103  *                                 ,------|------|------|       |------+------+------.
104  *                                 |      |      |      |       |      |      |      |
105  *                                 |------|------|------|       |------|------|------|
106  *                                 |      |      |      |       |      |      |      |
107  *                                 `--------------------'       `--------------------'
108  */
109 // SYMBOLS
110 [SYMB] = LAYOUT_ergodox_80(
111        // left hand
112        VRSN,   KC_F1,  KC_F2,  KC_F3,  KC_F4,  KC_F5,  _______,
113        _______,KC_EXLM,NO_AT,  NO_LCBR,NO_RCBR,NO_PIPE,_______,
114        _______,KC_HASH,NO_DLR, NO_LPRN,NO_RPRN,NO_GRV,
115        _______,KC_PERC,NO_CIRC,NO_LBRC,NO_RBRC,NO_TILD,_______,
116           EPRM,_______,_______,_______,_______,
117                                        _______,_______,
118                                _______,_______,_______,
119                                _______,_______,_______,
120        // right hand
121        _______, KC_F6,   KC_F7,  KC_F8,   KC_F9,   KC_F10,  KC_F11,
122        _______, KC_UP,   KC_7,   KC_8,    KC_9,    NO_ASTR, KC_F12,
123                 KC_DOWN, KC_4,   KC_5,    KC_6,    NO_PLUS, _______,
124        _______, NO_AMPR, KC_1,   KC_2,    KC_3,    NO_MINS, _______,
125                          _______,KC_DOT,  KC_0,    NO_EQL,  _______,
126        _______, _______,
127        _______, _______, _______,
128        _______, _______, _______
129 ),
130
131 /* Keymap: Media and mouse keys
132  *
133  * ,--------------------------------------------------.           ,--------------------------------------------------.
134  * |        |      |      |      |      |      |      |           |      |      |      |      |      |      |        |
135  * |--------+------+------+------+------+-------------|           |------+------+------+------+------+------+--------|
136  * |        |      | MsUp |      |      |      |      |           |      |      |      |      |      |      |        |
137  * |--------+------+------+------+------+------|      |           |      |------+------+------+------+------+--------|
138  * |        |MsLeft|MsDown|MsRght|      |      |------|           |------|      |      |      |      |      |  Play  |
139  * |--------+------+------+------+------+------|      |           |      |------+------+------+------+------+--------|
140  * |        |      |      |      |      |      |      |           |      |      |      | Prev | Next |      |        |
141  * `--------+------+------+------+------+-------------'           `-------------+------+------+------+------+--------'
142  *   |      |      |      | Lclk | Rclk |                                       |VolUp |VolDn | Mute |      |      |
143  *   `----------------------------------'                                       `----------------------------------'
144  *                                        ,-------------.       ,-------------.
145  *                                        |      |      |       |      |      |
146  *                                 ,------|------|------|       |------+------+------.
147  *                                 |      |      |      |       |      |      |      |
148  *                                 |      |------|------|       |------|------|------|
149  *                                 |      |      |      |       |      |      |BrBck |
150  *                                 `--------------------'       `--------------------'
151  */
152 // MEDIA AND MOUSE
153 [MDIA] = LAYOUT_ergodox_80(
154         _______, _______, _______, _______, _______, _______, _______,
155         _______, _______, KC_MS_U, _______, _______, _______, _______,
156         _______, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______,
157         _______, _______, _______, _______, _______, _______, _______,
158         _______, _______, _______, KC_BTN1, KC_BTN2,
159                                             _______, _______,
160                                    _______, _______, _______,
161                                    _______, _______, _______,
162      // right hand
163         _______,  _______, _______, _______, _______, _______, _______,
164         _______,  _______, _______, _______, _______, _______, _______,
165                   _______, _______, _______, _______, _______, KC_MPLY,
166         _______,  _______, _______, KC_MPRV, KC_MNXT, _______, _______,
167                            KC_VOLU, KC_VOLD, KC_MUTE, _______, _______,
168         _______, _______,
169         _______, _______, _______,
170         _______, _______, KC_WBAK
171 ),
172  // Keymap: Ducky Style arrows
173 [ARRW] = LAYOUT_ergodox_80(
174         _______, _______, _______, _______, _______, _______, _______,
175         _______, _______, KC_UP  , _______, _______, _______, _______,
176         _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______,
177         _______, _______, _______, _______, _______, _______, _______,
178         _______, _______, _______, KC_DEL,  _______,
179                                             _______, _______,
180                                    _______, _______, _______,
181                                    _______, _______, _______,
182      // right hand
183         TO(BASE),  _______, _______, _______, _______, _______, _______,
184         _______,   _______, _______, _______, _______, _______, _______,
185                    _______, _______, _______, _______, _______, _______,
186         _______,   _______, _______, _______, _______, _______, _______,
187                             _______, _______, _______, _______, _______,
188         _______, _______,
189         _______, _______, _______,
190         _______, _______, _______
191 ),
192
193 };
194
195 const uint16_t PROGMEM fn_actions[] = {
196     [1] = ACTION_LAYER_TAP_TOGGLE(SYMB)                // FN1 - Momentary Layer 1 (Symbols)
197 };
198
199 const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
200 {
201   // MACRODOWN only works in this function
202       switch(id) {
203         case 0:
204         if (record->event.pressed) {
205           SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
206         }
207         break;
208         case 1:
209         if (record->event.pressed) { // For resetting EEPROM
210           eeconfig_init();
211         }
212         break;
213       }
214     return MACRO_NONE;
215 };
216
217 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
218   switch (keycode) {
219     // dynamically generate these.
220     case EPRM:
221       if (record->event.pressed) {
222         eeconfig_init();
223       }
224       return false;
225       break;
226     case VRSN:
227       if (record->event.pressed) {
228         SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
229       }
230       return false;
231       break;
232     case RGB_SLD:
233       if (record->event.pressed) {
234         #ifdef RGBLIGHT_ENABLE
235           rgblight_mode(1);
236         #endif
237       }
238       return false;
239       break;
240   }
241   return true;
242 }
243
244 // Runs just one time when the keyboard initializes.
245 void matrix_init_user(void) {
246
247 };
248
249
250 // Runs constantly in the background, in a loop.
251 void matrix_scan_user(void) {
252
253     uint8_t layer = biton32(layer_state);
254
255     ergodox_board_led_off();
256     ergodox_right_led_1_off();
257     ergodox_right_led_2_off();
258     ergodox_right_led_3_off();
259     switch (layer) {
260       // Binary: lsb at bottom
261         case 1:
262           ergodox_right_led_3_on();
263             break;
264         case 2:
265             ergodox_right_led_2_on();
266             break;
267         case 3:
268             ergodox_board_led_on();
269         default:
270             // none
271             break;
272     }
273 };