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 | |
parent | 6b1ae7e6aa7180b00759b5692d2ea5bd0303c566 (diff) | |
download | qmk_firmware-c745cbb77a66a44549ee1ab3b1998c495c1a1ca5.tar.gz qmk_firmware-c745cbb77a66a44549ee1ab3b1998c495c1a1ca5.zip |
[Keymap] greatwizard userspace and ortho 4x12 and 5x12 keymaps (#9584)
Diffstat (limited to 'users')
-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 000000000..2ee9e5090 --- /dev/null +++ b/users/greatwizard/config.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* Copyright 2020 Guillaume Gérard | ||
2 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | */ | ||
16 | #pragma once | ||
17 | |||
18 | #define TAP_CODE_DELAY 5 | ||
19 | |||
20 | #define RGBLIGHT_ANIMATIONS | ||
21 | |||
22 | #ifdef TAP_DANCE_ENABLE | ||
23 | # define TAPPING_TERM 175 | ||
24 | # define PERMISSIVE_HOLD | ||
25 | #endif | ||
26 | |||
27 | #ifdef AUTO_SHIFT_ENABLE | ||
28 | # define AUTO_SHIFT_TIMEOUT 135 | ||
29 | # define NO_AUTO_SHIFT_SPECIAL | ||
30 | # define NO_AUTO_SHIFT_NUMERIC | ||
31 | #endif | ||
diff --git a/users/greatwizard/fn.h b/users/greatwizard/fn.h new file mode 100644 index 000000000..f842bf04b --- /dev/null +++ b/users/greatwizard/fn.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* Copyright 2020 Guillaume Gérard | ||
2 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | */ | ||
16 | #pragma once | ||
17 | |||
18 | #include QMK_KEYBOARD_H | ||
19 | #include "greatwizard.h" | ||
20 | |||
21 | #define FN MO(_FN) | ||
diff --git a/users/greatwizard/game.c b/users/greatwizard/game.c new file mode 100644 index 000000000..eecabfa40 --- /dev/null +++ b/users/greatwizard/game.c | |||
@@ -0,0 +1,27 @@ | |||
1 | /* Copyright 2020 Guillaume Gérard | ||
2 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | */ | ||
16 | #include "game.h" | ||
17 | |||
18 | bool process_record_game(uint16_t keycode, keyrecord_t *record) { | ||
19 | switch (keycode) { | ||
20 | case GAME: | ||
21 | if (record->event.pressed) { | ||
22 | set_single_persistent_default_layer(_GAME); | ||
23 | } | ||
24 | return false; | ||
25 | } | ||
26 | return true; | ||
27 | } | ||
diff --git a/users/greatwizard/game.h b/users/greatwizard/game.h new file mode 100644 index 000000000..504129b40 --- /dev/null +++ b/users/greatwizard/game.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* Copyright 2020 Guillaume Gérard | ||
2 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | */ | ||
16 | #pragma once | ||
17 | |||
18 | #include QMK_KEYBOARD_H | ||
19 | #include "greatwizard.h" | ||
20 | |||
21 | 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 000000000..4bf68fe69 --- /dev/null +++ b/users/greatwizard/git.c | |||
@@ -0,0 +1,127 @@ | |||
1 | /* Copyright 2020 Guillaume Gérard | ||
2 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | */ | ||
16 | #include "git.h" | ||
17 | |||
18 | bool process_record_git(uint16_t keycode, keyrecord_t *record) { | ||
19 | switch (keycode) { | ||
20 | case GIT_ADD: | ||
21 | if (record->event.pressed) { | ||
22 | SEND_STRING("git add "); | ||
23 | } | ||
24 | return false; | ||
25 | case GIT_BRANCH: | ||
26 | if (record->event.pressed) { | ||
27 | SEND_STRING("git branch "); | ||
28 | } | ||
29 | return false; | ||
30 | case GIT_CHECKOUT: | ||
31 | if (record->event.pressed) { | ||
32 | SEND_STRING("git checkout "); | ||
33 | } | ||
34 | return false; | ||
35 | case GIT_CHERRYPICK: | ||
36 | if (record->event.pressed) { | ||
37 | SEND_STRING("git cherry-pick "); | ||
38 | } | ||
39 | return false; | ||
40 | case GIT_COMMIT: | ||
41 | if (record->event.pressed) { | ||
42 | SEND_STRING("git commit -m \"\""SS_TAP(X_LEFT)); | ||
43 | } | ||
44 | return false; | ||
45 | case GIT_DIFF: | ||
46 | if (record->event.pressed) { | ||
47 | SEND_STRING("git diff "); | ||
48 | } | ||
49 | return false; | ||
50 | case GIT_FETCH: | ||
51 | if (record->event.pressed) { | ||
52 | SEND_STRING("git fetch "); | ||
53 | } | ||
54 | return false; | ||
55 | case GIT_GREP: | ||
56 | if (record->event.pressed) { | ||
57 | SEND_STRING("git grep "); | ||
58 | } | ||
59 | return false; | ||
60 | case GIT_LOG: | ||
61 | if (record->event.pressed) { | ||
62 | SEND_STRING("git log --decorate --oneline --graph "); | ||
63 | } | ||
64 | return false; | ||
65 | case GIT_INIT: | ||
66 | if (record->event.pressed) { | ||
67 | SEND_STRING("git init "); | ||
68 | } | ||
69 | return false; | ||
70 | case GIT_MV: | ||
71 | if (record->event.pressed) { | ||
72 | SEND_STRING("git mv "); | ||
73 | } | ||
74 | return false; | ||
75 | case GIT_MERGE: | ||
76 | if (record->event.pressed) { | ||
77 | SEND_STRING("git merge "); | ||
78 | } | ||
79 | return false; | ||
80 | case GIT_PUSH: | ||
81 | if (record->event.pressed) { | ||
82 | SEND_STRING("git push "); | ||
83 | } | ||
84 | return false; | ||
85 | case GIT_PULL: | ||
86 | if (record->event.pressed) { | ||
87 | SEND_STRING("git pull "); | ||
88 | } | ||
89 | return false; | ||
90 | case GIT_REBASE: | ||
91 | if (record->event.pressed) { | ||
92 | SEND_STRING("git rebase "); | ||
93 | } | ||
94 | return false; | ||
95 | case GIT_REMOTE: | ||
96 | if (record->event.pressed) { | ||
97 | SEND_STRING("git remote "); | ||
98 | } | ||
99 | return false; | ||
100 | case GIT_RESET: | ||
101 | if (record->event.pressed) { | ||
102 | SEND_STRING("git reset "); | ||
103 | } | ||
104 | return false; | ||
105 | case GIT_SHOW: | ||
106 | if (record->event.pressed) { | ||
107 | SEND_STRING("git show "); | ||
108 | } | ||
109 | return false; | ||
110 | case GIT_STASH: | ||
111 | if (record->event.pressed) { | ||
112 | SEND_STRING("git stash "); | ||
113 | } | ||
114 | return false; | ||
115 | case GIT_STATUS: | ||
116 | if (record->event.pressed) { | ||
117 | SEND_STRING("git status "); | ||
118 | } | ||
119 | return false; | ||
120 | case GIT_TAG: | ||
121 | if (record->event.pressed) { | ||
122 | SEND_STRING("git tag "); | ||
123 | } | ||
124 | return false; | ||
125 | } | ||
126 | return true; | ||
127 | } | ||
diff --git a/users/greatwizard/git.h b/users/greatwizard/git.h new file mode 100644 index 000000000..c3b4a617d --- /dev/null +++ b/users/greatwizard/git.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /* Copyright 2020 Guillaume Gérard | ||
2 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | */ | ||
16 | #pragma once | ||
17 | |||
18 | #include QMK_KEYBOARD_H | ||
19 | #include "greatwizard.h" | ||
20 | |||
21 | bool process_record_git(uint16_t keycode, keyrecord_t *record); | ||
22 | |||
23 | #define GIT_BRC GIT_BRANCH | ||
24 | #define GIT_CKT GIT_CHECKOUT | ||
25 | #define GIT_CPK GIT_CHERRYPICK | ||
26 | #define GIT_CMT GIT_COMMIT | ||
27 | #define GIT_DIF GIT_DIFF | ||
28 | #define GIT_FTC GIT_FETCH | ||
29 | #define GIT_GRP GIT_GREP | ||
30 | #define GIT_INI GIT_INIT | ||
31 | #define GIT_MRG GIT_MERGE | ||
32 | #define GIT_PUS GIT_PUSH | ||
33 | #define GIT_PUL GIT_PULL | ||
34 | #define GIT_RBS GIT_REBASE | ||
35 | #define GIT_RMT GIT_REMOTE | ||
36 | #define GIT_RST GIT_RESET | ||
37 | #define GIT_SHW GIT_SHOW | ||
38 | #define GIT_STS GIT_STASH | ||
39 | #define GIT_STT GIT_STATUS | ||
diff --git a/users/greatwizard/greatwizard.c b/users/greatwizard/greatwizard.c new file mode 100644 index 000000000..46ee41436 --- /dev/null +++ b/users/greatwizard/greatwizard.c | |||
@@ -0,0 +1,112 @@ | |||
1 | /* Copyright 2020 Guillaume Gérard | ||
2 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | */ | ||
16 | #include "greatwizard.h" | ||
17 | |||
18 | void eeconfig_init_user(void) { | ||
19 | user_config_t user_config; | ||
20 | user_config.raw = 0; | ||
21 | #ifdef RGBLIGHT_ENABLE | ||
22 | user_config.rgb_layer_change = true; | ||
23 | #endif | ||
24 | eeconfig_update_user(user_config.raw); | ||
25 | keyboard_init(); | ||
26 | } | ||
27 | |||
28 | void keyboard_post_init_user(void) { | ||
29 | #ifdef RGBLIGHT_ENABLE | ||
30 | keyboard_post_init_rgb(); | ||
31 | #endif | ||
32 | } | ||
33 | |||
34 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
35 | #ifdef RGBLIGHT_ENABLE | ||
36 | process_record_rgb(keycode, record); | ||
37 | #endif | ||
38 | #ifdef LAYER_GAME | ||
39 | process_record_game(keycode, record); | ||
40 | #endif | ||
41 | #ifdef LAYER_GIT | ||
42 | process_record_git(keycode, record); | ||
43 | #endif | ||
44 | #ifdef LAYERS_PROGRAMMER | ||
45 | process_record_pg(keycode, record); | ||
46 | #endif | ||
47 | switch (keycode) { | ||
48 | case QWERTY: | ||
49 | if (record->event.pressed) { | ||
50 | set_single_persistent_default_layer(_QWERTY); | ||
51 | } | ||
52 | return false; | ||
53 | case WORKMAN: | ||
54 | if (record->event.pressed) { | ||
55 | set_single_persistent_default_layer(_WORKMAN); | ||
56 | } | ||
57 | return false; | ||
58 | case COLEMAK: | ||
59 | if (record->event.pressed) { | ||
60 | set_single_persistent_default_layer(_COLEMAK); | ||
61 | } | ||
62 | return false; | ||
63 | case DVORAK: | ||
64 | if (record->event.pressed) { | ||
65 | set_single_persistent_default_layer(_DVORAK); | ||
66 | } | ||
67 | return false; | ||
68 | } | ||
69 | return true; | ||
70 | } | ||
71 | |||
72 | #ifdef ENCODER_ENABLE | ||
73 | void encoder_update_user(uint8_t index, bool clockwise) { | ||
74 | switch (get_highest_layer(layer_state)) { | ||
75 | case _QWERTY: | ||
76 | #ifdef LAYERS_PROGRAMMER | ||
77 | case _PROGRAMMER_SHIFTED: | ||
78 | #endif | ||
79 | if (clockwise) { | ||
80 | tap_code(KC_AUDIO_VOL_UP); | ||
81 | } else { | ||
82 | tap_code(KC_AUDIO_VOL_DOWN); | ||
83 | } | ||
84 | break; | ||
85 | default: | ||
86 | if (clockwise) { | ||
87 | tap_code(KC_MEDIA_NEXT_TRACK); | ||
88 | } else { | ||
89 | tap_code(KC_MEDIA_PREV_TRACK); | ||
90 | } | ||
91 | break; | ||
92 | } | ||
93 | } | ||
94 | #endif | ||
95 | |||
96 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
97 | state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); | ||
98 | #ifdef RGBLIGHT_ENABLE | ||
99 | state = layer_state_set_rgb(state); | ||
100 | #endif | ||
101 | #ifdef LAYERS_ORTHO | ||
102 | state = layer_state_set_ortho(state); | ||
103 | #endif | ||
104 | return state; | ||
105 | } | ||
106 | |||
107 | bool led_update_user(led_t led_state) { | ||
108 | #ifdef RGBLIGHT_ENABLE | ||
109 | led_update_rgb(led_state); | ||
110 | #endif | ||
111 | return true; | ||
112 | } | ||
diff --git a/users/greatwizard/greatwizard.h b/users/greatwizard/greatwizard.h new file mode 100644 index 000000000..d2e15854a --- /dev/null +++ b/users/greatwizard/greatwizard.h | |||
@@ -0,0 +1,135 @@ | |||
1 | /* Copyright 2020 Guillaume Gérard | ||
2 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | */ | ||
16 | #pragma once | ||
17 | |||
18 | #include QMK_KEYBOARD_H | ||
19 | #include "keymap_helpers.h" | ||
20 | #ifdef TAP_DANCE_ENABLE | ||
21 | # include "tap_dances.h" | ||
22 | #endif | ||
23 | #ifdef RGBLIGHT_ENABLE | ||
24 | # include "underglow.h" | ||
25 | #endif | ||
26 | #ifdef LAYER_FN | ||
27 | # include "fn.h" | ||
28 | #endif | ||
29 | #ifdef LAYER_GAME | ||
30 | # include "game.h" | ||
31 | #endif | ||
32 | #ifdef LAYER_GIT | ||
33 | # include "git.h" | ||
34 | #endif | ||
35 | #ifdef LAYERS_ORTHO | ||
36 | # include "ortho.h" | ||
37 | #endif | ||
38 | #ifdef LAYERS_PROGRAMMER | ||
39 | # include "programmer.h" | ||
40 | #endif | ||
41 | |||
42 | typedef union { | ||
43 | uint32_t raw; | ||
44 | struct { | ||
45 | #ifdef RGBLIGHT_ENABLE | ||
46 | bool rgb_layer_change : 1; | ||
47 | #endif | ||
48 | }; | ||
49 | } user_config_t; | ||
50 | |||
51 | enum layers { | ||
52 | _QWERTY, | ||
53 | _WORKMAN, | ||
54 | _COLEMAK, | ||
55 | _DVORAK, | ||
56 | #ifdef LAYER_GAME | ||
57 | _GAME, | ||
58 | #endif | ||
59 | #ifdef LAYERS_PROGRAMMER | ||
60 | _QWERTY_PROGRAMMER, | ||
61 | _WORKMAN_PROGRAMMER, | ||
62 | _COLEMAK_PROGRAMMER, | ||
63 | _DVORAK_PROGRAMMER, | ||
64 | _PROGRAMMER_SHIFTED, | ||
65 | #endif | ||
66 | #ifdef LAYERS_ORTHO | ||
67 | _LOWER, | ||
68 | _RAISE, | ||
69 | _ADJUST, | ||
70 | #endif | ||
71 | #ifdef LAYER_FN | ||
72 | _FN, | ||
73 | #endif | ||
74 | #ifdef LAYER_GIT | ||
75 | _GIT, | ||
76 | #endif | ||
77 | }; | ||
78 | |||
79 | enum keycodes { | ||
80 | // Persistent layers switcher keys | ||
81 | QWERTY = SAFE_RANGE, | ||
82 | WORKMAN, | ||
83 | COLEMAK, | ||
84 | DVORAK, | ||
85 | #ifdef LAYER_GAME | ||
86 | GAME, | ||
87 | #endif | ||
88 | #ifdef LAYERS_PROGRAMMER | ||
89 | // Workman Programmer | ||
90 | QWERTY_PROGRAMMER, | ||
91 | WORKMAN_PROGRAMMER, | ||
92 | COLEMAK_PROGRAMMER, | ||
93 | DVORAK_PROGRAMMER, | ||
94 | PROGRAMMER_SHIFTED, | ||
95 | PG_GRV, | ||
96 | PG_1, | ||
97 | PG_2, | ||
98 | PG_3, | ||
99 | PG_4, | ||
100 | PG_5, | ||
101 | PG_6, | ||
102 | PG_7, | ||
103 | PG_8, | ||
104 | PG_9, | ||
105 | PG_0, | ||
106 | #endif | ||
107 | // RGB Underglow lights based on the layer key | ||
108 | RGB_LAYER, | ||
109 | #ifdef LAYER_GIT | ||
110 | // GIT commands | ||
111 | GIT_ADD, | ||
112 | GIT_BRANCH, | ||
113 | GIT_CHECKOUT, | ||
114 | GIT_CHERRYPICK, | ||
115 | GIT_COMMIT, | ||
116 | GIT_DIFF, | ||
117 | GIT_FETCH, | ||
118 | GIT_GREP, | ||
119 | GIT_LOG, | ||
120 | GIT_INIT, | ||
121 | GIT_MV, | ||
122 | GIT_MERGE, | ||
123 | GIT_PUSH, | ||
124 | GIT_PULL, | ||
125 | GIT_REBASE, | ||
126 | GIT_REMOTE, | ||
127 | GIT_RESET, | ||
128 | GIT_SHOW, | ||
129 | GIT_STASH, | ||
130 | GIT_STATUS, | ||
131 | GIT_TAG | ||
132 | #endif | ||
133 | }; | ||
134 | |||
135 | #define RGB_LYR RGB_LAYER | ||
diff --git a/users/greatwizard/keymap_helpers.h b/users/greatwizard/keymap_helpers.h new file mode 100644 index 000000000..af9f4dfaa --- /dev/null +++ b/users/greatwizard/keymap_helpers.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* Copyright 2020 Guillaume Gérard | ||
2 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | */ | ||
16 | #pragma once | ||
17 | |||
18 | #include QMK_KEYBOARD_H | ||
19 | |||
20 | #define _______________QWERTY_LEFT1________________ KC_Q, KC_W, KC_E, KC_R, KC_T | ||
21 | #define _______________QWERTY_LEFT2________________ KC_A, KC_S, KC_D, KC_F, KC_G | ||
22 | #define _______________QWERTY_LEFT3________________ KC_Z, KC_X, KC_C, KC_V, KC_B | ||
23 | |||
24 | #define _______________QWERTY_RIGHT1_______________ KC_Y, KC_U, KC_I, KC_O, KC_P | ||
25 | #define _______________QWERTY_RIGHT2_______________ KC_H, KC_J, KC_K, KC_L, KC_SCLN | ||
26 | #define _______________QWERTY_RIGHT3_______________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH | ||
27 | |||
28 | #define _______________WORKMAN_LEFT1_______________ KC_Q, KC_D, KC_R, KC_W, KC_B | ||
29 | #define _______________WORKMAN_LEFT2_______________ KC_A, KC_S, KC_H, KC_T, KC_G | ||
30 | #define _______________WORKMAN_LEFT3_______________ KC_Z, KC_X, KC_M, KC_C, KC_V | ||
31 | |||
32 | #define _______________WORKMAN_RIGHT1______________ KC_J, KC_F, KC_U, KC_P, KC_SCLN | ||
33 | #define _______________WORKMAN_RIGHT2______________ KC_Y, KC_N, KC_E, KC_O, KC_I | ||
34 | #define _______________WORKMAN_RIGHT3______________ KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH | ||
35 | |||
36 | #define _______________COLEMAK_LEFT1_______________ KC_Q, KC_W, KC_F, KC_P, KC_G | ||
37 | #define _______________COLEMAK_LEFT2_______________ KC_A, KC_R, KC_S, KC_T, KC_D | ||
38 | #define _______________COLEMAK_LEFT3_______________ KC_Z, KC_X, KC_C, KC_V, KC_B | ||
39 | |||
40 | #define _______________COLEMAK_RIGHT1______________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN | ||
41 | #define _______________COLEMAK_RIGHT2______________ KC_H, KC_N, KC_E, KC_I, KC_O | ||
42 | #define _______________COLEMAK_RIGHT3______________ KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH | ||
43 | |||
44 | #define _______________DVORAK_LEFT1________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y | ||
45 | #define _______________DVORAK_LEFT2________________ KC_A, KC_O, KC_E, KC_U, KC_I | ||
46 | #define _______________DVORAK_LEFT3________________ KC_SCLN, KC_Q, KC_J, KC_K, KC_X | ||
47 | |||
48 | #define _______________DVORAK_RIGHT1_______________ KC_F, KC_G, KC_C, KC_R, KC_L | ||
49 | #define _______________DVORAK_RIGHT2_______________ KC_D, KC_H, KC_T, KC_N, KC_S | ||
50 | #define _______________DVORAK_RIGHT3_______________ KC_B, KC_M, KC_W, KC_V, KC_Z | ||
51 | |||
52 | #define _______________NUMBER_LEFT_________________ KC_1, KC_2, KC_3, KC_4, KC_5 | ||
53 | #define _______________NUMBER_RIGHT________________ KC_6, KC_7, KC_8, KC_9, KC_0 | ||
54 | |||
55 | #define _________________GIT_LEFT1_________________ GIT_CPK, GIT_SHW, GIT_RBS, GIT_RST, GIT_TAG | ||
56 | #define _________________GIT_LEFT2_________________ GIT_ADD, GIT_STT, GIT_DIF, GIT_FTC, GIT_GRP | ||
57 | #define _________________GIT_LEFT3_________________ _______, _______, GIT_CMT, GIT_MV, GIT_BRC | ||
58 | |||
59 | #define _________________GIT_RIGHT1________________ _______, GIT_PUL, GIT_INI, GIT_RMT, GIT_PUS | ||
60 | #define _________________GIT_RIGHT2________________ GIT_STS, _______, GIT_CKT, GIT_LOG, _______ | ||
61 | #define _________________GIT_RIGHT3________________ _______, GIT_MRG, _______, _______, _______ | ||
diff --git a/users/greatwizard/ortho.c b/users/greatwizard/ortho.c new file mode 100644 index 000000000..90b25b930 --- /dev/null +++ b/users/greatwizard/ortho.c | |||
@@ -0,0 +1,21 @@ | |||
1 | /* Copyright 2020 Guillaume Gérard | ||
2 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | */ | ||
16 | #include "ortho.h" | ||
17 | |||
18 | layer_state_t layer_state_set_ortho(layer_state_t state) { | ||
19 | state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); | ||
20 | return state; | ||
21 | } | ||
diff --git a/users/greatwizard/ortho.h b/users/greatwizard/ortho.h new file mode 100644 index 000000000..7fb5d5e6c --- /dev/null +++ b/users/greatwizard/ortho.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* Copyright 2020 Guillaume Gérard | ||
2 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | */ | ||
16 | #pragma once | ||
17 | |||
18 | #include QMK_KEYBOARD_H | ||
19 | #include "greatwizard.h" | ||
20 | |||
21 | layer_state_t layer_state_set_ortho(layer_state_t state); | ||
22 | |||
23 | #define LOWER MO(_LOWER) | ||
24 | #define RAISE MO(_RAISE) | ||
diff --git a/users/greatwizard/programmer.c b/users/greatwizard/programmer.c new file mode 100644 index 000000000..e0f71ea06 --- /dev/null +++ b/users/greatwizard/programmer.c | |||
@@ -0,0 +1,174 @@ | |||
1 | /* Copyright 2020 Guillaume Gérard | ||
2 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | */ | ||
16 | #include "programmer.h" | ||
17 | |||
18 | bool process_record_pg(uint16_t keycode, keyrecord_t *record) { | ||
19 | switch (keycode) { | ||
20 | case QWERTY_PROGRAMMER: | ||
21 | if (record->event.pressed) { | ||
22 | set_single_persistent_default_layer(_QWERTY_PROGRAMMER); | ||
23 | } | ||
24 | return false; | ||
25 | case WORKMAN_PROGRAMMER: | ||
26 | if (record->event.pressed) { | ||
27 | set_single_persistent_default_layer(_WORKMAN_PROGRAMMER); | ||
28 | } | ||
29 | return false; | ||
30 | case COLEMAK_PROGRAMMER: | ||
31 | if (record->event.pressed) { | ||
32 | set_single_persistent_default_layer(_COLEMAK_PROGRAMMER); | ||
33 | } | ||
34 | return false; | ||
35 | case DVORAK_PROGRAMMER: | ||
36 | if (record->event.pressed) { | ||
37 | set_single_persistent_default_layer(_DVORAK_PROGRAMMER); | ||
38 | } | ||
39 | return false; | ||
40 | case PG_GRV: | ||
41 | if (record->event.pressed) { | ||
42 | uint8_t current_mods = get_mods(); | ||
43 | if (current_mods & MOD_MASK_SHIFT) { | ||
44 | clear_mods(); | ||
45 | SEND_STRING("`"); | ||
46 | set_mods(current_mods); | ||
47 | } else { | ||
48 | SEND_STRING("~"); | ||
49 | } | ||
50 | } | ||
51 | return false; | ||
52 | case PG_1: | ||
53 | if (record->event.pressed) { | ||
54 | uint8_t current_mods = get_mods(); | ||
55 | if (current_mods & MOD_MASK_SHIFT) { | ||
56 | clear_mods(); | ||
57 | SEND_STRING("1"); | ||
58 | set_mods(current_mods); | ||
59 | } else { | ||
60 | SEND_STRING("!"); | ||
61 | } | ||
62 | } | ||
63 | return false; | ||
64 | case PG_2: | ||
65 | if (record->event.pressed) { | ||
66 | uint8_t current_mods = get_mods(); | ||
67 | if (current_mods & MOD_MASK_SHIFT) { | ||
68 | clear_mods(); | ||
69 | SEND_STRING("2"); | ||
70 | set_mods(current_mods); | ||
71 | } else { | ||
72 | SEND_STRING("@"); | ||
73 | } | ||
74 | } | ||
75 | return false; | ||
76 | case PG_3: | ||
77 | if (record->event.pressed) { | ||
78 | uint8_t current_mods = get_mods(); | ||
79 | if (current_mods & MOD_MASK_SHIFT) { | ||
80 | clear_mods(); | ||
81 | SEND_STRING("3"); | ||
82 | set_mods(current_mods); | ||
83 | } else { | ||
84 | SEND_STRING("#"); | ||
85 | } | ||
86 | } | ||
87 | return false; | ||
88 | case PG_4: | ||
89 | if (record->event.pressed) { | ||
90 | uint8_t current_mods = get_mods(); | ||
91 | if (current_mods & MOD_MASK_SHIFT) { | ||
92 | clear_mods(); | ||
93 | SEND_STRING("4"); | ||
94 | set_mods(current_mods); | ||
95 | } else { | ||
96 | SEND_STRING("$"); | ||
97 | } | ||
98 | } | ||
99 | return false; | ||
100 | case PG_5: | ||
101 | if (record->event.pressed) { | ||
102 | uint8_t current_mods = get_mods(); | ||
103 | if (current_mods & MOD_MASK_SHIFT) { | ||
104 | clear_mods(); | ||
105 | SEND_STRING("5"); | ||
106 | set_mods(current_mods); | ||
107 | } else { | ||
108 | SEND_STRING("%"); | ||
109 | } | ||
110 | } | ||
111 | return false; | ||
112 | case PG_6: | ||
113 | if (record->event.pressed) { | ||
114 | uint8_t current_mods = get_mods(); | ||
115 | if (current_mods & MOD_MASK_SHIFT) { | ||
116 | clear_mods(); | ||
117 | SEND_STRING("6"); | ||
118 | set_mods(current_mods); | ||
119 | } else { | ||
120 | SEND_STRING("^"); | ||
121 | } | ||
122 | } | ||
123 | return false; | ||
124 | case PG_7: | ||
125 | if (record->event.pressed) { | ||
126 | uint8_t current_mods = get_mods(); | ||
127 | if (current_mods & MOD_MASK_SHIFT) { | ||
128 | clear_mods(); | ||
129 | SEND_STRING("7"); | ||
130 | set_mods(current_mods); | ||
131 | } else { | ||
132 | SEND_STRING("&"); | ||
133 | } | ||
134 | } | ||
135 | return false; | ||
136 | case PG_8: | ||
137 | if (record->event.pressed) { | ||
138 | uint8_t current_mods = get_mods(); | ||
139 | if (current_mods & MOD_MASK_SHIFT) { | ||
140 | clear_mods(); | ||
141 | SEND_STRING("8"); | ||
142 | set_mods(current_mods); | ||
143 | } else { | ||
144 | SEND_STRING("*"); | ||
145 | } | ||
146 | } | ||
147 | return false; | ||
148 | case PG_9: | ||
149 | if (record->event.pressed) { | ||
150 | uint8_t current_mods = get_mods(); | ||
151 | if (current_mods & MOD_MASK_SHIFT) { | ||
152 | clear_mods(); | ||
153 | SEND_STRING("9"); | ||
154 | set_mods(current_mods); | ||
155 | } else { | ||
156 | SEND_STRING("("); | ||
157 | } | ||
158 | } | ||
159 | return false; | ||
160 | case PG_0: | ||
161 | if (record->event.pressed) { | ||
162 | uint8_t current_mods = get_mods(); | ||
163 | if (current_mods & MOD_MASK_SHIFT) { | ||
164 | clear_mods(); | ||
165 | SEND_STRING("0"); | ||
166 | set_mods(current_mods); | ||
167 | } else { | ||
168 | SEND_STRING(")"); | ||
169 | } | ||
170 | } | ||
171 | return false; | ||
172 | } | ||
173 | return true; | ||
174 | } | ||
diff --git a/users/greatwizard/programmer.h b/users/greatwizard/programmer.h new file mode 100644 index 000000000..a79aada24 --- /dev/null +++ b/users/greatwizard/programmer.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* Copyright 2020 Guillaume Gérard | ||
2 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | */ | ||
16 | #pragma once | ||
17 | |||
18 | #include QMK_KEYBOARD_H | ||
19 | #include "greatwizard.h" | ||
20 | |||
21 | bool process_record_pg(uint16_t keycode, keyrecord_t *record); | ||
22 | |||
23 | #define QWERTYP QWERTY_PROGRAMMER | ||
24 | #define WORKMNP WORKMAN_PROGRAMMER | ||
25 | #define COLEMKP COLEMAK_PROGRAMMER | ||
26 | #define DVORAKP DVORAK_PROGRAMMER | ||
27 | #ifdef TAP_DANCE_LSFT_CAPS | ||
28 | # define PG_LSCP TD(TD_PG_LSFT_CAPS) | ||
29 | #else | ||
30 | # define PG_LSCP LM(_PROGRAMMER_SHIFTED, MOD_LSFT) | ||
31 | #endif | ||
diff --git a/users/greatwizard/readme.md b/users/greatwizard/readme.md new file mode 100644 index 000000000..bc2df7f9b --- /dev/null +++ b/users/greatwizard/readme.md | |||
@@ -0,0 +1,32 @@ | |||
1 | # GreatWizard Userspace | ||
2 | |||
3 | ## Features | ||
4 | |||
5 | - ⌨️ Switchable and persistent base layers: Qwerty, Workman, Workman, Colemak, Dvorak, 🎮 Game | ||
6 | - ⌨️ Programmer flavored base layers available | ||
7 | - 💃🕺 Tap Dances | ||
8 | - 🆙 Auto Shift | ||
9 | - 👨💻 One shot keys git commands layer | ||
10 | - 🌈 RGB Underglow lights based on the layer | ||
11 | - ⚙️ Rotary encoder for volume level and next/previous media | ||
12 | - 🗜️ Enable link time optimization | ||
13 | |||
14 | ## Community Layouts | ||
15 | |||
16 | - [ortholinear 4x12](https://github.com/qmk/qmk_firmware/tree/master/layouts/community/ortho_4x12/greatwizard) | ||
17 | - [ortholinear 5x12](https://github.com/qmk/qmk_firmware/tree/master/layouts/community/ortho_5x12/greatwizard) | ||
18 | |||
19 | ## Build Options | ||
20 | |||
21 | ### Layers | ||
22 | |||
23 | - `LAYERS_ORTHO`: add Lower, Raise and Adjust layers/keycodes | ||
24 | - `LAYERS_PROGRAMMER`: add Programmer layers/keycodes | ||
25 | - `LAYER_GAME`: add Game layer/keycode | ||
26 | - `LAYER_GIT`: add GIT layer/keycode | ||
27 | - `LAYER_FN`: add Fn layer/keycode | ||
28 | |||
29 | ### Tap Dances | ||
30 | |||
31 | - `TAP_DANCE_LALT_GIT`: Double tap on LGUI to use the one shot keys git commands layer | ||
32 | - `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 000000000..92bb4ccd1 --- /dev/null +++ b/users/greatwizard/rules.mk | |||
@@ -0,0 +1,31 @@ | |||
1 | SRC += greatwizard.c | ||
2 | |||
3 | ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) | ||
4 | SRC += tap_dances.c | ||
5 | endif | ||
6 | |||
7 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) | ||
8 | SRC += underglow.c | ||
9 | endif | ||
10 | |||
11 | ifeq ($(strip $(LAYER_GAME)), yes) | ||
12 | SRC += game.c | ||
13 | endif | ||
14 | |||
15 | ifeq ($(strip $(LAYER_GIT)), yes) | ||
16 | SRC += git.c | ||
17 | endif | ||
18 | |||
19 | ifeq ($(strip $(LAYERS_ORTHO)), yes) | ||
20 | SRC += ortho.c | ||
21 | endif | ||
22 | |||
23 | ifeq ($(strip $(LAYERS_PROGRAMMER)), yes) | ||
24 | SRC += programmer.c | ||
25 | endif | ||
26 | |||
27 | ifneq ($(PLATFORM),CHIBIOS) | ||
28 | LTO_ENABLE = yes # Enable link time optimization | ||
29 | endif | ||
30 | |||
31 | 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 000000000..c6be995c4 --- /dev/null +++ b/users/greatwizard/tap_dances.c | |||
@@ -0,0 +1,105 @@ | |||
1 | /* Copyright 2020 Guillaume Gérard | ||
2 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | */ | ||
16 | #include "tap_dances.h" | ||
17 | |||
18 | uint8_t cur_dance(qk_tap_dance_state_t *state) { | ||
19 | if (state->count == 1) { | ||
20 | if (state->interrupted || !state->pressed) return SINGLE_TAP; | ||
21 | else return SINGLE_HOLD; | ||
22 | } else if (state->count == 2) { | ||
23 | if (state->interrupted) return DOUBLE_SINGLE_TAP; | ||
24 | else if (state->pressed) return DOUBLE_HOLD; | ||
25 | else return DOUBLE_TAP; | ||
26 | } | ||
27 | if (state->count == 3) { | ||
28 | if (state->interrupted || !state->pressed) return TRIPLE_TAP; | ||
29 | else return TRIPLE_HOLD; | ||
30 | } else return 8; | ||
31 | } | ||
32 | |||
33 | static tap tap_state = { | ||
34 | .is_press_action = true, | ||
35 | .state = 0 | ||
36 | }; | ||
37 | |||
38 | #ifdef TAP_DANCE_LALT_GIT | ||
39 | void lalt_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
40 | tap_state.state = cur_dance(state); | ||
41 | switch (tap_state.state) { | ||
42 | case SINGLE_HOLD: | ||
43 | register_mods(MOD_BIT(KC_LALT)); | ||
44 | break; | ||
45 | case DOUBLE_SINGLE_TAP: | ||
46 | case DOUBLE_TAP: | ||
47 | set_oneshot_layer(_GIT, ONESHOT_START); | ||
48 | break; | ||
49 | } | ||
50 | } | ||
51 | |||
52 | void lalt_reset(qk_tap_dance_state_t *state, void *user_data) { | ||
53 | switch (tap_state.state) { | ||
54 | case SINGLE_HOLD: | ||
55 | unregister_mods(MOD_BIT(KC_LALT)); | ||
56 | break; | ||
57 | case DOUBLE_SINGLE_TAP: | ||
58 | case DOUBLE_TAP: | ||
59 | clear_oneshot_layer_state(ONESHOT_PRESSED); | ||
60 | break; | ||
61 | } | ||
62 | tap_state.state = 0; | ||
63 | } | ||
64 | #endif | ||
65 | |||
66 | #ifdef TAP_DANCE_LSFT_CAPS | ||
67 | # ifdef LAYERS_PROGRAMMER | ||
68 | void pg_lsft_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
69 | tap_state.state = cur_dance(state); | ||
70 | switch (tap_state.state) { | ||
71 | case SINGLE_HOLD: | ||
72 | register_mods(MOD_BIT(KC_LSFT)); | ||
73 | layer_on(_PROGRAMMER_SHIFTED); | ||
74 | break; | ||
75 | case DOUBLE_SINGLE_TAP: | ||
76 | case DOUBLE_TAP: | ||
77 | tap_code(KC_CAPS); | ||
78 | layer_on(_PROGRAMMER_SHIFTED); | ||
79 | break; | ||
80 | } | ||
81 | } | ||
82 | |||
83 | void pg_lsft_reset(qk_tap_dance_state_t *state, void *user_data) { | ||
84 | switch (tap_state.state) { | ||
85 | case SINGLE_HOLD: | ||
86 | unregister_mods(MOD_BIT(KC_LSFT)); | ||
87 | layer_off(_PROGRAMMER_SHIFTED); | ||
88 | break; | ||
89 | } | ||
90 | tap_state.state = 0; | ||
91 | } | ||
92 | # endif | ||
93 | #endif | ||
94 | |||
95 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
96 | #ifdef TAP_DANCE_LALT_GIT | ||
97 | [TD_LALT_GIT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, lalt_finished, lalt_reset), | ||
98 | #endif | ||
99 | #ifdef TAP_DANCE_LSFT_CAPS | ||
100 | [TD_LSFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS), | ||
101 | # ifdef LAYERS_PROGRAMMER | ||
102 | [TD_PG_LSFT_CAPS] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, pg_lsft_finished, pg_lsft_reset), | ||
103 | # endif | ||
104 | #endif | ||
105 | }; | ||
diff --git a/users/greatwizard/tap_dances.h b/users/greatwizard/tap_dances.h new file mode 100644 index 000000000..944ae4555 --- /dev/null +++ b/users/greatwizard/tap_dances.h | |||
@@ -0,0 +1,65 @@ | |||
1 | /* Copyright 2020 Guillaume Gérard | ||
2 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | */ | ||
16 | #pragma once | ||
17 | |||
18 | #include QMK_KEYBOARD_H | ||
19 | #include "greatwizard.h" | ||
20 | |||
21 | typedef struct { | ||
22 | bool is_press_action; | ||
23 | uint8_t state; | ||
24 | } tap; | ||
25 | |||
26 | enum { | ||
27 | SINGLE_TAP = 1, | ||
28 | SINGLE_HOLD, | ||
29 | DOUBLE_TAP, | ||
30 | DOUBLE_HOLD, | ||
31 | DOUBLE_SINGLE_TAP, | ||
32 | TRIPLE_TAP, | ||
33 | TRIPLE_HOLD | ||
34 | }; | ||
35 | |||
36 | enum { | ||
37 | #ifdef TAP_DANCE_LALT_GIT | ||
38 | TD_LALT_GIT, | ||
39 | #endif | ||
40 | #ifdef TAP_DANCE_LSFT_CAPS | ||
41 | TD_LSFT_CAPS, | ||
42 | # ifdef LAYERS_PROGRAMMER | ||
43 | TD_PG_LSFT_CAPS, | ||
44 | # endif | ||
45 | #endif | ||
46 | }; | ||
47 | |||
48 | uint8_t cur_dance(qk_tap_dance_state_t *state); | ||
49 | |||
50 | #ifdef TAP_DANCE_LALT_GIT | ||
51 | void lalt_finished(qk_tap_dance_state_t *state, void *user_data); | ||
52 | void lalt_reset(qk_tap_dance_state_t *state, void *user_data); | ||
53 | # define TD_LALT TD(TD_LALT_GIT) | ||
54 | #endif | ||
55 | |||
56 | #ifdef TAP_DANCE_LSFT_CAPS | ||
57 | # ifdef LAYERS_PROGRAMMER | ||
58 | void pg_lsft_finished(qk_tap_dance_state_t *state, void *user_data); | ||
59 | void pg_lsft_reset(qk_tap_dance_state_t *state, void *user_data); | ||
60 | # endif | ||
61 | #endif | ||
62 | |||
63 | #ifdef TAP_DANCE_LSFT_CAPS | ||
64 | # define TD_LSCP TD(TD_LSFT_CAPS) | ||
65 | #endif | ||
diff --git a/users/greatwizard/underglow.c b/users/greatwizard/underglow.c new file mode 100644 index 000000000..db31290ac --- /dev/null +++ b/users/greatwizard/underglow.c | |||
@@ -0,0 +1,109 @@ | |||
1 | /* Copyright 2020 Guillaume Gérard | ||
2 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | */ | ||
16 | #include "underglow.h" | ||
17 | |||
18 | void keyboard_post_init_rgb(void) { | ||
19 | user_config_t user_config; | ||
20 | user_config.raw = eeconfig_read_user(); | ||
21 | if (!user_config.rgb_layer_change) { | ||
22 | return; | ||
23 | } | ||
24 | rgblight_enable_noeeprom(); | ||
25 | rgblight_sethsv_noeeprom_orange(); | ||
26 | rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); | ||
27 | } | ||
28 | |||
29 | bool process_record_rgb(uint16_t keycode, keyrecord_t *record) { | ||
30 | switch (keycode) { | ||
31 | case RGB_LAYER: | ||
32 | if (record->event.pressed) { | ||
33 | user_config_t user_config; | ||
34 | user_config.raw = eeconfig_read_user(); | ||
35 | user_config.rgb_layer_change ^= 1; | ||
36 | eeconfig_update_user(user_config.raw); | ||
37 | if (user_config.rgb_layer_change) { | ||
38 | layer_state_set(layer_state); | ||
39 | } | ||
40 | } | ||
41 | return false; | ||
42 | case RGB_MODE_FORWARD ... RGB_MODE_RGBTEST: | ||
43 | if (record->event.pressed) { | ||
44 | user_config_t user_config; | ||
45 | user_config.raw = eeconfig_read_user(); | ||
46 | if (user_config.rgb_layer_change) { | ||
47 | user_config.rgb_layer_change = false; | ||
48 | eeconfig_update_user(user_config.raw); | ||
49 | } | ||
50 | } | ||
51 | return true; | ||
52 | } | ||
53 | return true; | ||
54 | } | ||
55 | |||
56 | layer_state_t layer_state_set_rgb(layer_state_t state) { | ||
57 | user_config_t user_config; | ||
58 | user_config.raw = eeconfig_read_user(); | ||
59 | if (!user_config.rgb_layer_change) { | ||
60 | return state; | ||
61 | } | ||
62 | switch (get_highest_layer(state)) { | ||
63 | case _QWERTY: | ||
64 | #ifdef LAYERS_PROGRAMMER | ||
65 | case _PROGRAMMER_SHIFTED: | ||
66 | #endif | ||
67 | rgblight_sethsv_noeeprom_orange(); | ||
68 | break; | ||
69 | #ifdef LAYERS_ORTHO | ||
70 | case _LOWER: | ||
71 | rgblight_sethsv_noeeprom_red(); | ||
72 | break; | ||
73 | case _RAISE: | ||
74 | rgblight_sethsv_noeeprom_blue(); | ||
75 | break; | ||
76 | case _ADJUST: | ||
77 | rgblight_sethsv_noeeprom_purple(); | ||
78 | break; | ||
79 | #endif | ||
80 | #ifdef LAYER_FN | ||
81 | case _FN: | ||
82 | rgblight_sethsv_noeeprom_chartreuse(); | ||
83 | break; | ||
84 | #endif | ||
85 | #ifdef LAYER_GIT | ||
86 | case _GIT: | ||
87 | rgblight_sethsv_noeeprom_teal(); | ||
88 | break; | ||
89 | #endif | ||
90 | default: | ||
91 | rgblight_sethsv_noeeprom_white(); | ||
92 | break; | ||
93 | } | ||
94 | return state; | ||
95 | } | ||
96 | |||
97 | bool led_update_rgb(led_t led_state) { | ||
98 | user_config_t user_config; | ||
99 | user_config.raw = eeconfig_read_user(); | ||
100 | if (!user_config.rgb_layer_change) { | ||
101 | return true; | ||
102 | } | ||
103 | if (led_state.caps_lock) { | ||
104 | rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); | ||
105 | } else { | ||
106 | rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); | ||
107 | } | ||
108 | return true; | ||
109 | } | ||
diff --git a/users/greatwizard/underglow.h b/users/greatwizard/underglow.h new file mode 100644 index 000000000..7e073b857 --- /dev/null +++ b/users/greatwizard/underglow.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* Copyright 2020 Guillaume Gérard | ||
2 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | */ | ||
16 | #pragma once | ||
17 | |||
18 | #include QMK_KEYBOARD_H | ||
19 | #include "greatwizard.h" | ||
20 | |||
21 | void keyboard_post_init_rgb(void); | ||
22 | bool process_record_rgb(uint16_t keycode, keyrecord_t *record); | ||
23 | layer_state_t layer_state_set_rgb(layer_state_t state); | ||
24 | bool led_update_rgb(led_t led_state); | ||