1 #include QMK_KEYBOARD_H
2 #include <util/delay.h>
5 extern keymap_config_t keymap_config;
8 // Each layer gets a name for readability, which is then used in the keymap matrix below.
9 // The underscores don't mean anything - you can have a layer called STUFF or any other name.
10 // Layer names don't all need to be of the same length, obviously, and you can also skip them
11 // entirely and just use numbers.
16 // Fillers to make layering more clear
17 #define _______ KC_TRNS
20 bool git_duet = false;
21 bool backlight_arrows = false;
22 bool backlight_gaming = false;
23 enum custom_keycodes {
24 /* GIT related keycodes */
25 G_ADD = SAFE_RANGE, G_BRN, G_COM, G_COU, G_CLO,
26 G_DFF, G_DUE, G_DUT, G_FTC, G_LOG, G_MAG, G_MRG,
27 G_MRT, G_PSH, G_PLL, G_RBS, G_STH, G_STS, G_TIG,
29 /* Multi-media related keycodes */
30 A_MUTE, A_NEXT, A_PLPA, A_PREV, A_VOUP, A_VDWN,
32 /* System related shortcuts */
33 F_BTN, M_WAPP, K_ARR, K_WASD,
36 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
39 * ,-----------------------------------------------------------.
40 * |Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
41 * |-----------------------------------------------------------|
42 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |
43 * |-----------------------------------------------------------|
44 * |FN | A| S| D| F| G| H| J| K| L| ;| '|Return |
45 * |-----------------------------------------------------------|
46 * |Shift | Z| X| C| V| B| N| M| ,| .| /| FN |Up |
47 * |-----------------------------------------------------------|
48 * |Ctrl|Gui |Alt | Space |Alt |Left |Down|Right|
49 * `-----------------------------------------------------------'
51 * Note: right FN triggers function layer,
52 * left FN is a one-shot button for the macro layer
55 [_QW] = LAYOUT_60_ansi_split_rshift( \
56 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \
57 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \
58 OSL(_MC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \
59 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, F_BTN, KC_UP, \
60 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT \
64 * ,-----------------------------------------------------------.
65 * |GRV|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12| DEL |
66 * |-----------------------------------------------------------|
67 * | MB3|MB2|MUP|MB1|MWU| | | |INS| |RST| | |Print|
68 * |-----------------------------------------------------------|
69 * | | ML|MDN|MR |MWD| | | | | | | |
70 * |-----------------------------------------------------------|
71 * |CAPS | | | | | | | | | | |PGUP| |
72 * |-----------------------------------------------------------|
73 * | | | | |Ctrl|HOME|PGD |END |
74 * `-----------------------------------------------------------'
76 /* Layer 1: Functions */
77 [_FL] = LAYOUT_60_ansi_split_rshift(
78 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, \
79 KC_BTN3, KC_BTN2, KC_MS_U, KC_BTN1, KC_WH_U, _______, _______, _______, KC_INS, _______, RESET, _______, _______, KC_PSCR, \
80 KC_CAPS, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_D, _______, _______, _______, _______, _______, _______, _______, KC_TILD, \
81 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP, \
82 _______, _______, _______, _______, KC_RCTL, KC_HOME, KC_PGDN, KC_END \
86 * ,-----------------------------------------------------------.
87 * |DEF| |DUE| | | | | | | | | |GAM| ARR|
88 * |-----------------------------------------------------------|
89 * | |MAG|CLO|DUT|RBS|TIG|MRT| | |COU|PSH| | | |
90 * |-----------------------------------------------------------|
91 * | |ADD|STS|DFF|FTC|PLL|MRG| |STH|LOG| | | F_OFF|
92 * |-----------------------------------------------------------|
93 * | | | |COM| |BRN| | | | |MUT|VOL+|PLPA|
94 * |-----------------------------------------------------------|
95 * | | | | |APP |PREV|VOL-|NEXT|
96 * `-----------------------------------------------------------'
100 * DEF - return to default layer
101 * DUE - enable git duet mode
103 * DUT - git duet (when in duet mode)
105 * MAG - git submodule sync --recursive && git submodule update --init --recursive && git submodule foreach --recursive "git co . && git reset --hard && git clean -dffx"
108 * MRT - git mergetool
118 * COM - git commit (or git duet commit if in duet mode)
120 * APP - application (windows menu key)
122 * VOL+ - increase volume
123 * VOL- - decrease volume
125 * PREV - previous song
127 * ARR - backlight arrow keys
128 * GAM - backlight WASD
130 * Note: git commands are SEND_STRING macros sent to the
131 * currently focused window Make sure it is your terminal :)
133 /* Layer 2: Macros (Git & Multimedia) */
134 [_MC] = LAYOUT_60_ansi_split_rshift( \
135 TO(_QW), XXXXXXX, G_DUE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, K_WASD, K_ARR, \
136 XXXXXXX, G_MAG, G_CLO, G_DUT, G_RBS, G_TIG, G_MRT, XXXXXXX, XXXXXXX, G_COU, G_PSH, XXXXXXX, XXXXXXX, XXXXXXX, \
137 XXXXXXX, G_ADD, G_STS, G_DFF, G_FTC, G_PLL, G_MRG, XXXXXXX, G_STH, G_LOG, XXXXXXX, XXXXXXX, XXXXXXX, \
138 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, G_COM, XXXXXXX, G_BRN, XXXXXXX, XXXXXXX, XXXXXXX, A_MUTE, A_PLPA, A_VOUP, \
139 XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, M_WAPP, A_PREV, A_VDWN, A_NEXT \
144 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
145 if (record->event.pressed) {
151 SEND_STRING("git add ");
155 SEND_STRING("git branch\n");
159 SEND_STRING("git clone ");
164 SEND_STRING("git duet-commit ");
166 SEND_STRING("git commit ");
171 SEND_STRING("git checkout ");
175 SEND_STRING("git diff\n");
179 git_duet = !git_duet;
189 SEND_STRING("git duet ");
194 SEND_STRING("git fetch ");
198 SEND_STRING("git log --graph\n");
202 // This is some git-magic to resync recursive submodule structures inside git projects (thx to https://github.com/jimmykarily)
203 SEND_STRING("git submodule sync --recursive && git submodule update --init --recursive && git submodule foreach --recursive \" git co . && git reset --hard && git clean -dffx \" \n");
207 SEND_STRING("git merge ");
211 SEND_STRING("git mergetool ");
215 SEND_STRING("git pull ");
219 SEND_STRING("git push ");
223 SEND_STRING("git rebase ");
227 SEND_STRING("git stash ");
231 SEND_STRING("git status\n");
235 SEND_STRING("tig\n");
243 * Begin multimedia keys
246 register_code(KC_AUDIO_MUTE);
247 unregister_code(KC_AUDIO_MUTE);
251 register_code(KC_MEDIA_PLAY_PAUSE);
252 unregister_code(KC_MEDIA_PLAY_PAUSE);
256 register_code(KC_AUDIO_VOL_UP);
259 register_code(KC_AUDIO_VOL_DOWN);
262 register_code(KC_MEDIA_PREV_TRACK);
263 unregister_code(KC_MEDIA_PREV_TRACK);
267 register_code(KC_MEDIA_NEXT_TRACK);
268 unregister_code(KC_MEDIA_NEXT_TRACK);
272 * End multimedia keys
275 // Tap dance to get the app button mapped
277 register_code(KC_APP);
278 unregister_code(KC_APP);
283 * Begin multimedia keys
286 backlight_arrows = !backlight_arrows;
287 if(backlight_arrows) {
288 gh60_poker_leds_on();
290 gh60_poker_leds_off();
295 backlight_gaming = !backlight_gaming;
296 if(backlight_gaming) {
299 gh60_wasd_leds_off();
309 * End multimedia keys
315 * Oneshots that will switch back to the default layer on KEY_UP
318 unregister_code(KC_AUDIO_VOL_UP);
322 unregister_code(KC_AUDIO_VOL_DOWN);