diff options
Diffstat (limited to 'users/spacebarracecar/spacebarracecar.h')
| -rw-r--r-- | users/spacebarracecar/spacebarracecar.h | 242 |
1 files changed, 242 insertions, 0 deletions
diff --git a/users/spacebarracecar/spacebarracecar.h b/users/spacebarracecar/spacebarracecar.h new file mode 100644 index 000000000..42879d2ef --- /dev/null +++ b/users/spacebarracecar/spacebarracecar.h | |||
| @@ -0,0 +1,242 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "quantum.h" | ||
| 4 | #include "keymap_german.h" | ||
| 5 | |||
| 6 | enum userspace_layers { | ||
| 7 | _DEADKEY = 14, //change if more than 16 layers are required | ||
| 8 | _NAV | ||
| 9 | }; | ||
| 10 | |||
| 11 | enum userspace_custom_keycodes { | ||
| 12 | CU_GAME = SAFE_RANGE, // Toggle game mode on/off | ||
| 13 | CU_NAV, // NAV | ESC | ||
| 14 | |||
| 15 | #ifdef GERMAN_ENABLE | ||
| 16 | CU_LSFT, // LSFT | ( | ||
| 17 | CU_RSFT, // LSFT | ) | ||
| 18 | CU_COMM, // , | < | ||
| 19 | CU_DOT, // . | > | ||
| 20 | CU_SLSH, // / | ? | ||
| 21 | CU_SCLN, // ; | : | ||
| 22 | CU_QUOT, // ' | Enable deadkey layer | ||
| 23 | CU_GRV, // ` | ~ | ||
| 24 | CU_CIRC, // ^ | ||
| 25 | CU_3, // 3 | # | ||
| 26 | CU_6, // 6 | ^ | ||
| 27 | CU_7, // 7 | & | ||
| 28 | CU_8, // 8 | * | ||
| 29 | CU_9, // 9 | ( | ||
| 30 | CU_0, // 0 | ) | ||
| 31 | CU_EQL, // = | + | ||
| 32 | CU_LBRC, // [ | { | ||
| 33 | CU_RBRC, // ] | } | ||
| 34 | CU_BSLS, // \ | | | ||
| 35 | CU_Z, // Z | Y in conjunction with ctrl | ||
| 36 | CU_Y, // Y | Z in conjunction wiht ctrl | ||
| 37 | CU_ESCT, // Toggle escape of grv and circ on/off | ||
| 38 | // Deadkey Layer | ||
| 39 | CU_AE, // Ä | ||
| 40 | CU_OE, // Ö | ||
| 41 | CU_UE, // Ü | ||
| 42 | CU_SS, // ß | ||
| 43 | CU_DDQ, // " | ||
| 44 | CU_ED, // Escape deadkey layer | ||
| 45 | #endif | ||
| 46 | |||
| 47 | #ifdef RGBLIGHT_ENABLE | ||
| 48 | CU_RGBV, // Cycle through RGB brightness | ||
| 49 | #endif | ||
| 50 | |||
| 51 | NEW_SAFE_RANGE // Use for keymap specific keycodes | ||
| 52 | }; | ||
| 53 | |||
| 54 | #ifdef GERMAN_ENABLE | ||
| 55 | // these save the current shift status | ||
| 56 | extern bool lshift; | ||
| 57 | extern bool rshift; | ||
| 58 | // stuff for custom space cadet shift | ||
| 59 | extern bool lshiftp; | ||
| 60 | extern bool rshiftp; | ||
| 61 | extern uint16_t lshift_timer; | ||
| 62 | extern uint16_t rshift_timer; | ||
| 63 | |||
| 64 | extern uint8_t prev_indx; | ||
| 65 | extern uint16_t prev_kcs[6]; | ||
| 66 | |||
| 67 | void add_to_prev(uint16_t kc); | ||
| 68 | void unreg_prev(void); | ||
| 69 | |||
| 70 | extern bool esct; | ||
| 71 | #endif | ||
| 72 | |||
| 73 | // stuff for nav esc | ||
| 74 | extern bool navesc; | ||
| 75 | extern uint16_t navesc_timer; | ||
| 76 | |||
| 77 | extern bool game; | ||
| 78 | |||
| 79 | void timer_timeout(void); | ||
| 80 | |||
| 81 | bool process_record_userspace(uint16_t keycode, keyrecord_t *record); | ||
| 82 | |||
| 83 | #define CTRLX LCTL(KC_X) | ||
| 84 | #define CTRLC LCTL(KC_C) | ||
| 85 | #define CTRLV LCTL(KC_V) | ||
| 86 | |||
| 87 | #define GUIU LGUI(KC_UP) | ||
| 88 | #define GUID LGUI(KC_DOWN) | ||
| 89 | #define GUIL LGUI(KC_LEFT) | ||
| 90 | #define GUIR RGUI(KC_RIGHT) | ||
| 91 | |||
| 92 | // | ||
| 93 | // Templates for Keys, with custom shifted and non shifted Characters | ||
| 94 | // | ||
| 95 | |||
| 96 | // Normal shift status | ||
| 97 | #define SHIFT_NORM(kc1, kc2) \ | ||
| 98 | if (record->event.pressed) { \ | ||
| 99 | timer_timeout(); \ | ||
| 100 | if (lshift || rshift) { \ | ||
| 101 | register_code(KC_LSFT); \ | ||
| 102 | unregister_code(kc2); \ | ||
| 103 | register_code(kc2); \ | ||
| 104 | add_to_prev(kc2); \ | ||
| 105 | } else { \ | ||
| 106 | unregister_code(KC_LSFT); \ | ||
| 107 | unregister_code(kc1); \ | ||
| 108 | register_code(kc1); \ | ||
| 109 | } \ | ||
| 110 | } else { \ | ||
| 111 | unregister_code(kc1); \ | ||
| 112 | unregister_code(kc2); \ | ||
| 113 | } \ | ||
| 114 | return false; | ||
| 115 | |||
| 116 | // Inverted shift status | ||
| 117 | #define SHIFT_SWITCH(kc1, kc2) \ | ||
| 118 | if (record->event.pressed) { \ | ||
| 119 | timer_timeout(); \ | ||
| 120 | if (lshift || rshift) { \ | ||
| 121 | unregister_code(KC_LSFT); \ | ||
| 122 | unregister_code(kc2); \ | ||
| 123 | register_code(kc2); \ | ||
| 124 | add_to_prev(kc2); \ | ||
| 125 | } else { \ | ||
| 126 | register_code(KC_LSFT); \ | ||
| 127 | unregister_code(kc1); \ | ||
| 128 | register_code(kc1); \ | ||
| 129 | add_to_prev(kc1); \ | ||
| 130 | } \ | ||
| 131 | } else { \ | ||
| 132 | unregister_code(kc1); \ | ||
| 133 | unregister_code(kc2); \ | ||
| 134 | unreg_prev(); \ | ||
| 135 | if (lshift || rshift) \ | ||
| 136 | register_code(KC_LSFT); \ | ||
| 137 | else \ | ||
| 138 | unregister_code(KC_LSFT); \ | ||
| 139 | } \ | ||
| 140 | return false; | ||
| 141 | |||
| 142 | // All shift | ||
| 143 | #define SHIFT_ALL(kc1, kc2) \ | ||
| 144 | if (record->event.pressed) { \ | ||
| 145 | timer_timeout(); \ | ||
| 146 | register_code(KC_LSFT); \ | ||
| 147 | if (lshift || rshift) { \ | ||
| 148 | unregister_code(kc2); \ | ||
| 149 | register_code(kc2); \ | ||
| 150 | add_to_prev(kc2); \ | ||
| 151 | } else { \ | ||
| 152 | unregister_code(kc1); \ | ||
| 153 | register_code(kc1); \ | ||
| 154 | add_to_prev(kc1); \ | ||
| 155 | } \ | ||
| 156 | } else { \ | ||
| 157 | unregister_code(kc1); \ | ||
| 158 | unregister_code(kc2); \ | ||
| 159 | unreg_prev(); \ | ||
| 160 | if (lshift || rshift) \ | ||
| 161 | register_code(KC_LSFT); \ | ||
| 162 | else \ | ||
| 163 | unregister_code(KC_LSFT); \ | ||
| 164 | } \ | ||
| 165 | return false; | ||
| 166 | |||
| 167 | // All no shift | ||
| 168 | #define SHIFT_NO(kc1, kc2) \ | ||
| 169 | if (record->event.pressed) { \ | ||
| 170 | timer_timeout(); \ | ||
| 171 | unregister_code(KC_LSFT); \ | ||
| 172 | if (lshift || rshift) { \ | ||
| 173 | unregister_code(kc2); \ | ||
| 174 | register_code(kc2); \ | ||
| 175 | add_to_prev(kc2); \ | ||
| 176 | } else { \ | ||
| 177 | unregister_code(kc1); \ | ||
| 178 | register_code(kc1); \ | ||
| 179 | } \ | ||
| 180 | } else { \ | ||
| 181 | unregister_code(kc1); \ | ||
| 182 | unregister_code(kc2); \ | ||
| 183 | unreg_prev(); \ | ||
| 184 | if (lshift || rshift) \ | ||
| 185 | register_code(KC_LSFT); \ | ||
| 186 | else \ | ||
| 187 | unregister_code(KC_LSFT); \ | ||
| 188 | } \ | ||
| 189 | return false; | ||
| 190 | |||
| 191 | // All algr | ||
| 192 | #define SHIFT_ALGR(kc1, kc2) \ | ||
| 193 | if (record->event.pressed) { \ | ||
| 194 | timer_timeout(); \ | ||
| 195 | unregister_code(KC_LSFT); \ | ||
| 196 | register_code(DE_ALGR); \ | ||
| 197 | if (lshift || rshift) { \ | ||
| 198 | unregister_code(kc2); \ | ||
| 199 | register_code(kc2); \ | ||
| 200 | unregister_code(kc2); \ | ||
| 201 | register_code(KC_LSFT); \ | ||
| 202 | } else { \ | ||
| 203 | unregister_code(kc1); \ | ||
| 204 | register_code(kc1); \ | ||
| 205 | unregister_code(kc1); \ | ||
| 206 | } \ | ||
| 207 | unregister_code(DE_ALGR); \ | ||
| 208 | } \ | ||
| 209 | return false; | ||
| 210 | |||
| 211 | // Different keycode for ctrl | ||
| 212 | #define CTRL(kc1, kc2) \ | ||
| 213 | if(record->event.pressed) { \ | ||
| 214 | timer_timeout(); \ | ||
| 215 | if (lshift || rshift) \ | ||
| 216 | register_code(KC_LSFT); \ | ||
| 217 | else \ | ||
| 218 | unregister_code(KC_LSFT); \ | ||
| 219 | if (keyboard_report->mods & (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL))){ \ | ||
| 220 | register_code(kc2); \ | ||
| 221 | } else { \ | ||
| 222 | register_code(kc1); \ | ||
| 223 | } \ | ||
| 224 | } else { \ | ||
| 225 | unregister_code(kc1); \ | ||
| 226 | unregister_code(kc2); \ | ||
| 227 | } \ | ||
| 228 | return false; | ||
| 229 | |||
| 230 | // Umlaute for deadkey layer | ||
| 231 | #define UML(kc) \ | ||
| 232 | if(record->event.pressed) { \ | ||
| 233 | timer_timeout(); \ | ||
| 234 | if (lshift || rshift) \ | ||
| 235 | register_code(KC_LSFT); \ | ||
| 236 | else \ | ||
| 237 | unregister_code(KC_LSFT); \ | ||
| 238 | register_code(kc); \ | ||
| 239 | unregister_code(kc); \ | ||
| 240 | layer_off(_DEADKEY); \ | ||
| 241 | } \ | ||
| 242 | return false; | ||
