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