]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/diverge3/keymaps/workman/keymap.c
Diverge3 - Workman Layout (#3682)
[qmk_firmware.git] / keyboards / diverge3 / keymaps / workman / keymap.c
1 /* Copyright 2017 IslandMan93
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 #include QMK_KEYBOARD_H
17
18 // KEYMAP
19 extern keymap_config_t keymap_config;
20
21 #define _WORKMAN_P 0
22 #define _GAME 1
23 #define _RAISE 2
24
25 #define _______ KC_TRNS
26
27 #define SHIFT_MOD   MOD_BIT(KC_LSFT)
28 #define SPACE_RAISE LT(_RAISE, KC_SPC)
29 #define ENT_RAISE   LT(_RAISE, KC_ENT)
30 #define PAGE_PREV   S(LCTL(KC_TAB))
31 #define PAGE_NEXT   LCTL(KC_TAB)
32
33 enum custom_keycodes
34 {
35   LO_BSPC = SAFE_RANGE,
36   LO_1,
37   LO_2,
38   LO_3,
39   LO_4,
40   LO_5,
41   LO_6,
42   LO_7,
43   LO_8,
44   LO_9,
45   LO_0,
46 };
47
48 bool process_record_user(uint16_t keycode, keyrecord_t* record)
49 {
50     if (record->event.pressed) {
51         switch (keycode) {
52             case LO_BSPC:
53                 if (record->event.pressed) {
54                     if (get_mods() & SHIFT_MOD) {
55                         uint8_t current_mods = get_mods();
56                         clear_mods();
57                         SEND_STRING(SS_TAP(X_DELETE));
58                         set_mods(current_mods);
59                     } else {
60                         SEND_STRING(SS_TAP(X_BSPACE));
61                     }
62                 }
63                 return false;
64             case LO_1:
65                 if (record->event.pressed) {
66                     uint8_t current_mods = get_mods();
67                     if (current_mods & SHIFT_MOD) {
68                         clear_mods();
69                         SEND_STRING("1");
70                         set_mods(current_mods);
71                     } else {
72                         SEND_STRING("!");
73                     }
74                 }
75                 return false;
76             case LO_2:
77                 if (record->event.pressed) {
78                     uint8_t current_mods = get_mods();
79                     if (current_mods & SHIFT_MOD) {
80                         clear_mods();
81                         SEND_STRING("2");
82                         set_mods(current_mods);
83                     } else {
84                         SEND_STRING("@");
85                     }
86                 }
87                 return false;
88             case LO_3:
89                 if (record->event.pressed) {
90                     uint8_t current_mods = get_mods();
91                     if (current_mods & SHIFT_MOD) {
92                         clear_mods();
93                         SEND_STRING("3");
94                         set_mods(current_mods);
95                     } else {
96                         SEND_STRING("#");
97                     }
98                 }
99                 return false;
100             case LO_4:
101                 if (record->event.pressed) {
102                     uint8_t current_mods = get_mods();
103                     if (current_mods & SHIFT_MOD) {
104                         clear_mods();
105                         SEND_STRING("4");
106                         set_mods(current_mods);
107                     } else {
108                         SEND_STRING("$");
109                     }
110                 }
111                 return false;
112             case LO_5:
113                 if (record->event.pressed) {
114                     uint8_t current_mods = get_mods();
115                     if (current_mods & SHIFT_MOD) {
116                         clear_mods();
117                         SEND_STRING("5");
118                         set_mods(current_mods);
119                     } else {
120                         SEND_STRING("%");
121                     }
122                 }
123                 return false;
124             case LO_6:
125                 if (record->event.pressed) {
126                     uint8_t current_mods = get_mods();
127                     if (current_mods & SHIFT_MOD) {
128                         clear_mods();
129                         SEND_STRING("6");
130                         set_mods(current_mods);
131                     } else {
132                         SEND_STRING("^");
133                     }
134                 }
135                 return false;
136             case LO_7:
137                 if (record->event.pressed) {
138                     uint8_t current_mods = get_mods();
139                     if (current_mods & SHIFT_MOD) {
140                         clear_mods();
141                         SEND_STRING("7");
142                         set_mods(current_mods);
143                     } else {
144                         SEND_STRING("&");
145                     }
146                 }
147                 return false;
148             case LO_8:
149                 if (record->event.pressed) {
150                     uint8_t current_mods = get_mods();
151                     if (current_mods & SHIFT_MOD) {
152                         clear_mods();
153                         SEND_STRING("8");
154                         set_mods(current_mods);
155                     } else {
156                         SEND_STRING("*");
157                     }
158                 }
159                 return false;
160             case LO_9:
161                 if (record->event.pressed) {
162                     uint8_t current_mods = get_mods();
163                     if (current_mods & SHIFT_MOD) {
164                         clear_mods();
165                         SEND_STRING("9");
166                         set_mods(current_mods);
167                     } else {
168                         SEND_STRING("(");
169                     }
170                 }
171                 return false;
172             case LO_0:
173                 if (record->event.pressed) {
174                     uint8_t current_mods = get_mods();
175                     if (current_mods & SHIFT_MOD) {
176                         clear_mods();
177                         SEND_STRING("0");
178                         set_mods(current_mods);
179                     } else {
180                         SEND_STRING(")");
181                     }
182                 }
183                 return false;
184         }
185     }
186     return true;
187 };
188
189 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
190
191     [_WORKMAN_P] = LAYOUT(
192         KC_ESC,  LO_1,    LO_2,      LO_3,      LO_4,    LO_5,    LO_6,                            LO_6,      LO_7,        LO_8,    LO_9,    LO_0,   KC_MINS, KC_ESC,
193         KC_GRV,  KC_Q,    KC_D,      KC_R,      KC_W,    KC_B,    KC_LPRN,                         KC_RPRN,   KC_J,        KC_F,    KC_U,    KC_P,   KC_SCLN, KC_EQL,
194         KC_TAB,  KC_A,    KC_S,      KC_H,      KC_T,    KC_G,    KC_LCBR,                         KC_RCBR,   KC_Y,        KC_N,    KC_E,    KC_O,   KC_I,    KC_BSLS,
195         KC_LCTL, KC_Z,    KC_X,      KC_M,      KC_C,    KC_V,    KC_LBRC,                         KC_RBRC,   KC_K,        KC_L,    KC_COMM, KC_DOT, KC_SLSH, KC_QUOT,
196         KC_LSFT, RESET,   PAGE_PREV, PAGE_NEXT, KC_END,  KC_LGUI, KC_LALT, TG(_GAME),     LO_BSPC, ENT_RAISE, SPACE_RAISE, KC_LEFT, KC_DOWN, KC_UP,  KC_RGHT, KC_RCTL),
197
198     [_GAME] = LAYOUT(
199         KC_ESC,  KC_1,    KC_2,      KC_3,      KC_4,    KC_5,    KC_6,                            KC_6,      KC_7,        KC_8,    KC_9,    KC_0,   KC_MINS, KC_ESC,
200         KC_GRV,  KC_Q,    KC_D,      KC_R,      KC_W,    KC_B,    KC_LPRN,                         KC_RPRN,   KC_J,        KC_F,    KC_U,    KC_P,   KC_SCLN, KC_EQL,
201         KC_TAB,  KC_A,    KC_S,      KC_H,      KC_T,    KC_G,    KC_LCBR,                         KC_RCBR,   KC_Y,        KC_N,    KC_E,    KC_O,   KC_I,    KC_BSLS,
202         KC_LCTL, KC_Z,    KC_X,      KC_M,      KC_C,    KC_V,    KC_LBRC,                         KC_RBRC,   KC_K,        KC_L,    KC_COMM, KC_DOT, KC_SLSH, KC_QUOT,
203         KC_LSFT, KC_F1,   KC_F2,     KC_3,      KC_F5,   KC_SPC,  KC_LALT, TG(_GAME),     LO_BSPC, ENT_RAISE, SPACE_RAISE, KC_LEFT, KC_DOWN, KC_UP,  KC_RGHT, KC_RCTL),
204
205     [_RAISE] = LAYOUT(
206         _______, KC_F1,   KC_F2,     KC_F3,     KC_F4,   KC_F5,   KC_F6,                           KC_F6,     KC_F7,       KC_F8,   KC_F9,   KC_F10,  KC_F11,  RESET,
207         _______, _______, _______,   _______,   _______, _______, BL_INC,                          KC_VOLU,   _______,     _______, _______, _______, _______, KC_F12,
208         _______, _______, _______,   _______,   _______, _______, BL_DEC,                          KC_VOLD,   KC_LEFT,     KC_DOWN, KC_UP,   KC_RGHT, _______, _______,
209         _______, _______, _______,   _______,   _______, _______, BL_BRTG,                         KC_MUTE,   _______,     _______, KC_MPRV, KC_MNXT, KC_MPLY, _______,
210         _______, _______, _______,   _______,   _______, _______, BL_TOGG, _______,       _______, _______,   _______,     _______, _______, _______, _______, _______),
211
212 };