1 /* Copyright 2015-2017 Jack Humbert
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.
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.
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/>.
18 * ___ _ __ ___ __ __ | | __ _ _ _ __ ___ __ _
19 * / __| | '_ \ / _ \ \ \ /\ / / | |/ / | | | | | '_ ` _ \ / _` |
20 * \__ \ | | | | | (_) | \ V V / | < | |_| | | | | | | | | (_| |
21 * |___/ |_| |_| \___/ \_/\_/ |_|\_\ \__,_| |_| |_| |_| \__,_|
23 * https://github.com/snowkuma
28 #include QMK_KEYBOARD_H
30 #include "custom_keycodes.h"
31 #include "my_strings.h"
33 extern keymap_config_t keymap_config;
47 enum planck_keycodes {
59 // Tap Dance Declarations
65 // Tap Dance Definitions
66 void safe_reset(qk_tap_dance_state_t *state, void *user_data) {
67 if (state->count >=3) {
68 // Reset the keyboard if you tap the key more than three times
70 reset_tap_dance(state);
72 }; void tilde_home(qk_tap_dance_state_t *state, void *user_data) {
73 if (state->count > 2) {
74 register_code(KC_LSFT);
75 register_code(KC_GRV);
78 register_code(KC_LSFT);
79 register_code(KC_GRV);
80 if (state->count > 1) {
81 // Outputs ~/ if tilde tapped twice
82 unregister_code(KC_GRV);
83 unregister_code(KC_LSFT);
84 register_code(KC_SLSH);
89 void tilde_reset(qk_tap_dance_state_t *state, void *user_data)
91 if (state->count == 2) {
92 unregister_code(KC_SLSH);
94 unregister_code(KC_GRV);
95 unregister_code(KC_LSFT);
100 qk_tap_dance_action_t tap_dance_actions[] = {
101 [TD_RESET] = ACTION_TAP_DANCE_FN (safe_reset),
102 [TD_TILD] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, tilde_home, tilde_reset)
105 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
109 * ,-----------------------------------------------------------------------------------------------------------.
110 * | q | w | f | p | g | | | j | l | u | y | ; |
111 * | CTRL | ALT | GUI | | | | | | | GUI | ALT | CTRL |
112 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
113 * | a | r | s | t | d | | | h | n | e | i | o |
114 * | | | | Shift | | | | | Shift | | | |
115 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
116 * | z | x | c | v | b | | | k | m | , | . | ' |
117 * | | | | | | | | | | | | |
118 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
119 * | | | | Esc | BkSp | - | Tab | Space | Enter | | |
120 * | | | | Num | Regex | Arrange| Shift | Sym | Thumb | | | |
121 * `--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------'
123 [_COLEMAK] = LAYOUT_planck_grid(
124 Q_CTL, W_ALT, F_GUI, KC_P, KC_G, _______, _______, KC_J, KC_L, U_GUI, Y_ALT, SCL_CTL,
125 KC_A, KC_R, KC_S, T_SFT, KC_D, _______, _______, KC_H, N_SFT, KC_E, KC_I, KC_O,
126 KC_Z, KC_X, KC_C, KC_V, KC_B, _______, _______, KC_K, KC_M, KC_COMM, KC_DOT, KC_QUOT,
127 _______, _______, _______, ESC_NUM, BSP_REG, MIN_ARR, TAB_SFT, SPC_SYM, ENT_THU, _______, _______, _______
130 /* Symbol & Cursor Nav layer
131 * ,-----------------------------------------------------------------------------------------------------------.
132 * | ! | @ | € | & | | | | | | Home | Up | End | PgUp |
133 * | | | | | | | | | | | | |
134 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
135 * | ~ | < | % | > | + | | | | Left | Down | Right | PgDn |
136 * | 2x ~/ | | | | | | | | | | | |
137 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
138 * | ` | | £ | = | - | | | | | | | |
139 * | | | | | | | | | | | | |
140 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
141 * | | | | _ | Del | - | | f() | | | | |
142 * | | | | | Mouse | | | Sym |Function| | | |
143 * `--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------'
145 [_SYMBOL] = LAYOUT_planck_grid(
146 KC_EXLM, KC_AT, EURO, KC_AMPR, KC_PIPE, _______, _______, _______, KC_HOME, KC_UP, KC_END, KC_PGUP,
147 TD(TD_TILD), KC_LT, KC_PERC, KC_GT, KC_PLUS, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN,
148 KC_GRV, _______, GBP, KC_EQL, KC_MINS, _______, _______, _______, _______, _______, _______, _______,
149 _______, _______, _______, KC_UNDS, DEL_REG, KC_MINS, _______, _______, _______, _______, _______, _______
153 * ,-----------------------------------------------------------------------------------------------------------.
154 * | | | | | | | | * | [ | ^ | ] | : |
155 * | | | | | | | | | | | | |
156 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
157 * | | | | | | | | ? | ( | $ | ) | / |
158 * | | | | | | | | | | | | |
159 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
160 * | | | | | | | | | | { | # | } | \ |
161 * | | | | | | | | | | | | |
162 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
163 * | | | | | f() | | | Space | | | |
164 * | | | | | Regex | | | Mouse | Enter | | | |
165 * `--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------'
167 [_REGEX] = LAYOUT_planck_grid(
168 _______, _______, _______, _______, _______, _______, _______, KC_ASTR, KC_LBRC, KC_CIRC, KC_RBRC, KC_COLN,
169 _______, _______, _______, _______, _______, _______, _______, KC_QUES, KC_LPRN, KC_DLR, KC_RPRN, KC_SLSH,
170 _______, _______, _______, _______, _______, _______, _______, KC_PIPE, KC_LCBR, KC_HASH, KC_RCBR, KC_BSLS,
171 _______, _______, _______, _______, _______, _______, _______, _______, KC_ENT, _______, _______, _______
175 * ,-----------------------------------------------------------------------------------------------------------.
176 * | : | F | E | D | G | | | * | 7 | 8 | 9 | 0 |
177 * | | | | | | | | | | | | |
178 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
179 * | # | C | B | A | + | | | . | 4 | 5 | 6 | / |
180 * | | | | | | | | | | | | |
181 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
182 * | € | x | £ | = | - | | | , | 1 | 2 | 3 | \ |
183 * | | | | | | | | | | | | |
184 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
185 * | | | | f() | | | | | | | | |
186 * | | | | Number | | | | Space | Enter | | | |
187 * `--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------'
190 [_NUMBER] = LAYOUT_planck_grid(
191 KC_COLN, S(KC_F), S(KC_E), S(KC_D), S(KC_G), _______, _______, KC_ASTR, KC_7, KC_8, KC_9, KC_0,
192 KC_HASH, S(KC_C), S(KC_B), S(KC_A), KC_PLUS, _______, _______, KC_DOT, KC_4, KC_5, KC_6, KC_SLSH,
193 EURO, KC_X, GBP, KC_EQL, KC_MINS, _______, _______, KC_COMM, KC_1, KC_2, KC_3, KC_BSLS,
194 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
198 * ,-----------------------------------------------------------------------------------------------------------.
199 * | Ctrl | Alt | GUI | | | | | | | Up | | wUp |
200 * | | | | | | | | | | | | |
201 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
202 * | Btn3 | Btn2 | Btn1 | Shift | | | | | Left | Down | Right | wDn |
203 * | | | | | | | | | | | | |
204 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
205 * | | | | | | | | | | | | |
206 * | | | | | | | | | | | | |
207 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
208 * | | | | | f() | | | f() | | | |
209 * | | | | | Mouse | | | Mouse | | | | |
210 * `--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------'
212 [_MOUSE] = LAYOUT_planck_grid(
213 KC_LCTL, KC_LALT, KC_LGUI, _______, _______, _______, _______, _______, _______, KC_MS_U, _______, KC_WH_U,
214 KC_BTN3, KC_BTN2, KC_BTN1, KC_LSFT, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_D,
215 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
216 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
220 * ,-----------------------------------------------------------------------------------------------------------.
221 * | Reset | | SC_CAPF| SC_CAPP| | | | |Input L | | | |
222 * | (3x) | | | | | | | | | | | |
223 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
224 * | | | | TypeFu | CMD + | | | | Caps | emoji | iterm | |
225 * | | | | | | | | | Lock | | | |
226 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
227 * | | | VS_Code| Vim | CMD - | | | | | | | |
228 * | | | | | | | | | | | | |
229 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
230 * | | | | | | | | | f() | | | |
231 * | | | | | | | | | Thumb | | | |
232 * `--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------'
234 [_THUMB] = LAYOUT_planck_grid(
235 TD(TD_RESET), _______, SC_CAPF, SC_CAPP, _______, _______, _______, _______, INPUT_L, _______, _______, _______,
236 _______, _______, _______, TYPE_FU, TXT_PLS, _______, _______, _______, KC_CAPS, EMOJI, ITERM, _______,
237 _______, _______, VS_CODE, VIM, TXT_MIN, _______, _______, _______, _______, _______, _______, _______,
238 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
242 * ,-----------------------------------------------------------------------------------------------------------.
243 * | | | Full | | | | | | Top L | Top | Top R | |
244 * | | | Screen | | | | | | | | |
245 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
246 * | L 1/3 | L 2/3 | C 1/3 | R 2/3 | R 1/3 | | | Prev | Left | Bottom | Right | Next |
247 * | | | | | | | | | | | |
248 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
249 * | Restore| | Center | | | | | | Bottom | | Bottom | |
250 * | | | | | | | | | Left | | Right |
251 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
252 * | | | | | | f() | | | | | |
253 * | | | | | | Arrange| | | | | | |
254 * `--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------'
256 [_ARRANGE] = LAYOUT_planck_grid(
257 _______, _______, M_MAX, _______, _______, _______, _______, _______, M_TOPL, M_TOP, M_TOPR, _______,
258 M_L13, M_L23, M_C13, M_R23, M_R13, _______, _______, M_PREV, M_LEFT, M_BOTT, M_RGHT, M_NEXT,
259 M_REST, _______, M_CEN, _______, _______, _______, _______, _______, M_BOTL, _______, M_BOTR, _______,
260 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
264 * ,-----------------------------------------------------------------------------------------------------------.
265 * | Ctrl | Alt | GUI | | | | | | F7 | F8 | F9 | F10 |
266 * | | | | | | | | | | | |
267 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
268 * | | | | Shift | | | | | F4 | F5 | F6 | F11 |
269 * | | | | | | | | | | | |
270 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
271 * | | | | | | | | | F1 | F2 | F3 | F12 |
272 * | | | | | | | | | | | |
273 * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
274 * | | | | | | | | f() | f() | | | |
275 * | | | | | | | |Function|Function| | | |
276 * `--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------'
278 [_FUNCTION] = LAYOUT_planck_grid(
279 KC_LCTL, KC_LALT, KC_LGUI, _______, _______, _______, _______, KC_F13, KC_F7, KC_F8, KC_F9, KC_F10,
280 _______, _______, _______, KC_LSFT, _______, _______, _______, KC_F14, KC_F4, KC_F5, KC_F6, KC_F11,
281 _______, _______, _______, _______, _______, _______, _______, KC_F15, KC_F1, KC_F2, KC_F3, KC_F12,
282 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
288 float plover_song[][2] = SONG(PLOVER_SOUND);
289 float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
292 uint32_t layer_state_set_user(uint32_t state) {
293 state = update_tri_layer_state(state, _SYMBOL, _THUMB, _FUNCTION);
294 state = update_tri_layer_state(state, _SYMBOL, _REGEX, _MOUSE);
298 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
301 if (record->event.pressed) {
302 SEND_STRING(MY_EMAIL);
307 if (record->event.pressed) {
308 SEND_STRING(SS_LGUI(" "));
309 SEND_STRING("iterm" SS_TAP(X_ENTER));
314 if (record->event.pressed) {
315 SEND_STRING(SS_LGUI(" "));
316 SEND_STRING("type fu" SS_TAP(X_ENTER));
321 if (record->event.pressed) {
322 SEND_STRING(SS_LGUI(" "));
323 SEND_STRING("macvim.app" SS_TAP(X_ENTER));
328 if (record->event.pressed) {
329 SEND_STRING(SS_LGUI(" "));
330 SEND_STRING("visual studio code" SS_TAP(X_ENTER));
335 if (record->event.pressed) {
336 register_code(KC_LGUI);
337 register_code(KC_LCTL);
338 register_code(KC_SPC);
339 unregister_code(KC_LGUI);
340 unregister_code(KC_LCTL);
341 unregister_code(KC_SPC);
349 bool muse_mode = false;
350 uint8_t last_muse_note = 0;
351 uint16_t muse_counter = 0;
352 uint8_t muse_offset = 70;
353 uint16_t muse_tempo = 50;
355 void matrix_scan_user(void) {
358 if (muse_counter == 0) {
359 uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()];
360 if (muse_note != last_muse_note) {
361 stop_note(compute_freq_for_midi_note(last_muse_note));
362 play_note(compute_freq_for_midi_note(muse_note), 0xF);
363 last_muse_note = muse_note;
366 muse_counter = (muse_counter + 1) % muse_tempo;
371 void matrix_init_user(void) {
372 set_unicode_input_mode(UC_OSX);