Big overhaul to Drashna keymaps and userspace (#3097)
[jackhill/qmk/firmware.git] / users / drashna / drashna.h
CommitLineData
dbd33782
DJ
1/*
2Copyright 2017 Christopher Courtney <drashna@live.com> @drashna
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
363aa8aa 18#ifndef USERSPACE
19#define USERSPACE
363aa8aa 20#include "quantum.h"
21
0c665696 22// Define layer names
1bb77c08
DJ
23enum userspace_layers {
24 _QWERTY = 0,
25 _NUMLOCK = 0,
26 _COLEMAK,
27 _DVORAK,
28 _WORKMAN,
29 _MODS,
1bb77c08
DJ
30 _GAMEPAD,
31 _DIABLO,
1bb77c08
DJ
32 _MACROS,
33 _MEDIA,
34 _LOWER,
35 _RAISE,
36 _ADJUST,
37};
363aa8aa 38
39//define modifiers
40#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
41#define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL))
42#define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
dbd33782 43#define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI))
363aa8aa 44
3d1349b2 45
61a2169f
DJ
46// RGB color codes are no longer located here anymore. Instead, you will want to
47// head to https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h
363aa8aa 48
e5540dd0
DJ
49extern bool clicky_enable;
50
51#ifdef RGBLIGHT_ENABLE
52void rgblight_sethsv_default_helper(uint8_t index);
53#endif // RGBLIGHT_ENABLE
54
3d1349b2
DJ
55void tap(uint16_t keycode);
56bool process_record_secrets(uint16_t keycode, keyrecord_t *record);
57
58
59#define EECONFIG_USERSPACE (uint8_t *)19
e5540dd0
DJ
60
61typedef union {
53a6501d 62 uint8_t raw;
e5540dd0 63 struct {
53a6501d
DJ
64 bool clicky_enable :1;
65 bool rgb_layer_change :1;
66 bool is_overwatch :1;
3d1349b2 67 bool nuke_switch :1;
e5540dd0
DJ
68 };
69} userspace_config_t;
363aa8aa 70
2ec1ab2b
DJ
71enum userspace_custom_keycodes {
72 EPRM = SAFE_RANGE, // can always be here
363aa8aa 73 VRSN,
74 KC_QWERTY,
75 KC_COLEMAK,
76 KC_DVORAK,
77 KC_WORKMAN,
363aa8aa 78 KC_DIABLO_CLEAR,
79 KC_OVERWATCH,
80 KC_SALT,
81 KC_MORESALT,
82 KC_SALTHARD,
83 KC_GOODGAME,
84 KC_SYMM,
363aa8aa 85 KC_JUSTGAME,
86 KC_GLHF,
87 KC_TORB,
88 KC_AIM,
dbd33782
DJ
89 KC_C9,
90 KC_GGEZ,
363aa8aa 91 KC_MAKE,
92 KC_RESET,
dbd33782 93 KC_RGB_T,
d5a76e89
DJ
94 KC_SECRET_1,
95 KC_SECRET_2,
96 KC_SECRET_3,
97 KC_SECRET_4,
98 KC_SECRET_5,
1bb77c08 99 KC_CCCV,
3d1349b2
DJ
100 KC_NUKE,
101
1bb77c08
DJ
102#ifdef UNICODE_ENABLE
103 UC_FLIP,
104#endif //UNICODE_ENABLE
dbd33782
DJ
105 NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes
106};
107
e5540dd0
DJ
108#define LOWER MO(_LOWER)
109#define RAISE MO(_RAISE)
110#define ADJUST MO(_ADJUST)
111
112
0c665696
DJ
113#define KC_SEC1 KC_SECRET_1
114#define KC_SEC2 KC_SECRET_2
115#define KC_SEC3 KC_SECRET_3
116#define KC_SEC4 KC_SECRET_4
117#define KC_SEC5 KC_SECRET_5
118
61a2169f
DJ
119#define QWERTY KC_QWERTY
120#define DVORAK KC_DVORAK
121#define COLEMAK KC_COLEMAK
122#define WORKMAN KC_WORKMAN
61a2169f 123
3d1349b2 124#define KC_RST KC_RESET
e5540dd0
DJ
125
126#ifdef SWAP_HANDS_ENABLE
127#define KC_C1R3 SH_TT
128#else // SWAP_HANDS_ENABLE
129#define KC_C1R3 KC_BSPC
130#endif // SWAP_HANDS_ENABLE
131
132// OSM keycodes, to keep things clean and easy to change
133#define KC_MLSF OSM(MOD_LSFT)
134#define KC_MRSF OSM(MOD_RSFT)
135
3d1349b2
DJ
136#define OS_LGUI OSM(MOD_LGUI)
137#define OS_RGUI OSM(MOD_RGUI)
138#define OS_LSFT OSM(MOD_LSFT)
139#define OS_RSFT OSM(MOD_RSFT)
140#define OS_LCTL OSM(MOD_LCTL)
141#define OS_RCTL OSM(MOD_RCTL)
142#define OS_LALT OSM(MOD_LALT)
143#define OS_RALT OSM(MOD_RALT)
144#define ALT_APP ALT_T(KC_APP)
145
e5540dd0
DJ
146#define MG_NKRO MAGIC_TOGGLE_NKRO
147
148
dbd33782
DJ
149#ifdef TAP_DANCE_ENABLE
150enum {
151 TD_D3_1 = 0,
152 TD_D3_2,
153 TD_D3_3,
154 TD_D3_4
363aa8aa 155};
452d23da
DJ
156#endif // TAP_DANCE_ENABLE
157
dbd33782 158
452d23da 159// Custom Keycodes for Diablo 3 layer
0c665696
DJ
160// But since TD() doesn't work when tap dance is disabled
161// We use custom codes here, so we can substitute the right stuff
17200f47
DJ
162#ifdef TAP_DANCE_ENABLE
163#define KC_D3_1 TD(TD_D3_1)
164#define KC_D3_2 TD(TD_D3_2)
165#define KC_D3_3 TD(TD_D3_3)
166#define KC_D3_4 TD(TD_D3_4)
452d23da 167#else // TAP_DANCE_ENABLE
17200f47
DJ
168#define KC_D3_1 KC_1
169#define KC_D3_2 KC_2
170#define KC_D3_3 KC_3
171#define KC_D3_4 KC_4
452d23da
DJ
172#endif // TAP_DANCE_ENABLE
173
598384bc
DJ
174
175
0c665696
DJ
176// Since our quirky block definitions are basically a list of comma separated
177// arguments, we need a wrapper in order for these definitions to be
598384bc 178// expanded before being used as arguments to the LAYOUT_xxx macro.
0c665696
DJ
179#if (!defined(LAYOUT) && defined(KEYMAP))
180#define LAYOUT KEYMAP
181#endif
182
53a6501d 183#define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__)
4ec03111 184#define LAYOUT_ergodox_pretty_wrapper(...) LAYOUT_ergodox_pretty(__VA_ARGS__)
53a6501d
DJ
185#define KEYMAP_wrapper(...) LAYOUT(__VA_ARGS__)
186#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__)
598384bc 187
452d23da 188
598384bc
DJ
189// Blocks for each of the four major keyboard layouts
190// Organized so we can quickly adapt and modify all of them
191// at once, rather than for each keyboard, one at a time.
0c665696 192// And this allows for much cleaner blocks in the keymaps.
598384bc
DJ
193// For instance Tap/Hold for Control on all of the layouts
194
452d23da
DJ
195// NOTE: These are all the same length. If you do a search/replace
196// then you need to add/remove underscores to keep the
0c665696 197// lengths consistent.
452d23da 198
598384bc
DJ
199#define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T
200#define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G
201#define _________________QWERTY_L3_________________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B
202
203#define _________________QWERTY_R1_________________ KC_Y, KC_U, KC_I, KC_O, KC_P
204#define _________________QWERTY_R2_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN
205#define _________________QWERTY_R3_________________ KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
206
207
208#define _________________COLEMAK_L1________________ KC_Q, KC_W, KC_F, KC_P, KC_G
209#define _________________COLEMAK_L2________________ KC_A, KC_R, KC_S, KC_T, KC_D
210#define _________________COLEMAK_L3________________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B
211
212#define _________________COLEMAK_R1________________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN
213#define _________________COLEMAK_R2________________ KC_H, KC_N, KC_E, KC_I, KC_O
214#define _________________COLEMAK_R3________________ KC_K, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
215
0c665696
DJ
216#define ______________COLEMAK_MOD_DH_L1____________ KC_Q, KC_W, KC_F, KC_P, KC_B
217#define ______________COLEMAK_MOD_DH_L2____________ KC_A, KC_R, KC_S, KC_T, KC_G
218#define ______________COLEMAK_MOD_DH_L3____________ CTL_T(KC_Z), KC_X, KC_C, KC_D, KC_V
219
220#define ______________COLEMAK_MOD_DH_R1____________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN
3d1349b2
DJ
221#define ______________COLEMAK_MOD_DH_R2____________ KC_M, KC_N, KC_E, KC_I, KC_O
222#define ______________COLEMAK_MOD_DH_R3____________ KC_K, KC_H, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
0c665696 223
598384bc
DJ
224
225#define _________________DVORAK_L1_________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y
226#define _________________DVORAK_L2_________________ KC_A, KC_O, KC_E, KC_U, KC_I
227#define _________________DVORAK_L3_________________ CTL_T(KC_SCLN),KC_Q, KC_J, KC_K, KC_X
228
229#define _________________DVORAK_R1_________________ KC_F, KC_G, KC_C, KC_R, KC_L
230#define _________________DVORAK_R2_________________ KC_D, KC_H, KC_T, KC_N, KC_S
231#define _________________DVORAK_R3_________________ KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z)
232
233
1bb77c08
DJ
234#define _________________WORKMAN_L1________________ KC_Q, KC_D, KC_R, KC_W, KC_B
235#define _________________WORKMAN_L2________________ KC_A, KC_S, KC_H, KC_T, KC_G
236#define _________________WORKMAN_L3________________ CTL_T(KC_Z), KC_X, KC_M, KC_C, KC_V
598384bc 237
1bb77c08
DJ
238#define _________________WORKMAN_R1________________ KC_J, KC_F, KC_U, KC_P, KC_SCLN
239#define _________________WORKMAN_R2________________ KC_Y, KC_N, KC_E, KC_O, KC_I
240#define _________________WORKMAN_R3________________ KC_K, KC_L, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
598384bc
DJ
241
242
0c665696
DJ
243#define _________________NORMAN_L1_________________ KC_Q, KC_W, KC_D, KC_F, KC_K
244#define _________________NORMAN_L2_________________ KC_A, KC_S, KC_E, KC_T, KC_G
245#define _________________NORMAN_L3_________________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B
246
247#define _________________NORMAN_R1_________________ KC_J, KC_U, KC_R, KC_L, KC_SCLN
3d1349b2 248#define _________________NORMAN_R2_________________ KC_Y, KC_N, KC_I, KC_O, KC_U
0c665696
DJ
249#define _________________NORMAN_R3_________________ KC_P, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
250
e5540dd0
DJ
251#define ________________NUMBER_LEFT________________ KC_1, KC_2, KC_3, KC_4, KC_5
252#define ________________NUMBER_RIGHT_______________ KC_6, KC_7, KC_8, KC_9, KC_0
53a6501d
DJ
253#define _________________FUNC_LEFT_________________ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5
254#define _________________FUNC_RIGHT________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10
598384bc
DJ
255
256// Since we have 4 default layouts (QWERTY, DVORAK, COLEMAK and WORKMAN),
257// this allows us to quickly modify the bottom row for all of the layouts
258// so we don't have to alter it 4 times and hope that we haven't missed
259// anything
61a2169f 260#define ___________ERGODOX_BOTTOM_LEFT_____________ OSM(MOD_MEH), OSM(MOD_LGUI), KC_LBRC, KC_RBRC
598384bc 261#define ___________ERGODOX_BOTTOM_RIGHT____________ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
6f5e8827
DJ
262
263
3d1349b2 264#define __________________ERGODOX_THUMB_CLUSTER_____________________ ALT_T(KC_APP), OSM(MOD_LGUI), OSM(MOD_RGUI), CTL_T(KC_ESCAPE), \
1bb77c08 265 KC_HOME, KC_PGUP, \
53a6501d 266 LT(_LOWER, KC_SPACE),KC_BSPC, KC_END, KC_PGDN, KC_DEL, LT(_RAISE, KC_ENTER)
1bb77c08
DJ
267
268
e5540dd0 269#endif // !USERSPACE