diff options
author | Guillaume Gérard <1322081+GreatWizard@users.noreply.github.com> | 2020-10-28 18:20:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-28 10:20:06 -0700 |
commit | c745cbb77a66a44549ee1ab3b1998c495c1a1ca5 (patch) | |
tree | a947f2215dcda13fac95b2620b70bc095b8d2d14 /users/greatwizard | |
parent | 6b1ae7e6aa7180b00759b5692d2ea5bd0303c566 (diff) |
[Keymap] greatwizard userspace and ortho 4x12 and 5x12 keymaps (#9584)
Diffstat (limited to 'users/greatwizard')
-rw-r--r-- | users/greatwizard/config.h | 31 | ||||
-rw-r--r-- | users/greatwizard/fn.h | 21 | ||||
-rw-r--r-- | users/greatwizard/game.c | 27 | ||||
-rw-r--r-- | users/greatwizard/game.h | 21 | ||||
-rw-r--r-- | users/greatwizard/git.c | 127 | ||||
-rw-r--r-- | users/greatwizard/git.h | 39 | ||||
-rw-r--r-- | users/greatwizard/greatwizard.c | 112 | ||||
-rw-r--r-- | users/greatwizard/greatwizard.h | 135 | ||||
-rw-r--r-- | users/greatwizard/keymap_helpers.h | 61 | ||||
-rw-r--r-- | users/greatwizard/ortho.c | 21 | ||||
-rw-r--r-- | users/greatwizard/ortho.h | 24 | ||||
-rw-r--r-- | users/greatwizard/programmer.c | 174 | ||||
-rw-r--r-- | users/greatwizard/programmer.h | 31 | ||||
-rw-r--r-- | users/greatwizard/readme.md | 32 | ||||
-rw-r--r-- | users/greatwizard/rules.mk | 31 | ||||
-rw-r--r-- | users/greatwizard/tap_dances.c | 105 | ||||
-rw-r--r-- | users/greatwizard/tap_dances.h | 65 | ||||
-rw-r--r-- | users/greatwizard/underglow.c | 109 | ||||
-rw-r--r-- | users/greatwizard/underglow.h | 24 |
19 files changed, 1190 insertions, 0 deletions
diff --git a/users/greatwizard/config.h b/users/greatwizard/config.h new file mode 100644 index 0000000000..2ee9e50900 --- /dev/null +++ b/users/greatwizard/config.h @@ -0,0 +1,31 @@ +/* Copyright 2020 Guillaume Gérard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#pragma once + +#define TAP_CODE_DELAY 5 + +#define RGBLIGHT_ANIMATIONS + +#ifdef TAP_DANCE_ENABLE +# define TAPPING_TERM 175 +# define PERMISSIVE_HOLD +#endif + +#ifdef AUTO_SHIFT_ENABLE +# define AUTO_SHIFT_TIMEOUT 135 +# define NO_AUTO_SHIFT_SPECIAL +# define NO_AUTO_SHIFT_NUMERIC +#endif diff --git a/users/greatwizard/fn.h b/users/greatwizard/fn.h new file mode 100644 index 0000000000..f842bf04b7 --- /dev/null +++ b/users/greatwizard/fn.h @@ -0,0 +1,21 @@ +/* Copyright 2020 Guillaume Gérard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#pragma once + +#include QMK_KEYBOARD_H +#include "greatwizard.h" + +#define FN MO(_FN) diff --git a/users/greatwizard/game.c b/users/greatwizard/game.c new file mode 100644 index 0000000000..eecabfa403 --- /dev/null +++ b/users/greatwizard/game.c @@ -0,0 +1,27 @@ +/* Copyright 2020 Guillaume Gérard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include "game.h" + +bool process_record_game(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case GAME: + if (record->event.pressed) { + set_single_persistent_default_layer(_GAME); + } + return false; + } + return true; +} diff --git a/users/greatwizard/game.h b/users/greatwizard/game.h new file mode 100644 index 0000000000..504129b400 --- /dev/null +++ b/users/greatwizard/game.h @@ -0,0 +1,21 @@ +/* Copyright 2020 Guillaume Gérard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#pragma once + +#include QMK_KEYBOARD_H +#include "greatwizard.h" + +bool process_record_game(uint16_t keycode, keyrecord_t *record); diff --git a/users/greatwizard/git.c b/users/greatwizard/git.c new file mode 100644 index 0000000000..4bf68fe690 --- /dev/null +++ b/users/greatwizard/git.c @@ -0,0 +1,127 @@ +/* Copyright 2020 Guillaume Gérard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include "git.h" + +bool process_record_git(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case GIT_ADD: + if (record->event.pressed) { + SEND_STRING("git add "); + } + return false; + case GIT_BRANCH: + if (record->event.pressed) { + SEND_STRING("git branch "); + } + return false; + case GIT_CHECKOUT: + if (record->event.pressed) { + SEND_STRING("git checkout "); + } + return false; + case GIT_CHERRYPICK: + if (record->event.pressed) { + SEND_STRING("git cherry-pick "); + } + return false; + case GIT_COMMIT: + if (record->event.pressed) { + SEND_STRING("git commit -m \"\""SS_TAP(X_LEFT)); + } + return false; + case GIT_DIFF: + if (record->event.pressed) { + SEND_STRING("git diff "); + } + return false; + case GIT_FETCH: + if (record->event.pressed) { + SEND_STRING("git fetch "); + } + return false; + case GIT_GREP: + if (record->event.pressed) { + SEND_STRING("git grep "); + } + return false; + case GIT_LOG: + if (record->event.pressed) { + SEND_STRING("git log --decorate --oneline --graph "); + } + return false; + case GIT_INIT: + if (record->event.pressed) { + SEND_STRING("git init "); + } + return false; + case GIT_MV: + if (record->event.pressed) { + SEND_STRING("git mv "); + } + return false; + case GIT_MERGE: + if (record->event.pressed) { + SEND_STRING("git merge "); + } + return false; + case GIT_PUSH: + if (record->event.pressed) { + SEND_STRING("git push "); + } + return false; + case GIT_PULL: + if (record->event.pressed) { + SEND_STRING("git pull "); + } + return false; + case GIT_REBASE: + if (record->event.pressed) { + SEND_STRING("git rebase "); + } + return false; + case GIT_REMOTE: + if (record->event.pressed) { + SEND_STRING("git remote "); + } + return false; + case GIT_RESET: + if (record->event.pressed) { + SEND_STRING("git reset "); + } + return false; + case GIT_SHOW: + if (record->event.pressed) { + SEND_STRING("git show "); + } + return false; + case GIT_STASH: + if (record->event.pressed) { + SEND_STRING("git stash "); + } + return false; + case GIT_STATUS: + if (record->event.pressed) { + SEND_STRING("git status "); + } + return false; + case GIT_TAG: + if (record->event.pressed) { + SEND_STRING("git tag "); + } + return false; + } + return true; +} diff --git a/users/greatwizard/git.h b/users/greatwizard/git.h new file mode 100644 index 0000000000..c3b4a617d0 --- /dev/null +++ b/users/greatwizard/git.h @@ -0,0 +1,39 @@ +/* Copyright 2020 Guillaume Gérard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#pragma once + +#include QMK_KEYBOARD_H +#include "greatwizard.h" + +bool process_record_git(uint16_t keycode, keyrecord_t *record); + +#define GIT_BRC GIT_BRANCH +#define GIT_CKT GIT_CHECKOUT +#define GIT_CPK GIT_CHERRYPICK +#define GIT_CMT GIT_COMMIT +#define GIT_DIF GIT_DIFF +#define GIT_FTC GIT_FETCH +#define GIT_GRP GIT_GREP +#define GIT_INI GIT_INIT +#define GIT_MRG GIT_MERGE +#define GIT_PUS GIT_PUSH +#define GIT_PUL GIT_PULL +#define GIT_RBS GIT_REBASE +#define GIT_RMT GIT_REMOTE +#define GIT_RST GIT_RESET +#define GIT_SHW GIT_SHOW +#define GIT_STS GIT_STASH +#define GIT_STT GIT_STATUS diff --git a/users/greatwizard/greatwizard.c b/users/greatwizard/greatwizard.c new file mode 100644 index 0000000000..46ee414361 --- /dev/null +++ b/users/greatwizard/greatwizard.c @@ -0,0 +1,112 @@ +/* Copyright 2020 Guillaume Gérard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include "greatwizard.h" + +void eeconfig_init_user(void) { + user_config_t user_config; + user_config.raw = 0; +#ifdef RGBLIGHT_ENABLE + user_config.rgb_layer_change = true; +#endif + eeconfig_update_user(user_config.raw); + keyboard_init(); +} + +void keyboard_post_init_user(void) { +#ifdef RGBLIGHT_ENABLE + keyboard_post_init_rgb(); +#endif +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { +#ifdef RGBLIGHT_ENABLE + process_record_rgb(keycode, record); +#endif +#ifdef LAYER_GAME + process_record_game(keycode, record); +#endif +#ifdef LAYER_GIT + process_record_git(keycode, record); +#endif +#ifdef LAYERS_PROGRAMMER + process_record_pg(keycode, record); +#endif + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + } + return false; + case WORKMAN: + if (record->event.pressed) { + set_single_persistent_default_layer(_WORKMAN); + } + return false; + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + case DVORAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_DVORAK); + } + return false; + } + return true; +} + +#ifdef ENCODER_ENABLE +void encoder_update_user(uint8_t index, bool clockwise) { + switch (get_highest_layer(layer_state)) { + case _QWERTY: +#ifdef LAYERS_PROGRAMMER + case _PROGRAMMER_SHIFTED: +#endif + if (clockwise) { + tap_code(KC_AUDIO_VOL_UP); + } else { + tap_code(KC_AUDIO_VOL_DOWN); + } + break; + default: + if (clockwise) { + tap_code(KC_MEDIA_NEXT_TRACK); + } else { + tap_code(KC_MEDIA_PREV_TRACK); + } + break; + } +} +#endif + +layer_state_t layer_state_set_user(layer_state_t state) { + state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); +#ifdef RGBLIGHT_ENABLE + state = layer_state_set_rgb(state); +#endif +#ifdef LAYERS_ORTHO + state = layer_state_set_ortho(state); +#endif + return state; +} + +bool led_update_user(led_t led_state) { +#ifdef RGBLIGHT_ENABLE + led_update_rgb(led_state); +#endif + return true; +} diff --git a/users/greatwizard/greatwizard.h b/users/greatwizard/greatwizard.h new file mode 100644 index 0000000000..d2e15854a3 --- /dev/null +++ b/users/greatwizard/greatwizard.h @@ -0,0 +1,135 @@ +/* Copyright 2020 Guillaume Gérard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#pragma once + +#include QMK_KEYBOARD_H +#include "keymap_helpers.h" +#ifdef TAP_DANCE_ENABLE +# include "tap_dances.h" +#endif +#ifdef RGBLIGHT_ENABLE +# include "underglow.h" +#endif +#ifdef LAYER_FN +# include "fn.h" +#endif +#ifdef LAYER_GAME +# include "game.h" +#endif +#ifdef LAYER_GIT +# include "git.h" +#endif +#ifdef LAYERS_ORTHO +# include "ortho.h" +#endif +#ifdef LAYERS_PROGRAMMER +# include "programmer.h" +#endif + +typedef union { + uint32_t raw; + struct { +#ifdef RGBLIGHT_ENABLE + bool rgb_layer_change : 1; +#endif + }; +} user_config_t; + +enum layers { + _QWERTY, + _WORKMAN, + _COLEMAK, + _DVORAK, +#ifdef LAYER_GAME + _GAME, +#endif +#ifdef LAYERS_PROGRAMMER + _QWERTY_PROGRAMMER, + _WORKMAN_PROGRAMMER, + _COLEMAK_PROGRAMMER, + _DVORAK_PROGRAMMER, + _PROGRAMMER_SHIFTED, +#endif +#ifdef LAYERS_ORTHO + _LOWER, + _RAISE, + _ADJUST, +#endif +#ifdef LAYER_FN + _FN, +#endif +#ifdef LAYER_GIT + _GIT, +#endif +}; + +enum keycodes { + // Persistent layers switcher keys + QWERTY = SAFE_RANGE, + WORKMAN, + COLEMAK, + DVORAK, +#ifdef LAYER_GAME + GAME, +#endif +#ifdef LAYERS_PROGRAMMER + // Workman Programmer + QWERTY_PROGRAMMER, + WORKMAN_PROGRAMMER, + COLEMAK_PROGRAMMER, + DVORAK_PROGRAMMER, + PROGRAMMER_SHIFTED, + PG_GRV, + PG_1, + PG_2, + PG_3, + PG_4, + PG_5, + PG_6, + PG_7, + PG_8, + PG_9, + PG_0, +#endif + // RGB Underglow lights based on the layer key + RGB_LAYER, +#ifdef LAYER_GIT + // GIT commands + GIT_ADD, + GIT_BRANCH, + GIT_CHECKOUT, + GIT_CHERRYPICK, + GIT_COMMIT, + GIT_DIFF, + GIT_FETCH, + GIT_GREP, + GIT_LOG, + GIT_INIT, + GIT_MV, + GIT_MERGE, + GIT_PUSH, + GIT_PULL, + GIT_REBASE, + GIT_REMOTE, + GIT_RESET, + GIT_SHOW, + GIT_STASH, + GIT_STATUS, + GIT_TAG +#endif +}; + +#define RGB_LYR RGB_LAYER diff --git a/users/greatwizard/keymap_helpers.h b/users/greatwizard/keymap_helpers.h new file mode 100644 index 0000000000..af9f4dfaad --- /dev/null +++ b/users/greatwizard/keymap_helpers.h @@ -0,0 +1,61 @@ +/* Copyright 2020 Guillaume Gérard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#pragma once + +#include QMK_KEYBOARD_H + +#define _______________QWERTY_LEFT1________________ KC_Q, KC_W, KC_E, KC_R, KC_T +#define _______________QWERTY_LEFT2________________ KC_A, KC_S, KC_D, KC_F, KC_G +#define _______________QWERTY_LEFT3________________ KC_Z, KC_X, KC_C, KC_V, KC_B + +#define _______________QWERTY_RIGHT1_______________ KC_Y, KC_U, KC_I, KC_O, KC_P +#define _______________QWERTY_RIGHT2_______________ KC_H, KC_J, KC_K, KC_L, KC_SCLN +#define _______________QWERTY_RIGHT3_______________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH + +#define _______________WORKMAN_LEFT1_______________ KC_Q, KC_D, KC_R, KC_W, KC_B +#define _______________WORKMAN_LEFT2_______________ KC_A, KC_S, KC_H, KC_T, KC_G +#define _______________WORKMAN_LEFT3_______________ KC_Z, KC_X, KC_M, KC_C, KC_V + +#define _______________WORKMAN_RIGHT1______________ KC_J, KC_F, KC_U, KC_P, KC_SCLN +#define _______________WORKMAN_RIGHT2______________ KC_Y, KC_N, KC_E, KC_O, KC_I +#define _______________WORKMAN_RIGHT3______________ KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH + +#define _______________COLEMAK_LEFT1_______________ KC_Q, KC_W, KC_F, KC_P, KC_G +#define _______________COLEMAK_LEFT2_______________ KC_A, KC_R, KC_S, KC_T, KC_D +#define _______________COLEMAK_LEFT3_______________ KC_Z, KC_X, KC_C, KC_V, KC_B + +#define _______________COLEMAK_RIGHT1______________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN +#define _______________COLEMAK_RIGHT2______________ KC_H, KC_N, KC_E, KC_I, KC_O +#define _______________COLEMAK_RIGHT3______________ KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH + +#define _______________DVORAK_LEFT1________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y +#define _______________DVORAK_LEFT2________________ KC_A, KC_O, KC_E, KC_U, KC_I +#define _______________DVORAK_LEFT3________________ KC_SCLN, KC_Q, KC_J, KC_K, KC_X + +#define _______________DVORAK_RIGHT1_______________ KC_F, KC_G, KC_C, KC_R, KC_L +#define _______________DVORAK_RIGHT2_______________ KC_D, KC_H, KC_T, KC_N, KC_S +#define _______________DVORAK_RIGHT3_______________ KC_B, KC_M, KC_W, KC_V, KC_Z + +#define _______________NUMBER_LEFT_________________ KC_1, KC_2, KC_3, KC_4, KC_5 +#define _______________NUMBER_RIGHT________________ KC_6, KC_7, KC_8, KC_9, KC_0 + +#define _________________GIT_LEFT1_________________ GIT_CPK, GIT_SHW, GIT_RBS, GIT_RST, GIT_TAG +#define _________________GIT_LEFT2_________________ GIT_ADD, GIT_STT, GIT_DIF, GIT_FTC, GIT_GRP +#define _________________GIT_LEFT3_________________ _______, _______, GIT_CMT, GIT_MV, GIT_BRC + +#define _________________GIT_RIGHT1________________ _______, GIT_PUL, GIT_INI, GIT_RMT, GIT_PUS +#define _________________GIT_RIGHT2________________ GIT_STS, _______, GIT_CKT, GIT_LOG, _______ +#define _________________GIT_RIGHT3________________ _______, GIT_MRG, _______, _______, _______ diff --git a/users/greatwizard/ortho.c b/users/greatwizard/ortho.c new file mode 100644 index 0000000000..90b25b930f --- /dev/null +++ b/users/greatwizard/ortho.c @@ -0,0 +1,21 @@ +/* Copyright 2020 Guillaume Gérard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include "ortho.h" + +layer_state_t layer_state_set_ortho(layer_state_t state) { + state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); + return state; +} diff --git a/users/greatwizard/ortho.h b/users/greatwizard/ortho.h new file mode 100644 index 0000000000..7fb5d5e6c8 --- /dev/null +++ b/users/greatwizard/ortho.h @@ -0,0 +1,24 @@ +/* Copyright 2020 Guillaume Gérard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#pragma once + +#include QMK_KEYBOARD_H +#include "greatwizard.h" + +layer_state_t layer_state_set_ortho(layer_state_t state); + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) diff --git a/users/greatwizard/programmer.c b/users/greatwizard/programmer.c new file mode 100644 index 0000000000..e0f71ea066 --- /dev/null +++ b/users/greatwizard/programmer.c @@ -0,0 +1,174 @@ +/* Copyright 2020 Guillaume Gérard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include "programmer.h" + +bool process_record_pg(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY_PROGRAMMER: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY_PROGRAMMER); + } + return false; + case WORKMAN_PROGRAMMER: + if (record->event.pressed) { + set_single_persistent_default_layer(_WORKMAN_PROGRAMMER); + } + return false; + case COLEMAK_PROGRAMMER: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK_PROGRAMMER); + } + return false; + case DVORAK_PROGRAMMER: + if (record->event.pressed) { + set_single_persistent_default_layer(_DVORAK_PROGRAMMER); + } + return false; + case PG_GRV: + if (record->event.pressed) { + uint8_t current_mods = get_mods(); + if (current_mods & MOD_MASK_SHIFT) { + clear_mods(); + SEND_STRING("`"); + set_mods(current_mods); + } else { + SEND_STRING("~"); + } + } + return false; + case PG_1: + if (record->event.pressed) { + uint8_t current_mods = get_mods(); + if (current_mods & MOD_MASK_SHIFT) { + clear_mods(); + SEND_STRING("1"); + set_mods(current_mods); + } else { + SEND_STRING("!"); + } + } + return false; + case PG_2: + if (record->event.pressed) { + uint8_t current_mods = get_mods(); + if (current_mods & MOD_MASK_SHIFT) { + clear_mods(); + SEND_STRING("2"); + set_mods(current_mods); + } else { + SEND_STRING("@"); + } + } + return false; + case PG_3: + if (record->event.pressed) { + uint8_t current_mods = get_mods(); + if (current_mods & MOD_MASK_SHIFT) { + clear_mods(); + SEND_STRING("3"); + set_mods(current_mods); + } else { + SEND_STRING("#"); + } + } + return false; + case PG_4: + if (record->event.pressed) { + uint8_t current_mods = get_mods(); + if (current_mods & MOD_MASK_SHIFT) { + clear_mods(); + SEND_STRING("4"); + set_mods(current_mods); + } else { + SEND_STRING("$"); + } + } + return false; + case PG_5: + if (record->event.pressed) { + uint8_t current_mods = get_mods(); + if (current_mods & MOD_MASK_SHIFT) { + clear_mods(); + SEND_STRING("5"); + set_mods(current_mods); + } else { + SEND_STRING("%"); + } + } + return false; + case PG_6: + if (record->event.pressed) { + uint8_t current_mods = get_mods(); + if (current_mods & MOD_MASK_SHIFT) { + clear_mods(); + SEND_STRING("6"); + set_mods(current_mods); + } else { + SEND_STRING("^"); + } + } + return false; + case PG_7: + if (record->event.pressed) { + uint8_t current_mods = get_mods(); + if (current_mods & MOD_MASK_SHIFT) { + clear_mods(); + SEND_STRING("7"); + set_mods(current_mods); + } else { + SEND_STRING("&"); + } + } + return false; + case PG_8: + if (record->event.pressed) { + uint8_t current_mods = get_mods(); + if (current_mods & MOD_MASK_SHIFT) { + clear_mods(); + SEND_STRING("8"); + set_mods(current_mods); + } else { + SEND_STRING("*"); + } + } + return false; + case PG_9: + if (record->event.pressed) { + uint8_t current_mods = get_mods(); + if (current_mods & MOD_MASK_SHIFT) { + clear_mods(); + SEND_STRING("9"); + set_mods(current_mods); + } else { + SEND_STRING("("); + } + } + return false; + case PG_0: + if (record->event.pressed) { + uint8_t current_mods = get_mods(); + if (current_mods & MOD_MASK_SHIFT) { + clear_mods(); + SEND_STRING("0"); + set_mods(current_mods); + } else { + SEND_STRING(")"); + } + } + return false; + } + return true; +} diff --git a/users/greatwizard/programmer.h b/users/greatwizard/programmer.h new file mode 100644 index 0000000000..a79aada247 --- /dev/null +++ b/users/greatwizard/programmer.h @@ -0,0 +1,31 @@ +/* Copyright 2020 Guillaume Gérard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#pragma once + +#include QMK_KEYBOARD_H +#include "greatwizard.h" + +bool process_record_pg(uint16_t keycode, keyrecord_t *record); + +#define QWERTYP QWERTY_PROGRAMMER +#define WORKMNP WORKMAN_PROGRAMMER +#define COLEMKP COLEMAK_PROGRAMMER +#define DVORAKP DVORAK_PROGRAMMER +#ifdef TAP_DANCE_LSFT_CAPS +# define PG_LSCP TD(TD_PG_LSFT_CAPS) +#else +# define PG_LSCP LM(_PROGRAMMER_SHIFTED, MOD_LSFT) +#endif diff --git a/users/greatwizard/readme.md b/users/greatwizard/readme.md new file mode 100644 index 0000000000..bc2df7f9bf --- /dev/null +++ b/users/greatwizard/readme.md @@ -0,0 +1,32 @@ +# GreatWizard Userspace + +## Features + +- ⌨️ Switchable and persistent base layers: Qwerty, Workman, Workman, Colemak, Dvorak, 🎮 Game +- ⌨️ Programmer flavored base layers available +- 💃🕺 Tap Dances +- 🆙 Auto Shift +- 👨💻 One shot keys git commands layer +- 🌈 RGB Underglow lights based on the layer +- ⚙️ Rotary encoder for volume level and next/previous media +- 🗜️ Enable link time optimization + +## Community Layouts + +- [ortholinear 4x12](https://github.com/qmk/qmk_firmware/tree/master/layouts/community/ortho_4x12/greatwizard) +- [ortholinear 5x12](https://github.com/qmk/qmk_firmware/tree/master/layouts/community/ortho_5x12/greatwizard) + +## Build Options + +### Layers + +- `LAYERS_ORTHO`: add Lower, Raise and Adjust layers/keycodes +- `LAYERS_PROGRAMMER`: add Programmer layers/keycodes +- `LAYER_GAME`: add Game layer/keycode +- `LAYER_GIT`: add GIT layer/keycode +- `LAYER_FN`: add Fn layer/keycode + +### Tap Dances + +- `TAP_DANCE_LALT_GIT`: Double tap on LGUI to use the one shot keys git commands layer +- `TAP_DANCE_LSFT_CAPS`: Double tap on LSHIFT to set Caps Lock diff --git a/users/greatwizard/rules.mk b/users/greatwizard/rules.mk new file mode 100644 index 0000000000..92bb4ccd1b --- /dev/null +++ b/users/greatwizard/rules.mk @@ -0,0 +1,31 @@ +SRC += greatwizard.c + +ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) + SRC += tap_dances.c +endif + +ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) + SRC += underglow.c +endif + +ifeq ($(strip $(LAYER_GAME)), yes) + SRC += game.c +endif + +ifeq ($(strip $(LAYER_GIT)), yes) + SRC += git.c +endif + +ifeq ($(strip $(LAYERS_ORTHO)), yes) + SRC += ortho.c +endif + +ifeq ($(strip $(LAYERS_PROGRAMMER)), yes) + SRC += programmer.c +endif + +ifneq ($(PLATFORM),CHIBIOS) + LTO_ENABLE = yes # Enable link time optimization +endif + +AUTO_SHIFT_ENABLE = yes # Autoshift by holding down a key diff --git a/users/greatwizard/tap_dances.c b/users/greatwizard/tap_dances.c new file mode 100644 index 0000000000..c6be995c45 --- /dev/null +++ b/users/greatwizard/tap_dances.c @@ -0,0 +1,105 @@ +/* Copyright 2020 Guillaume Gérard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include "tap_dances.h" + +uint8_t cur_dance(qk_tap_dance_state_t *state) { + if (state->count == 1) { + if (state->interrupted || !state->pressed) return SINGLE_TAP; + else return SINGLE_HOLD; + } else if (state->count == 2) { + if (state->interrupted) return DOUBLE_SINGLE_TAP; + else if (state->pressed) return DOUBLE_HOLD; + else return DOUBLE_TAP; + } + if (state->count == 3) { + if (state->interrupted || !state->pressed) return TRIPLE_TAP; + else return TRIPLE_HOLD; + } else return 8; +} + +static tap tap_state = { + .is_press_action = true, + .state = 0 +}; + +#ifdef TAP_DANCE_LALT_GIT +void lalt_finished(qk_tap_dance_state_t *state, void *user_data) { + tap_state.state = cur_dance(state); + switch (tap_state.state) { + case SINGLE_HOLD: + register_mods(MOD_BIT(KC_LALT)); + break; + case DOUBLE_SINGLE_TAP: + case DOUBLE_TAP: + set_oneshot_layer(_GIT, ONESHOT_START); + break; + } +} + +void lalt_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (tap_state.state) { + case SINGLE_HOLD: + unregister_mods(MOD_BIT(KC_LALT)); + break; + case DOUBLE_SINGLE_TAP: + case DOUBLE_TAP: + clear_oneshot_layer_state(ONESHOT_PRESSED); + break; + } + tap_state.state = 0; +} +#endif + +#ifdef TAP_DANCE_LSFT_CAPS +# ifdef LAYERS_PROGRAMMER +void pg_lsft_finished(qk_tap_dance_state_t *state, void *user_data) { + tap_state.state = cur_dance(state); + switch (tap_state.state) { + case SINGLE_HOLD: + register_mods(MOD_BIT(KC_LSFT)); + layer_on(_PROGRAMMER_SHIFTED); + break; + case DOUBLE_SINGLE_TAP: + case DOUBLE_TAP: + tap_code(KC_CAPS); + layer_on(_PROGRAMMER_SHIFTED); + break; + } +} + +void pg_lsft_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (tap_state.state) { + case SINGLE_HOLD: + unregister_mods(MOD_BIT(KC_LSFT)); + layer_off(_PROGRAMMER_SHIFTED); + break; + } + tap_state.state = 0; +} +# endif +#endif + +qk_tap_dance_action_t tap_dance_actions[] = { +#ifdef TAP_DANCE_LALT_GIT + [TD_LALT_GIT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, lalt_finished, lalt_reset), +#endif +#ifdef TAP_DANCE_LSFT_CAPS + [TD_LSFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS), +# ifdef LAYERS_PROGRAMMER + [TD_PG_LSFT_CAPS] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, pg_lsft_finished, pg_lsft_reset), +# endif +#endif +}; diff --git a/users/greatwizard/tap_dances.h b/users/greatwizard/tap_dances.h new file mode 100644 index 0000000000..944ae45553 --- /dev/null +++ b/users/greatwizard/tap_dances.h @@ -0,0 +1,65 @@ +/* Copyright 2020 Guillaume Gérard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#pragma once + +#include QMK_KEYBOARD_H +#include "greatwizard.h" + +typedef struct { + bool is_press_action; + uint8_t state; +} tap; + +enum { + SINGLE_TAP = 1, + SINGLE_HOLD, + DOUBLE_TAP, + DOUBLE_HOLD, + DOUBLE_SINGLE_TAP, + TRIPLE_TAP, + TRIPLE_HOLD +}; + +enum { +#ifdef TAP_DANCE_LALT_GIT + TD_LALT_GIT, +#endif +#ifdef TAP_DANCE_LSFT_CAPS + TD_LSFT_CAPS, +# ifdef LAYERS_PROGRAMMER + TD_PG_LSFT_CAPS, +# endif +#endif +}; + +uint8_t cur_dance(qk_tap_dance_state_t *state); + +#ifdef TAP_DANCE_LALT_GIT +void lalt_finished(qk_tap_dance_state_t *state, void *user_data); +void lalt_reset(qk_tap_dance_state_t *state, void *user_data); +# define TD_LALT TD(TD_LALT_GIT) +#endif + +#ifdef TAP_DANCE_LSFT_CAPS +# ifdef LAYERS_PROGRAMMER +void pg_lsft_finished(qk_tap_dance_state_t *state, void *user_data); +void pg_lsft_reset(qk_tap_dance_state_t *state, void *user_data); +# endif +#endif + +#ifdef TAP_DANCE_LSFT_CAPS +# define TD_LSCP TD(TD_LSFT_CAPS) +#endif diff --git a/users/greatwizard/underglow.c b/users/greatwizard/underglow.c new file mode 100644 index 0000000000..db31290acd --- /dev/null +++ b/users/greatwizard/underglow.c @@ -0,0 +1,109 @@ +/* Copyright 2020 Guillaume Gérard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include "underglow.h" + +void keyboard_post_init_rgb(void) { + user_config_t user_config; + user_config.raw = eeconfig_read_user(); + if (!user_config.rgb_layer_change) { + return; + } + rgblight_enable_noeeprom(); + rgblight_sethsv_noeeprom_orange(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); +} + +bool process_record_rgb(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case RGB_LAYER: + if (record->event.pressed) { + user_config_t user_config; + user_config.raw = eeconfig_read_user(); + user_config.rgb_layer_change ^= 1; + eeconfig_update_user(user_config.raw); + if (user_config.rgb_layer_change) { + layer_state_set(layer_state); + } + } + return false; + case RGB_MODE_FORWARD ... RGB_MODE_RGBTEST: + if (record->event.pressed) { + user_config_t user_config; + user_config.raw = eeconfig_read_user(); + if (user_config.rgb_layer_change) { + user_config.rgb_layer_change = false; + eeconfig_update_user(user_config.raw); + } + } + return true; + } + return true; +} + +layer_state_t layer_state_set_rgb(layer_state_t state) { + user_config_t user_config; + user_config.raw = eeconfig_read_user(); + if (!user_config.rgb_layer_change) { + return state; + } + switch (get_highest_layer(state)) { + case _QWERTY: +#ifdef LAYERS_PROGRAMMER + case _PROGRAMMER_SHIFTED: +#endif + rgblight_sethsv_noeeprom_orange(); + break; +#ifdef LAYERS_ORTHO + case _LOWER: + rgblight_sethsv_noeeprom_red(); + break; + case _RAISE: + rgblight_sethsv_noeeprom_blue(); + break; + case _ADJUST: + rgblight_sethsv_noeeprom_purple(); + break; +#endif +#ifdef LAYER_FN + case _FN: + rgblight_sethsv_noeeprom_chartreuse(); + break; +#endif +#ifdef LAYER_GIT + case _GIT: + rgblight_sethsv_noeeprom_teal(); + break; +#endif + default: + rgblight_sethsv_noeeprom_white(); + break; + } + return state; +} + +bool led_update_rgb(led_t led_state) { + user_config_t user_config; + user_config.raw = eeconfig_read_user(); + if (!user_config.rgb_layer_change) { + return true; + } + if (led_state.caps_lock) { + rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); + } else { + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + } + return true; +} diff --git a/users/greatwizard/underglow.h b/users/greatwizard/underglow.h new file mode 100644 index 0000000000..7e073b8579 --- /dev/null +++ b/users/greatwizard/underglow.h @@ -0,0 +1,24 @@ +/* Copyright 2020 Guillaume Gérard + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#pragma once + +#include QMK_KEYBOARD_H +#include "greatwizard.h" + +void keyboard_post_init_rgb(void); +bool process_record_rgb(uint16_t keycode, keyrecord_t *record); +layer_state_t layer_state_set_rgb(layer_state_t state); +bool led_update_rgb(led_t led_state); |