diff options
-rw-r--r-- | keyboards/planck/keymaps/ariccb/.vscode/settings.json | 5 | ||||
-rw-r--r-- | keyboards/planck/keymaps/ariccb/config.h | 56 | ||||
-rw-r--r-- | keyboards/planck/keymaps/ariccb/features/caps_word.c | 122 | ||||
-rw-r--r-- | keyboards/planck/keymaps/ariccb/features/caps_word.h | 101 | ||||
-rw-r--r-- | keyboards/planck/keymaps/ariccb/features/select_word.c | 110 | ||||
-rw-r--r-- | keyboards/planck/keymaps/ariccb/features/select_word.h | 37 | ||||
-rw-r--r-- | keyboards/planck/keymaps/ariccb/keymap.c | 664 | ||||
-rw-r--r-- | keyboards/planck/keymaps/ariccb/readme.md | 78 | ||||
-rw-r--r-- | keyboards/planck/keymaps/ariccb/rules.mk | 10 |
9 files changed, 1183 insertions, 0 deletions
diff --git a/keyboards/planck/keymaps/ariccb/.vscode/settings.json b/keyboards/planck/keymaps/ariccb/.vscode/settings.json new file mode 100644 index 000000000..31e9436a7 --- /dev/null +++ b/keyboards/planck/keymaps/ariccb/.vscode/settings.json | |||
@@ -0,0 +1,5 @@ | |||
1 | { | ||
2 | "files.associations": { | ||
3 | "select_word.h": "c" | ||
4 | } | ||
5 | } \ No newline at end of file | ||
diff --git a/keyboards/planck/keymaps/ariccb/config.h b/keyboards/planck/keymaps/ariccb/config.h new file mode 100644 index 000000000..322aa9277 --- /dev/null +++ b/keyboards/planck/keymaps/ariccb/config.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* Copyright 2015-2021 Jack Humbert | ||
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 | |||
17 | #pragma once | ||
18 | |||
19 | #ifdef AUDIO_ENABLE | ||
20 | # define STARTUP_SONG SONG(PLANCK_SOUND) | ||
21 | // #define STARTUP_SONG SONG(NO_SOUND) | ||
22 | |||
23 | # define DEFAULT_LAYER_SONGS \ | ||
24 | { SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND) } | ||
25 | #endif | ||
26 | /* | ||
27 | * MIDI options | ||
28 | */ | ||
29 | |||
30 | /* enable basic MIDI features: | ||
31 | - MIDI notes can be sent when in Music mode is on | ||
32 | */ | ||
33 | #define MIDI_BASIC | ||
34 | /* enable advanced MIDI features: | ||
35 | - MIDI notes can be added to the keymap | ||
36 | - Octave shift and transpose | ||
37 | - Virtual sustain, portamento, and modulation wheel | ||
38 | - etc. | ||
39 | */ | ||
40 | //#define MIDI_ADVANCED | ||
41 | |||
42 | #define TAPPING_TERM 150 | ||
43 | #define IGNORE_MOD_TAP_INTERRUPT | ||
44 | // #define IGNORE_MOD_TAP_INTERRUPT | ||
45 | // #define HOLD_ON_OTHER_KEY_PRESS | ||
46 | |||
47 | #define COMBO_TERM 20 | ||
48 | |||
49 | |||
50 | |||
51 | #define MOUSEKEY_INTERVAL 16 //Time between cursor movements in milliseconds. | ||
52 | //If the refresh rate of your display is 60Hz, you could set it to 16 (1/60). As this raises the cursor speed significantly, you may want to lower MOUSEKEY_MAX_SPEED | ||
53 | #define MOUSEKEY_MAX_SPEED 8 //Maximum cursor speed at which acceleration stops | ||
54 | #define MOUSEKEY_TIME_TO_MAX 50 //Time until maximum scroll speed is reached | ||
55 | #define MOUSEKEY_DELAY 100 //Delay between pressing a movement key and cursor movement | ||
56 | #define MOUSEKEY_MOVE_DELTA 8 //Step size | ||
diff --git a/keyboards/planck/keymaps/ariccb/features/caps_word.c b/keyboards/planck/keymaps/ariccb/features/caps_word.c new file mode 100644 index 000000000..c37e65d28 --- /dev/null +++ b/keyboards/planck/keymaps/ariccb/features/caps_word.c | |||
@@ -0,0 +1,122 @@ | |||
1 | // Copyright 2021-2022 Google LLC | ||
2 | // | ||
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | // you may not use this file except in compliance with the License. | ||
5 | // You may obtain a copy of the License at | ||
6 | // | ||
7 | // https://www.apache.org/licenses/LICENSE-2.0 | ||
8 | // | ||
9 | // Unless required by applicable law or agreed to in writing, software | ||
10 | // distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | // See the License for the specific language governing permissions and | ||
13 | // limitations under the License. | ||
14 | // | ||
15 | // | ||
16 | // For full documentation, see | ||
17 | // https://getreuer.info/posts/keyboards/caps-word | ||
18 | |||
19 | #include "caps_word.h" | ||
20 | |||
21 | static bool caps_word_active = false; | ||
22 | |||
23 | bool process_caps_word(uint16_t keycode, keyrecord_t* record) { | ||
24 | #ifndef NO_ACTION_ONESHOT | ||
25 | const uint8_t mods = get_mods() | get_oneshot_mods(); | ||
26 | #else | ||
27 | const uint8_t mods = get_mods(); | ||
28 | #endif // NO_ACTION_ONESHOT | ||
29 | |||
30 | if (!caps_word_active) { | ||
31 | // Pressing both shift keys at the same time enables caps word. | ||
32 | if ((mods & MOD_MASK_SHIFT) == MOD_MASK_SHIFT) { | ||
33 | caps_word_set(true); // Activate Caps Word. | ||
34 | return false; | ||
35 | } | ||
36 | return true; | ||
37 | } | ||
38 | |||
39 | if (!record->event.pressed) { return true; } | ||
40 | |||
41 | if (!(mods & ~MOD_MASK_SHIFT)) { | ||
42 | switch (keycode) { | ||
43 | // Ignore MO, TO, TG, TT, and OSL layer switch keys. | ||
44 | case QK_MOMENTARY ... QK_MOMENTARY + 255: | ||
45 | case QK_TO ... QK_TO + 255: | ||
46 | case QK_TOGGLE_LAYER ... QK_TOGGLE_LAYER + 255: | ||
47 | case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE + 255: | ||
48 | case QK_ONE_SHOT_LAYER ... QK_ONE_SHOT_LAYER + 255: | ||
49 | return true; | ||
50 | |||
51 | #ifndef NO_ACTION_TAPPING | ||
52 | case QK_MOD_TAP ... QK_MOD_TAP_MAX: | ||
53 | if (record->tap.count == 0) { | ||
54 | // Deactivate if a mod becomes active through holding a mod-tap key. | ||
55 | caps_word_set(false); | ||
56 | return true; | ||
57 | } | ||
58 | keycode &= 0xff; | ||
59 | break; | ||
60 | |||
61 | #ifndef NO_ACTION_LAYER | ||
62 | case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: | ||
63 | #endif // NO_ACTION_LAYER | ||
64 | if (record->tap.count == 0) { return true; } | ||
65 | keycode &= 0xff; | ||
66 | break; | ||
67 | #endif // NO_ACTION_TAPPING | ||
68 | |||
69 | #ifdef SWAP_HANDS_ENABLE | ||
70 | case QK_SWAP_HANDS ... QK_SWAP_HANDS_MAX: | ||
71 | if (keycode > 0x56F0 || record->tap.count == 0) { return true; } | ||
72 | keycode &= 0xff; | ||
73 | break; | ||
74 | #endif // SWAP_HANDS_ENABLE | ||
75 | } | ||
76 | |||
77 | if (caps_word_press_user(keycode)) { | ||
78 | return true; | ||
79 | } | ||
80 | } | ||
81 | |||
82 | caps_word_set(false); // Deactivate Caps Word. | ||
83 | return true; | ||
84 | } | ||
85 | |||
86 | void caps_word_set(bool active) { | ||
87 | if (active != caps_word_active) { | ||
88 | if (active) { | ||
89 | clear_mods(); | ||
90 | #ifndef NO_ACTION_ONESHOT | ||
91 | clear_oneshot_mods(); | ||
92 | #endif // NO_ACTION_ONESHOT | ||
93 | } | ||
94 | |||
95 | caps_word_active = active; | ||
96 | caps_word_set_user(active); | ||
97 | } | ||
98 | } | ||
99 | |||
100 | bool caps_word_get(void) { return caps_word_active; } | ||
101 | |||
102 | __attribute__((weak)) void caps_word_set_user(bool active) {} | ||
103 | |||
104 | __attribute__((weak)) bool caps_word_press_user(uint16_t keycode) { | ||
105 | switch (keycode) { | ||
106 | // Keycodes that continue Caps Word, with shift applied. | ||
107 | case KC_A ... KC_Z: | ||
108 | add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to the next key. | ||
109 | return true; | ||
110 | |||
111 | // Keycodes that continue Caps Word, without shifting. | ||
112 | case KC_1 ... KC_0: | ||
113 | case KC_P1 ... KC_P0: | ||
114 | case KC_BSPC: | ||
115 | case KC_MINS: | ||
116 | case KC_UNDS: | ||
117 | return true; | ||
118 | |||
119 | default: | ||
120 | return false; // Deactivate Caps Word. | ||
121 | } | ||
122 | } \ No newline at end of file | ||
diff --git a/keyboards/planck/keymaps/ariccb/features/caps_word.h b/keyboards/planck/keymaps/ariccb/features/caps_word.h new file mode 100644 index 000000000..523c81515 --- /dev/null +++ b/keyboards/planck/keymaps/ariccb/features/caps_word.h | |||
@@ -0,0 +1,101 @@ | |||
1 | // Copyright 2021-2022 Google LLC | ||
2 | // | ||
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | // you may not use this file except in compliance with the License. | ||
5 | // You may obtain a copy of the License at | ||
6 | // | ||
7 | // https://www.apache.org/licenses/LICENSE-2.0 | ||
8 | // | ||
9 | // Unless required by applicable law or agreed to in writing, software | ||
10 | // distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | // See the License for the specific language governing permissions and | ||
13 | // limitations under the License. | ||
14 | // | ||
15 | // | ||
16 | // Caps Word, activated by pressing both shift keys at the same time. | ||
17 | // | ||
18 | // This library implements "Caps Word", which is like conventional Caps Lock, | ||
19 | // but automatically disables itself at the end of the word. This is useful for | ||
20 | // typing all-caps identifiers like `MOD_MASK_ALT`. | ||
21 | // | ||
22 | // Caps Word is activated by pressing the left and right shift keys at the same | ||
23 | // time. This way you don't need a dedicated key for using Caps Word. I've | ||
24 | // tested that this works as expected with one-shot mods and Space Cadet Shift. | ||
25 | // If your shift keys are mod-taps, activate Caps Word by holding both shift | ||
26 | // mod-tap keys until the tapping term, release them, then begin typing. | ||
27 | // | ||
28 | // For full documentation, see | ||
29 | // https://getreuer.info/posts/keyboards/caps-word | ||
30 | |||
31 | #pragma once | ||
32 | |||
33 | #include QMK_KEYBOARD_H | ||
34 | |||
35 | // Call this function from `process_record_user()` to implement Caps Word. | ||
36 | bool process_caps_word(uint16_t keycode, keyrecord_t* record); | ||
37 | |||
38 | // Activates or deactivates Caps Word. For instance activate Caps Word with a | ||
39 | // combo by defining a `COMBO_ACTION` that calls `caps_word_set(true)`: | ||
40 | // | ||
41 | // void process_combo_event(uint16_t combo_index, bool pressed) { | ||
42 | // switch(combo_index) { | ||
43 | // case CAPS_COMBO: | ||
44 | // if (pressed) { | ||
45 | // caps_word_set(true); // Activate Caps Word. | ||
46 | // } | ||
47 | // break; | ||
48 | // | ||
49 | // // Other combos... | ||
50 | // } | ||
51 | // } | ||
52 | void caps_word_set(bool active); | ||
53 | |||
54 | // Returns whether Caps Word is currently active. | ||
55 | bool caps_word_get(void); | ||
56 | |||
57 | // An optional callback that gets called when Caps Word turns on or off. This is | ||
58 | // useful to represent the current Caps Word state, e.g. by setting an LED or | ||
59 | // playing a sound. In your keymap, define | ||
60 | // | ||
61 | // void caps_word_set_user(bool active) { | ||
62 | // if (active) { | ||
63 | // // Do something when Caps Word activates. | ||
64 | // } else { | ||
65 | // // Do something when Caps Word deactivates. | ||
66 | // } | ||
67 | // } | ||
68 | void caps_word_set_user(bool active); | ||
69 | |||
70 | // An optional callback which is called on every key press while Caps Word is | ||
71 | // active. When the key should be shifted (that is, a letter key), the callback | ||
72 | // should call `add_weak_mods(MOD_BIT(KC_LSFT))` to shift the key. The callback | ||
73 | // also determines whether the key should continue Caps Word. Returning true | ||
74 | // continues the current "word", while returning false is "word breaking" and | ||
75 | // deactivates Caps Word. The default callback is | ||
76 | // | ||
77 | // bool caps_word_press_user(uint16_t keycode) { | ||
78 | // switch (keycode) { | ||
79 | // // Keycodes that continue Caps Word, with shift applied. | ||
80 | // case KC_A ... KC_Z: | ||
81 | // add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to the next key. | ||
82 | // return true; | ||
83 | // | ||
84 | // // Keycodes that continue Caps Word, without shifting. | ||
85 | // case KC_1 ... KC_0: | ||
86 | // case KC_BSPC: | ||
87 | // case KC_MINS: | ||
88 | // case KC_UNDS: | ||
89 | // return true; | ||
90 | // | ||
91 | // default: | ||
92 | // return false; // Deactivate Caps Word. | ||
93 | // } | ||
94 | // } | ||
95 | // | ||
96 | // To customize, copy the above function into your keymap and add/remove | ||
97 | // keycodes to the above cases. | ||
98 | // | ||
99 | // NOTE: Outside of this callback, you can use `caps_word_set(false)` to | ||
100 | // deactivate Caps Word. | ||
101 | bool caps_word_press_user(uint16_t keycode); \ No newline at end of file | ||
diff --git a/keyboards/planck/keymaps/ariccb/features/select_word.c b/keyboards/planck/keymaps/ariccb/features/select_word.c new file mode 100644 index 000000000..c0ffe0a90 --- /dev/null +++ b/keyboards/planck/keymaps/ariccb/features/select_word.c | |||
@@ -0,0 +1,110 @@ | |||
1 | // Copyright 2021 Google LLC | ||
2 | // | ||
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | // you may not use this file except in compliance with the License. | ||
5 | // You may obtain a copy of the License at | ||
6 | // | ||
7 | // https://www.apache.org/licenses/LICENSE-2.0 | ||
8 | // | ||
9 | // Unless required by applicable law or agreed to in writing, software | ||
10 | // distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | // See the License for the specific language governing permissions and | ||
13 | // limitations under the License. | ||
14 | // | ||
15 | // | ||
16 | // For full documentation, see | ||
17 | // https://getreuer.info/posts/keyboards/select-word | ||
18 | |||
19 | #include "select_word.h" | ||
20 | |||
21 | // Mac users, uncomment this line: | ||
22 | // #define MAC_HOTKEYS | ||
23 | |||
24 | enum { STATE_NONE, STATE_SELECTED, STATE_WORD, STATE_FIRST_LINE, STATE_LINE }; | ||
25 | |||
26 | bool process_select_word(uint16_t keycode, keyrecord_t* record, | ||
27 | uint16_t sel_keycode) { | ||
28 | static uint8_t state = STATE_NONE; | ||
29 | |||
30 | if (keycode == KC_LSFT || keycode == KC_RSFT) { return true; } | ||
31 | |||
32 | if (keycode == sel_keycode && record->event.pressed) { // On key press. | ||
33 | const uint8_t mods = get_mods(); | ||
34 | #ifndef NO_ACTION_ONESHOT | ||
35 | const uint8_t all_mods = mods | get_oneshot_mods(); | ||
36 | #else | ||
37 | const uint8_t all_mods = mods; | ||
38 | #endif // NO_ACTION_ONESHOT | ||
39 | if ((all_mods & MOD_MASK_SHIFT) == 0) { // Select word. | ||
40 | #ifdef MAC_HOTKEYS | ||
41 | register_code(KC_LALT); | ||
42 | #else | ||
43 | register_code(KC_LCTL); | ||
44 | #endif // MAC_HOTKEYS | ||
45 | if (state == STATE_NONE) { | ||
46 | tap_code(KC_RGHT); | ||
47 | tap_code(KC_LEFT); | ||
48 | } | ||
49 | register_code(KC_LSFT); | ||
50 | register_code(KC_RGHT); | ||
51 | state = STATE_WORD; | ||
52 | } else { // Select line. | ||
53 | if (state == STATE_NONE) { | ||
54 | clear_mods(); | ||
55 | #ifndef NO_ACTION_ONESHOT | ||
56 | clear_oneshot_mods(); | ||
57 | #endif // NO_ACTION_ONESHOT | ||
58 | #ifdef MAC_HOTKEYS | ||
59 | register_code16(LCTL(KC_A)); | ||
60 | tap_code16(LSFT(KC_E)); | ||
61 | unregister_code16(LCTL(KC_A)); | ||
62 | #else | ||
63 | tap_code(KC_HOME); | ||
64 | tap_code16(LSFT(KC_END)); | ||
65 | #endif // MAC_HOTKEYS | ||
66 | set_mods(mods); | ||
67 | state = STATE_FIRST_LINE; | ||
68 | } else { | ||
69 | register_code(KC_DOWN); | ||
70 | state = STATE_LINE; | ||
71 | } | ||
72 | } | ||
73 | return false; | ||
74 | } | ||
75 | |||
76 | // `sel_keycode` was released, or another key was pressed. | ||
77 | switch (state) { | ||
78 | case STATE_WORD: | ||
79 | unregister_code(KC_RGHT); | ||
80 | unregister_code(KC_LSFT); | ||
81 | #ifdef MAC_HOTKEYS | ||
82 | unregister_code(KC_LALT); | ||
83 | #else | ||
84 | unregister_code(KC_LCTL); | ||
85 | #endif // MAC_HOTKEYS | ||
86 | state = STATE_SELECTED; | ||
87 | break; | ||
88 | |||
89 | case STATE_FIRST_LINE: | ||
90 | state = STATE_SELECTED; | ||
91 | break; | ||
92 | |||
93 | case STATE_LINE: | ||
94 | unregister_code(KC_DOWN); | ||
95 | state = STATE_SELECTED; | ||
96 | break; | ||
97 | |||
98 | case STATE_SELECTED: | ||
99 | if (keycode == KC_ESC) { | ||
100 | tap_code(KC_RGHT); | ||
101 | state = STATE_NONE; | ||
102 | return false; | ||
103 | } | ||
104 | // Fallthrough. | ||
105 | default: | ||
106 | state = STATE_NONE; | ||
107 | } | ||
108 | |||
109 | return true; | ||
110 | } | ||
diff --git a/keyboards/planck/keymaps/ariccb/features/select_word.h b/keyboards/planck/keymaps/ariccb/features/select_word.h new file mode 100644 index 000000000..f762ba117 --- /dev/null +++ b/keyboards/planck/keymaps/ariccb/features/select_word.h | |||
@@ -0,0 +1,37 @@ | |||
1 | // Copyright 2021 Google LLC | ||
2 | // | ||
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | // you may not use this file except in compliance with the License. | ||
5 | // You may obtain a copy of the License at | ||
6 | // | ||
7 | // https://www.apache.org/licenses/LICENSE-2.0 | ||
8 | // | ||
9 | // Unless required by applicable law or agreed to in writing, software | ||
10 | // distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | // See the License for the specific language governing permissions and | ||
13 | // limitations under the License. | ||
14 | // | ||
15 | // | ||
16 | // Select word/line button. | ||
17 | // | ||
18 | // Implements a button that selects the current word, assuming conventional text | ||
19 | // editor hotkeys. Pressing it again extends the selection to the following | ||
20 | // word. The effect is similar to word selection (W) in the Kakoune editor. | ||
21 | // | ||
22 | // Pressing the button with shift selects the current line, and pressing the | ||
23 | // button again extends the selection to the following line. | ||
24 | // | ||
25 | // Note for Mac users: Windows/Linux editing hotkeys are assumed by default. | ||
26 | // Uncomment the `#define MAC_HOTKEYS` line in select_word.c for Mac hotkeys. | ||
27 | // The Mac implementation is untested, let me know if it has problems. | ||
28 | // | ||
29 | // For full documentation, see | ||
30 | // https://getreuer.info/posts/keyboards/select-word | ||
31 | |||
32 | #pragma once | ||
33 | |||
34 | #include QMK_KEYBOARD_H | ||
35 | |||
36 | bool process_select_word(uint16_t keycode, keyrecord_t* record, | ||
37 | uint16_t sel_keycode); | ||
diff --git a/keyboards/planck/keymaps/ariccb/keymap.c b/keyboards/planck/keymaps/ariccb/keymap.c new file mode 100644 index 000000000..c0b4e490f --- /dev/null +++ b/keyboards/planck/keymaps/ariccb/keymap.c | |||
@@ -0,0 +1,664 @@ | |||
1 | /* Copyright 2021 Aric Crosson Bouwers | ||
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 | |||
17 | #include QMK_KEYBOARD_H | ||
18 | #include "muse.h" | ||
19 | #include "features/select_word.h" | ||
20 | #include "features/caps_word.h" | ||
21 | |||
22 | // using the Word Selection QMK Macro by Pascal Getreuer, found here: https://getreuer.info/posts/keyboards/select-word/index.html | ||
23 | // THANKS Pascal for such amazing functionality!! | ||
24 | |||
25 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
26 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
27 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
28 | // entirely and just use numbers. | ||
29 | #define _QWERTY 0 | ||
30 | #define _COLEMAK_VCP 1 | ||
31 | #define _LOWER 2 | ||
32 | #define _RAISE 3 | ||
33 | #define _NUMPAD 4 | ||
34 | #define _FN 5 | ||
35 | #define _ADJUST 6 | ||
36 | #define _GAMING 7 | ||
37 | |||
38 | #define MICMUTE LALT(KC_M) | ||
39 | #define DESKTR LGUI(LCTL(KC_RGHT)) // move one virtual desktop to the right | ||
40 | #define DESKTL LGUI(LCTL(KC_LEFT)) // move one virtual desktop to the left | ||
41 | #define MTLCTL_F9 MT(MOD_LCTL, KC_F9) | ||
42 | #define MTLSFT_F10 MT(MOD_LSFT, KC_F10) | ||
43 | #define MTLALT_F11 MT(MOD_LALT, KC_F11) | ||
44 | #define MTLGUI_Z MT(MOD_LGUI, KC_Z) | ||
45 | #define MTLALT_PL MT(MOD_LALT, KC_MPLY) | ||
46 | #define MTLALT_NXT MT(MOD_LALT, KC_MNXT) | ||
47 | #define MTENTER MT(MOD_LCTL, KC_ENT) | ||
48 | #define MTRSFTBSLS MT(MOD_RSFT, KC_BSLS) | ||
49 | #define MTRCTLQUO MT(MOD_RCTL, KC_QUOT) | ||
50 | #define MTTAB MT(MOD_LCTL | MOD_LGUI | MOD_LALT, KC_TAB) | ||
51 | #define LTESC LT(_FN, KC_ESC) | ||
52 | #define MTPLAY MT(MOD_RALT, KC_MPLY) | ||
53 | #define KC_COPY LCTL(KC_C) | ||
54 | #define KC_CUT LCTL(KC_X) | ||
55 | #define KC_PASTE LCTL(KC_V) | ||
56 | #define KC_WINPASTE LGUI(KC_V) | ||
57 | #define KC_PTXT LCTL(LSFT(KC_V)) | ||
58 | #define KC_UNDO LCTL(KC_Z) | ||
59 | #define KC_REDO LCTL(KC_Y) | ||
60 | |||
61 | enum planck_keycodes { | ||
62 | QWERTY = SAFE_RANGE, | ||
63 | COLEMAK_VCP, | ||
64 | LOWER, | ||
65 | RAISE, | ||
66 | FN, | ||
67 | ADJUST, | ||
68 | NUMPAD, | ||
69 | GAMING, | ||
70 | EXT_NUM, | ||
71 | EXT_GAMING, | ||
72 | SELWORD, | ||
73 | BRACES, | ||
74 | BRACES2, | ||
75 | ARROW, | ||
76 | ALT_TAB | ||
77 | }; | ||
78 | |||
79 | // Define a type for as many tap dance states as you need | ||
80 | typedef enum { | ||
81 | TD_NONE, | ||
82 | TD_UNKNOWN, | ||
83 | TD_SINGLE_TAP, | ||
84 | TD_SINGLE_HOLD, | ||
85 | TD_DOUBLE_TAP | ||
86 | } td_state_t; | ||
87 | |||
88 | typedef struct { | ||
89 | bool is_press_action; | ||
90 | td_state_t state; | ||
91 | } td_tap_t; | ||
92 | |||
93 | // Our custom tap dance keys; add any other tap dance keys to this enum | ||
94 | enum { | ||
95 | UNDS_LOWER, | ||
96 | PLAY_RAISE | ||
97 | }; | ||
98 | |||
99 | // Declare the functions to be used with your tap dance key(s) | ||
100 | // Function associated with all tap dances | ||
101 | td_state_t cur_dance(qk_tap_dance_state_t *state); | ||
102 | |||
103 | // Functions associated with individual tap dances | ||
104 | void usl_finished(qk_tap_dance_state_t *state, void *user_data); | ||
105 | void usl_reset(qk_tap_dance_state_t *state, void *user_data); | ||
106 | |||
107 | /* ----------------------------------------------------------------------------------------------------------------------------- */ | ||
108 | |||
109 | // This is a completely modified layout that stikes a balance between muscle memory for keys, where I was coming from a standard | ||
110 | // Qwerty keyboard, and efficiency gained by using layers. I've switched tab and esc because it's more natural to me this way, and | ||
111 | // added layer switch on hold functionality for each key. Enter has moved to the key beside LOWER, to allow usage while still having | ||
112 | // the right hand on the mouse. | ||
113 | |||
114 | // Lower incorporates a numpad on the right side, and all of the symbols included on the left. There is logic for the symbols needed for | ||
115 | // calculators and math are located around the numpad, and coding symbols are placed in easy to remember spots. | ||
116 | |||
117 | // CAPS has moved to the Fn layer, and a few additional shortcut modifiers like CTRL_ALT_UP and DOWN for adding additional cursors in VSCode. | ||
118 | // Play/Pause has a prime spot on the base layer, and the Fn version skips to next track | ||
119 | |||
120 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
121 | /* MIT Layout (QWERTY) | ||
122 | * | ||
123 | * ,------------------------------------------------------------------------. | ||
124 | * |FN,Esc| q | w | e | r | t | y | u | i | o | p |Bsp | | ||
125 | * |------------------------------------------------------------------------| | ||
126 | |CSW,Tab| a | s | d | f | g | h | j | k | l | ; |Ctl,'| | ||
127 | * |------------------------------------------------------------------------| | ||
128 | * |Shift |Win,z| x | c | v | b | n | m | , | . | / |Sft,\| | ||
129 | * |------------------------------------------------------------------------| | ||
130 | * | | | |Ctl,Ent|LOWER| Space |RAISE|Alt,Play| | | | | ||
131 | * `------------------------------------------------------------------------' | ||
132 | */ | ||
133 | [_QWERTY] = LAYOUT_planck_grid( /* QWERTY */ | ||
134 | LTESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, | ||
135 | MTTAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, MTRCTLQUO, | ||
136 | KC_LSFT, MTLGUI_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, MTRSFTBSLS, | ||
137 | KC_NO, KC_NO, KC_NO, MTENTER, TD(UNDS_LOWER), KC_SPC, KC_SPC, MO(3), MTLALT_PL, KC_NO, KC_NO, KC_NO | ||
138 | ), | ||
139 | |||
140 | /* MIT Layout (COLEMAK_VCP) | ||
141 | * | ||
142 | * ,------------------------------------------------------------------------. | ||
143 | * |FN,ESC| q | w | f | d | b | j | l | u | y | ; | Bsp | | ||
144 | * |------------------------------------------------------------------------| | ||
145 | |CSW,Tab| a | r | s | t | g | m | n | e | i | o |Ctl,'| | ||
146 | * |------------------------------------------------------------------------| | ||
147 | * |Shift |Win,z| x | v | c | p | k | h | , | . | / |Sft,\| | ||
148 | * |------------------------------------------------------------------------| | ||
149 | * | | | |Ctl,Ent|LWR,_| Space |RAISE|Alt,Play| | | | | ||
150 | * `------------------------------------------------------------------------' | ||
151 | */ | ||
152 | [_COLEMAK_VCP] = LAYOUT_planck_grid( /* COLEMAK_VCP */ | ||
153 | LTESC, KC_Q, KC_W, KC_F, KC_D, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, | ||
154 | MTTAB, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, MTRCTLQUO, | ||
155 | KC_LSFT, MTLGUI_Z, KC_X, KC_V, KC_C, KC_P, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, MTRSFTBSLS, | ||
156 | KC_NO, KC_NO, KC_NO, MTENTER, TD(UNDS_LOWER), KC_SPC, KC_SPC, MO(3), MTLALT_PL, KC_NO, KC_NO, KC_NO | ||
157 | ), | ||
158 | |||
159 | /* MIT Layout (RAISE) | ||
160 | * | ||
161 | * ,----------------------------------------------------------------------------. | ||
162 | * | ~ | ! | | | | | | Cut | Undo| Redo|P2TXT| Bsp | | ||
163 | * |----------------------------------------------------------------------------| | ||
164 | * | |Menu | | | | |ARROW |SELWORD|Copy|Paste|WinPst| " | | ||
165 | * |----------------------------------------------------------------------------| | ||
166 | * | |Vol+ |Vol- | Mute| | |Braces|Braces2| < | > | ? | ! | | ||
167 | * |----------------------------------------------------------------------------| | ||
168 | * | | | | |Adjust| | | | | | | | ||
169 | * `----------------------------------------------------------------------------' | ||
170 | */ | ||
171 | [_RAISE] = LAYOUT_planck_grid( /* RAISE */ | ||
172 | KC_TILD, KC_EXLM, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_CUT, KC_UNDO, KC_REDO, KC_PTXT, KC_BSPC, | ||
173 | KC_TRNS, KC_APP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ARROW, SELWORD, KC_COPY, KC_PASTE, KC_WINPASTE, KC_DQUO, | ||
174 | KC_TRNS, KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, BRACES, BRACES2, KC_LABK, KC_RABK, KC_QUES, KC_EXLM, | ||
175 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(6), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO | ||
176 | ), | ||
177 | |||
178 | /* MIT Layout (LOWER) | ||
179 | * XZ | ||
180 | * ,-----------------------------------------------------------------------. | ||
181 | * | ` | ! | # | $ | < | > | : | 7 | 8 | 9 | = | Bsp | | ||
182 | * |-----------------------------------------------------------------------| | ||
183 | * | ' | _ | ^ | % | ( | ) | M | 4 | 5 | 6 | - | + | | ||
184 | * |-----------------------------------------------------------------------| | ||
185 | * |Shift| | | & | " | { | } | @ | 1 | 2 | 3 | / | * | | ||
186 | * |-----------------------------------------------------------------------| | ||
187 | * | | | | | | |MO(6),0| . | | | | | ||
188 | * `-----------------------------------------------------------------------' | ||
189 | */ | ||
190 | [_LOWER] = LAYOUT_planck_grid( /* LOWER */ | ||
191 | KC_GRV, KC_EXLM, KC_HASH, KC_DLR, KC_LABK, KC_RABK, KC_COLN, KC_P7, KC_P8, KC_P9, KC_EQL, KC_BSPC, | ||
192 | KC_QUOT, KC_UNDS, KC_CIRC, KC_PERC, KC_LPRN, KC_RPRN, KC_M, KC_P4, KC_P5, KC_P6, KC_PMNS, KC_PPLS, | ||
193 | KC_TRNS, KC_PIPE, KC_AMPR, KC_DQUO, KC_LCBR, KC_RCBR, KC_AT, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_PAST, | ||
194 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_PDOT, KC_NO, KC_NO, KC_NO | ||
195 | ), | ||
196 | |||
197 | /* MIT Layout (GAMING) | ||
198 | *. | ||
199 | * ,-----------------------------------------------------------------------. | ||
200 | * |ESC,`| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 |EXIT GAMING| | ||
201 | * |-----------------------------------------------------------------------| | ||
202 | * | TAB | Q | W | E | R | T | I | 4 | 5 | 6 | - | + | | ||
203 | * |-----------------------------------------------------------------------| | ||
204 | * |Shift| A | S | D | F | G | K | 1 | 2 | 3 | / | * | | ||
205 | * |-----------------------------------------------------------------------| | ||
206 | * | | | | Ctl | Alt | SPACE | 0 | . | | | | | ||
207 | * `-----------------------------------------------------------------------' | ||
208 | */ | ||
209 | [_GAMING] = LAYOUT_planck_grid( /* GAMING */ | ||
210 | KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_P8, KC_9, KC_0, EXT_GAMING, | ||
211 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_I, KC_P4, KC_P5, KC_P6, KC_PMNS, KC_PPLS, | ||
212 | KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_K, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_PAST, | ||
213 | KC_NO, KC_NO, KC_NO, KC_LCTL, KC_LALT, KC_SPC, KC_SPC, KC_P0, KC_PDOT, KC_NO, KC_NO, KC_NO | ||
214 | ), | ||
215 | |||
216 | /* MIT Layout (FN) | ||
217 | * | ||
218 | * ,----------------------------------------------------------------------------. | ||
219 | * | |Ctl,F9 |Sft,F10|Alt,F11| F12 |MyComp|Calc |home | up | end |PrtScr| Del | | ||
220 | * |-----------------------------------------------------------------------------| | ||
221 | * | | F5 | F6 | F7 | F8 |DeskL |DeskR |left | down |right|ScrLck| CAPS| | ||
222 | * |-----------------------------------------------------------------------------| | ||
223 | * | | F1 | F2 | F3 | F4 |ALT_TAB|MicM |pgup |LCA_dn| pgdn|Pse/Brk| Ins| | ||
224 | * |-----------------------------------------------------------------------------| | ||
225 | * | | | | | | | |Alt,MNext| | | | | ||
226 | * `-----------------------------------------------------------------------------' | ||
227 | */ | ||
228 | [_FN] = LAYOUT_planck_grid( /* FUNCTION */ | ||
229 | KC_TRNS, MTLCTL_F9, MTLSFT_F10, MTLALT_F11, KC_F12, KC_MYCM, KC_CALC, KC_HOME, KC_UP, KC_END, KC_PSCR, KC_DEL, | ||
230 | KC_TRNS, KC_F5, KC_F6, KC_F7, KC_F8, DESKTL, DESKTR, KC_LEFT, KC_DOWN, KC_RGHT, KC_SLCK, KC_CAPS, | ||
231 | KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, ALT_TAB, MICMUTE, KC_PGUP, LCA(KC_DOWN), KC_PGDN, KC_PAUSE, KC_INS, | ||
232 | KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MTLALT_NXT, KC_NO, KC_NO, KC_NO | ||
233 | ), | ||
234 | |||
235 | /* MIT Layout (ADJUST) | ||
236 | * | ||
237 | * ,-----------------------------------------------------------------------------. | ||
238 | * |RGBtog|Ms3 | Ms2 |MsUp | Ms1 | Hue+| Hue- | Sat+| Sat- |Brt+ |Brt- | RESET| | ||
239 | * |-----------------------------------------------------------------------------| | ||
240 | * |RGBMod| MWL | MsL |MDn |MsR |GAMING| |AU_ON|AU_OFF|MU_ON|MU_OF| DEBUG| | ||
241 | * |-----------------------------------------------------------------------------| | ||
242 | * | |MWLft|MWUp |NWDn |NWRght|QWERTY|CMK_VCP|MI_ON|MI_OF | | |MU_Mod| | ||
243 | * |-----------------------------------------------------------------------------| | ||
244 | * | | | |SLEEP| | | | | | | | | ||
245 | * `-----------------------------------------------------------------------------' | ||
246 | */ | ||
247 | [_ADJUST] = LAYOUT_planck_grid( /* ADJUST LAYER */ | ||
248 | RGB_TOG, KC_BTN3, KC_BTN2, KC_MS_U, KC_BTN1, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, RESET, | ||
249 | RGB_MOD, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, GAMING, KC_NO, AU_ON, AU_OFF, MU_ON, MU_OFF, DEBUG, | ||
250 | KC_TRNS, KC_WH_L, KC_WH_U, KC_WH_D, KC_WH_R, QWERTY, COLEMAK_VCP, MI_ON, MI_OFF, KC_TRNS, KC_TRNS, MU_MOD, | ||
251 | KC_NO, KC_NO, KC_NO, KC_SLEP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO | ||
252 | ) | ||
253 | }; | ||
254 | |||
255 | #ifdef AUDIO_ENABLE | ||
256 | float layerswitch_song[][2] = SONG(PLANCK_SOUND); | ||
257 | float tone_startup[][2] = SONG(STARTUP_SOUND); | ||
258 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
259 | float tone_COLEMAK_VCP[][2] = SONG(COLEMAK_SOUND); | ||
260 | float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); | ||
261 | float tone_goodbye[][2] = SONG(GOODBYE_SOUND); | ||
262 | |||
263 | #endif | ||
264 | |||
265 | bool is_alt_tab_active = false; | ||
266 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
267 | |||
268 | static bool is_this_layer_on = false; | ||
269 | if (layer_state_cmp(state, 4) != is_this_layer_on) { | ||
270 | is_this_layer_on = layer_state_cmp(state, 4); | ||
271 | if (is_this_layer_on) { | ||
272 | PLAY_SONG(layerswitch_song); | ||
273 | } | ||
274 | else { | ||
275 | stop_all_notes(); | ||
276 | } | ||
277 | } | ||
278 | if (is_alt_tab_active) { | ||
279 | unregister_code(KC_LALT); | ||
280 | is_alt_tab_active = false; | ||
281 | } | ||
282 | return state; | ||
283 | |||
284 | switch (get_highest_layer(state)) { | ||
285 | case _ADJUST: | ||
286 | rgblight_setrgb (0xFF, 0x00, 0x00); | ||
287 | break; | ||
288 | case _LOWER: | ||
289 | rgblight_setrgb (0x00, 0x00, 0xFF); | ||
290 | break; | ||
291 | case _NUMPAD: | ||
292 | rgblight_setrgb (0x00, 0x00, 0xFF); | ||
293 | break; | ||
294 | case _RAISE: | ||
295 | rgblight_setrgb (0x7A, 0x00, 0xFF); | ||
296 | break; | ||
297 | case _FN: | ||
298 | rgblight_setrgb (0x00, 0xFF, 0x00); | ||
299 | break; | ||
300 | default: // for any other layers, or the default layer | ||
301 | rgblight_setrgb (0xFF, 0xFF, 0xFF); | ||
302 | break; | ||
303 | } | ||
304 | return state; | ||
305 | } | ||
306 | |||
307 | // void dance_media (qk_tap_dance_state_t *state, void *user_data) | ||
308 | // if (state->count == 1) { | ||
309 | // tap_code(KC_MPLY); | ||
310 | // } else if (state->count == 2) { | ||
311 | // tap_code (KC_MNXT); | ||
312 | // } else if (state->count == 3) { | ||
313 | // tap_code(KC_MPRV); | ||
314 | // } else { | ||
315 | // reset_tap_dance (state); | ||
316 | // } | ||
317 | // } | ||
318 | |||
319 | // qk_tap_dance_action_t tap_dance_actions[] = { | ||
320 | // [0] = ACTION_TAP_DANCE_FN (dance_media), | ||
321 | // }; | ||
322 | |||
323 | // Determine the current tap dance state | ||
324 | td_state_t cur_dance(qk_tap_dance_state_t *state) { | ||
325 | if (state->interrupted) return TD_SINGLE_HOLD; | ||
326 | if (state->count == 1) { | ||
327 | if (!state->pressed) return TD_SINGLE_TAP; | ||
328 | else return TD_SINGLE_HOLD; | ||
329 | } else if (state->count == 2) return TD_DOUBLE_TAP; | ||
330 | else return TD_UNKNOWN; | ||
331 | } | ||
332 | |||
333 | // Initialize tap structure associated with example tap dance key | ||
334 | static td_tap_t usl_tap_state = { | ||
335 | .is_press_action = true, | ||
336 | .state = TD_NONE | ||
337 | }; | ||
338 | |||
339 | // Functions that control what our tap dance key does | ||
340 | void usl_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
341 | usl_tap_state.state = cur_dance(state); | ||
342 | switch (usl_tap_state.state) { | ||
343 | case TD_SINGLE_TAP: | ||
344 | tap_code16(KC_UNDS); | ||
345 | break; | ||
346 | case TD_SINGLE_HOLD: | ||
347 | layer_on(_LOWER); | ||
348 | // update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
349 | break; | ||
350 | case TD_DOUBLE_TAP: | ||
351 | // Check to see if the layer is already set | ||
352 | if (layer_state_is(_LOWER)) { | ||
353 | // If already set, then switch it off | ||
354 | layer_off(_LOWER); | ||
355 | #ifdef AUDIO_ENABLE | ||
356 | PLAY_SONG(tone_goodbye); | ||
357 | #endif | ||
358 | } else { | ||
359 | // If not already set, then switch the layer on | ||
360 | layer_on(_LOWER); | ||
361 | #ifdef AUDIO_ENABLE | ||
362 | PLAY_SONG(layerswitch_song); | ||
363 | #endif | ||
364 | } | ||
365 | break; | ||
366 | default: | ||
367 | break; | ||
368 | } | ||
369 | } | ||
370 | |||
371 | void usl_reset(qk_tap_dance_state_t *state, void *user_data) { | ||
372 | // If the key was held down and now is released then switch off the layer | ||
373 | if (usl_tap_state.state == TD_SINGLE_HOLD) { | ||
374 | layer_off(_LOWER); | ||
375 | // update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
376 | } | ||
377 | usl_tap_state.state = TD_NONE; | ||
378 | } | ||
379 | |||
380 | // Associate our tap dance key with its functionality | ||
381 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
382 | [UNDS_LOWER] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, usl_finished, usl_reset, 175) | ||
383 | }; | ||
384 | |||
385 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
386 | if (!process_select_word(keycode, record, SELWORD)) { return false; } | ||
387 | if (!process_caps_word(keycode, record)) { return false; } | ||
388 | |||
389 | const uint8_t mods = get_mods(); | ||
390 | const uint8_t oneshot_mods = get_oneshot_mods(); | ||
391 | |||
392 | switch (keycode) { | ||
393 | case QWERTY: | ||
394 | if (record->event.pressed) { | ||
395 | set_single_persistent_default_layer(_QWERTY); | ||
396 | } | ||
397 | return false; | ||
398 | break; | ||
399 | case KC_CAPS: | ||
400 | if (record->event.pressed) { | ||
401 | #ifdef AUDIO_ENABLE | ||
402 | PLAY_SONG(tone_qwerty); | ||
403 | #endif | ||
404 | register_code(KC_CAPS); | ||
405 | } | ||
406 | return false; | ||
407 | break; | ||
408 | case GAMING: | ||
409 | if (record->event.pressed) { | ||
410 | layer_off(_RAISE); | ||
411 | layer_off(_LOWER); | ||
412 | layer_off(_ADJUST); | ||
413 | layer_on(_GAMING); | ||
414 | #ifdef AUDIO_ENABLE | ||
415 | PLAY_SONG(layerswitch_song); | ||
416 | #endif | ||
417 | } | ||
418 | return false; | ||
419 | break; | ||
420 | case EXT_GAMING: | ||
421 | if (record->event.pressed) { | ||
422 | layer_off(_GAMING); | ||
423 | #ifdef AUDIO_ENABLE | ||
424 | PLAY_SONG(tone_goodbye); | ||
425 | #endif | ||
426 | } | ||
427 | return false; | ||
428 | break; | ||
429 | case COLEMAK_VCP: | ||
430 | if (record->event.pressed) { | ||
431 | set_single_persistent_default_layer(_COLEMAK_VCP); | ||
432 | } | ||
433 | return false; | ||
434 | break; | ||
435 | case BRACES: // Types (), or {}, and puts cursor between braces. | ||
436 | if (record->event.pressed) { | ||
437 | clear_mods(); // Temporarily disable mods. | ||
438 | clear_oneshot_mods(); | ||
439 | if ((mods | oneshot_mods) & MOD_MASK_SHIFT) { | ||
440 | SEND_STRING("{}"); | ||
441 | } else { | ||
442 | SEND_STRING("<>"); | ||
443 | } | ||
444 | tap_code(KC_LEFT); // Move cursor between braces. | ||
445 | set_mods(mods); // Restore mods. | ||
446 | } | ||
447 | return false; | ||
448 | case BRACES2: // Types [], or <>, and puts cursor between braces. | ||
449 | if (record->event.pressed) { | ||
450 | clear_mods(); // Temporarily disable mods. | ||
451 | clear_oneshot_mods(); | ||
452 | if ((mods | oneshot_mods) & MOD_MASK_SHIFT) { | ||
453 | SEND_STRING("()"); | ||
454 | } else { | ||
455 | SEND_STRING("[]"); | ||
456 | } | ||
457 | tap_code(KC_LEFT); // Move cursor between braces. | ||
458 | set_mods(mods); // Restore mods. | ||
459 | } | ||
460 | return false; | ||
461 | case ARROW: // Arrow macro, types -> or =>. | ||
462 | if (record->event.pressed) { | ||
463 | if ((mods | oneshot_mods) & MOD_MASK_SHIFT) { // Is shift held? | ||
464 | del_mods(MOD_MASK_SHIFT); // Temporarily delete shift. | ||
465 | del_oneshot_mods(MOD_MASK_SHIFT); | ||
466 | SEND_STRING("->"); | ||
467 | set_mods(mods); // Restore mods. | ||
468 | } else { | ||
469 | SEND_STRING("=>"); | ||
470 | } | ||
471 | } | ||
472 | return false; | ||
473 | case ALT_TAB: // super alt tab macro | ||
474 | if (record->event.pressed) { | ||
475 | if (!is_alt_tab_active) { | ||
476 | is_alt_tab_active = true; | ||
477 | register_code(KC_LALT); | ||
478 | } | ||
479 | register_code(KC_TAB); | ||
480 | } else { | ||
481 | unregister_code(KC_TAB); | ||
482 | } | ||
483 | return false; | ||
484 | break; | ||
485 | } | ||
486 | return true; | ||
487 | } | ||
488 | |||
489 | |||
490 | enum combo_events { | ||
491 | EM_EMAIL, | ||
492 | EM_WORK_EMAIL, | ||
493 | HTML_P, | ||
494 | HTML_TITLE, | ||
495 | HTML_DIV, | ||
496 | HTML_HTML, | ||
497 | HTML_HEAD, | ||
498 | HTML_BODY, | ||
499 | HTML_FOOTER, | ||
500 | HTML_A_HREF, | ||
501 | HTML_IMG, | ||
502 | CSS_STYLE, | ||
503 | HTML_GENERIC_TAG, | ||
504 | CTLRGHT, | ||
505 | CTLLEFT, | ||
506 | COMBO_LENGTH | ||
507 | }; | ||
508 | uint16_t COMBO_LEN = COMBO_LENGTH; // remove the COMBO_COUNT define and use this instead! | ||
509 | |||
510 | const uint16_t PROGMEM email_combo[] = {KC_E, KC_M, COMBO_END}; | ||
511 | const uint16_t PROGMEM email_work_combo[] = {KC_E, KC_K, COMBO_END}; | ||
512 | const uint16_t PROGMEM html_p_combo[] = {KC_P, KC_DOT, COMBO_END}; | ||
513 | const uint16_t PROGMEM html_title_combo[] = {KC_T, KC_DOT, COMBO_END}; | ||
514 | const uint16_t PROGMEM html_div_combo[] = {KC_D, KC_DOT, COMBO_END}; | ||
515 | const uint16_t PROGMEM html_html_combo[] = {KC_Q, KC_DOT, COMBO_END}; | ||
516 | const uint16_t PROGMEM html_head_combo[] = {KC_W, KC_DOT, COMBO_END}; | ||
517 | const uint16_t PROGMEM html_body_combo[] = {KC_R, KC_DOT, COMBO_END}; | ||
518 | const uint16_t PROGMEM html_footer_combo[] = {KC_X, KC_DOT, COMBO_END}; | ||
519 | const uint16_t PROGMEM html_a_href_combo[] = {KC_A, KC_DOT, COMBO_END}; | ||
520 | const uint16_t PROGMEM html_img_combo[] = {KC_F, KC_DOT, COMBO_END}; | ||
521 | const uint16_t PROGMEM css_style_combo[] = {KC_S, KC_DOT, COMBO_END}; | ||
522 | const uint16_t PROGMEM html_generic_tag_combo[] = {KC_G, KC_DOT, COMBO_END}; | ||
523 | const uint16_t PROGMEM ctrrght_combo[] = {KC_RGHT, KC_DOWN, COMBO_END}; | ||
524 | const uint16_t PROGMEM ctrleft_combo[] = {KC_LEFT, KC_DOWN, COMBO_END}; | ||
525 | // const uint8_t combo_mods = get_mods(); | ||
526 | // const uint8_t combo_oneshot_mods = get_oneshot_mods(); | ||
527 | |||
528 | combo_t key_combos[] = { | ||
529 | [EM_EMAIL] = COMBO_ACTION(email_combo), | ||
530 | [EM_WORK_EMAIL] = COMBO_ACTION(email_work_combo), | ||
531 | [HTML_P] = COMBO_ACTION(html_p_combo), | ||
532 | [HTML_TITLE] = COMBO_ACTION(html_title_combo), | ||
533 | [HTML_DIV] = COMBO_ACTION(html_div_combo), | ||
534 | [HTML_HTML] = COMBO_ACTION(html_html_combo), | ||
535 | [HTML_HEAD] = COMBO_ACTION(html_head_combo), | ||
536 | [HTML_BODY] = COMBO_ACTION(html_body_combo), | ||
537 | [HTML_FOOTER] = COMBO_ACTION(html_footer_combo), | ||
538 | [HTML_A_HREF] = COMBO_ACTION(html_a_href_combo), | ||
539 | [HTML_IMG] = COMBO_ACTION(html_img_combo), | ||
540 | [CSS_STYLE] = COMBO_ACTION(css_style_combo), | ||
541 | [HTML_GENERIC_TAG] = COMBO_ACTION(html_generic_tag_combo), | ||
542 | [CTLRGHT] = COMBO_ACTION(ctrrght_combo), | ||
543 | [CTLLEFT] = COMBO_ACTION(ctrleft_combo), | ||
544 | }; | ||
545 | /* COMBO_ACTION(x) is same as COMBO(x, KC_NO) */ | ||
546 | |||
547 | void process_combo_event(uint16_t combo_index, bool pressed) { | ||
548 | switch(combo_index) { | ||
549 | case EM_EMAIL: | ||
550 | if (pressed) { | ||
551 | SEND_STRING("aricbouwers@outlook.com"); | ||
552 | } | ||
553 | break; | ||
554 | case EM_WORK_EMAIL: | ||
555 | if (pressed) { | ||
556 | SEND_STRING("acrossonbouwers@rjc.ca"); | ||
557 | } | ||
558 | break; | ||
559 | case HTML_DIV: | ||
560 | if (pressed) { | ||
561 | SEND_STRING("<div></div>"); | ||
562 | for (int i = 0; i < 6; i++) { | ||
563 | tap_code16(KC_LEFT); | ||
564 | } | ||
565 | } | ||
566 | break; | ||
567 | case HTML_P: | ||
568 | if (pressed) { | ||
569 | SEND_STRING("<p></p>"); | ||
570 | for (int i = 0; i < 4; i++) { | ||
571 | tap_code16(KC_LEFT); | ||
572 | } | ||
573 | } | ||
574 | break; | ||
575 | case HTML_TITLE: | ||
576 | if (pressed) { | ||
577 | SEND_STRING("<title></title>"); | ||
578 | for (int i = 0; i < 8; i++) { | ||
579 | tap_code16(KC_LEFT); | ||
580 | } | ||
581 | } | ||
582 | break; | ||
583 | case CSS_STYLE: | ||
584 | if (pressed) { | ||
585 | SEND_STRING("<style></style>"); | ||
586 | for (int i = 0; i < 8; i++) { | ||
587 | tap_code16(KC_LEFT); | ||
588 | } | ||
589 | } | ||
590 | break; | ||
591 | case HTML_HTML: | ||
592 | if (pressed) { | ||
593 | SEND_STRING("<html lang=\"en\"></html>"); | ||
594 | for (int i = 0; i < 7; i++) { | ||
595 | tap_code16(KC_LEFT); | ||
596 | } | ||
597 | } | ||
598 | break; | ||
599 | case HTML_HEAD: | ||
600 | if (pressed) { | ||
601 | SEND_STRING("<head></head>"); | ||
602 | for (int i = 0; i < 7; i++) { | ||
603 | tap_code16(KC_LEFT); | ||
604 | } | ||
605 | } | ||
606 | break; | ||
607 | case HTML_BODY: | ||
608 | if (pressed) { | ||
609 | SEND_STRING("<body></body>"); | ||
610 | for (int i = 0; i < 7; i++) { | ||
611 | tap_code16(KC_LEFT); | ||
612 | } | ||
613 | } | ||
614 | break; | ||
615 | case HTML_FOOTER: | ||
616 | if (pressed) { | ||
617 | SEND_STRING("<footer></footer>"); | ||
618 | for (int i = 0; i < 9; i++) { | ||
619 | tap_code16(KC_LEFT); | ||
620 | } | ||
621 | } | ||
622 | break; | ||
623 | case HTML_A_HREF: | ||
624 | if (pressed) { | ||
625 | SEND_STRING("<a href=\"link_goes_here\">name_of_link_goes_here</a>"); | ||
626 | tap_code16(KC_HOME); | ||
627 | for (int i = 0; i < 10; i++) { | ||
628 | tap_code16(KC_RGHT); | ||
629 | } | ||
630 | } | ||
631 | break; | ||
632 | case HTML_IMG: | ||
633 | if (pressed) { | ||
634 | SEND_STRING("<img src=\"image_source_or_link_goes_here\" alt=\"name_if_cant_load\" width=\"num_pixels\" height=\"num_pixels\">"); | ||
635 | tap_code16(KC_HOME); | ||
636 | for (int i = 0; i < 11; i++) { | ||
637 | tap_code16(KC_RGHT); | ||
638 | } | ||
639 | } | ||
640 | break; | ||
641 | case HTML_GENERIC_TAG: | ||
642 | if (pressed) { | ||
643 | SEND_STRING("<TAG></TAG>"); | ||
644 | tap_code16(KC_ESC); | ||
645 | for (int i = 0; i < 9; i++) { | ||
646 | tap_code16(KC_LEFT); | ||
647 | } | ||
648 | tap_code16(LCTL(KC_D)); | ||
649 | tap_code16(LCTL(KC_D)); | ||
650 | tap_code16(KC_BSPC); | ||
651 | } | ||
652 | break; | ||
653 | case CTLLEFT: | ||
654 | if (pressed) { | ||
655 | tap_code16(C(KC_LEFT)); | ||
656 | } | ||
657 | break; | ||
658 | case CTLRGHT: | ||
659 | if (pressed) { | ||
660 | tap_code16(C(KC_RGHT)); | ||
661 | } | ||
662 | break; | ||
663 | } | ||
664 | } \ No newline at end of file | ||
diff --git a/keyboards/planck/keymaps/ariccb/readme.md b/keyboards/planck/keymaps/ariccb/readme.md new file mode 100644 index 000000000..500373ea1 --- /dev/null +++ b/keyboards/planck/keymaps/ariccb/readme.md | |||
@@ -0,0 +1,78 @@ | |||
1 | ``` | ||
2 | QWERTY LAYER | ||
3 | * ,------------------------------------------------------------------------. | ||
4 | * |FN,Esc| q | w | e | r | t | y | u | i | o | p |Bsp | | ||
5 | * |------------------------------------------------------------------------| | ||
6 | |CSW,Tab| a | s | d | f | g | h | j | k | l | ; |Ctl,'| | ||
7 | * |------------------------------------------------------------------------| | ||
8 | * |Shift |Win,z| x | c | v | b | n | m | , | . | / |Sft,\| | ||
9 | * |------------------------------------------------------------------------| | ||
10 | * | | | |Ctl,Ent|LOWER| Space |RAISE|Alt,Play| | | | | ||
11 | * `------------------------------------------------------------------------' | ||
12 | |||
13 | COLEMAK_VCP(default) LAYER | ||
14 | * ,------------------------------------------------------------------------. | ||
15 | * |FN,ESC| q | w | f | d | b | j | l | u | y | ; | Bsp | | ||
16 | * |------------------------------------------------------------------------| | ||
17 | |CSW,Tab| a | r | s | t | g | m | n | e | i | o |Ctl,'| | ||
18 | * |------------------------------------------------------------------------| | ||
19 | * |Shift |Win,z| x | v | c | p | k | h | , | . | / |Sft,\| | ||
20 | * |------------------------------------------------------------------------| | ||
21 | * | | | |Ctl,Ent|LWR,_| Space |RAISE|Alt,Play| | | | | ||
22 | * `------------------------------------------------------------------------' | ||
23 | |||
24 | LOWER LAYER | ||
25 | * ,-----------------------------------------------------------------------. | ||
26 | * | ` | ! | # | $ | < | > | : | 7 | 8 | 9 | = | Bsp | | ||
27 | * |-----------------------------------------------------------------------| | ||
28 | * | ' | _ | ^ | % | ( | ) | M | 4 | 5 | 6 | - | + | | ||
29 | * |-----------------------------------------------------------------------| | ||
30 | * |Shift| | | & | " | { | } | @ | 1 | 2 | 3 | / | * | | ||
31 | * |-----------------------------------------------------------------------| | ||
32 | * | | | | | | |MO(6),0| . | | | | | ||
33 | * `-----------------------------------------------------------------------' | ||
34 | |||
35 | RAISED LAYER | ||
36 | * ,-----------------------------------------------------------------------------. | ||
37 | * | ~ | ! | | | | | | Cut | Undo| Redo|P2TXT| Bsp | | ||
38 | * |-----------------------------------------------------------------------------| | ||
39 | * | |Menu | | | | | ARROW |SELWORD|Copy|Paste|WinPst| " | | ||
40 | * |-----------------------------------------------------------------------------| | ||
41 | * | |Vol+ |Vol- | Mute| | | Braces|Braces2| < | > | ? | ! | | ||
42 | * |-----------------------------------------------------------------------------| | ||
43 | * | | | | |Adjust| | | | | | | | ||
44 | * `-----------------------------------------------------------------------------' | ||
45 | |||
46 | FN LAYER | ||
47 | * ,----------------------------------------------------------------------------. | ||
48 | * | |Ctl,F9 |Sft,F10|Alt,F11| F12 |MyComp|Calc |home | up | end |PrtScr| Del | | ||
49 | * |-----------------------------------------------------------------------------| | ||
50 | * | | F5 | F6 | F7 | F8 |DeskL |DeskR |left | down |right|ScrLck| CAPS| | ||
51 | * |-----------------------------------------------------------------------------| | ||
52 | * | | F1 | F2 | F3 | F4 |ALT_TAB| MicM|pgup |LCA_dn| pgdn|Pse/Brk| Ins| | ||
53 | * |-----------------------------------------------------------------------------| | ||
54 | * | | | | | | | |Alt,MNext| | | | | ||
55 | * `-----------------------------------------------------------------------------' | ||
56 | |||
57 | GAMING LAYER | ||
58 | * ,-----------------------------------------------------------------------. | ||
59 | * |ESC,`| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 |EXIT GAMING| | ||
60 | * |-----------------------------------------------------------------------| | ||
61 | * | TAB | Q | W | E | R | T | I | 4 | 5 | 6 | - | + | | ||
62 | * |-----------------------------------------------------------------------| | ||
63 | * |Shift| A | S | D | F | G | K | 1 | 2 | 3 | / | * | | ||
64 | * |-----------------------------------------------------------------------| | ||
65 | * | | | | Ctl | Alt | SPACE | 0 | . | | | | | ||
66 | * `-----------------------------------------------------------------------' | ||
67 | |||
68 | ADJUST LAYER | ||
69 | * ,-----------------------------------------------------------------------------. | ||
70 | * |RGBtog|Ms3 | Ms2 |MsUp | Ms1 | Hue+| Hue- | Sat+| Sat- |Brt+ |Brt- | RESET| | ||
71 | * |-----------------------------------------------------------------------------| | ||
72 | * |RGBMod| MWL | MsL |MDn |MsR |GAMING| |AU_ON|AU_OFF|MU_ON|MU_OF| DEBUG| | ||
73 | * |-----------------------------------------------------------------------------| | ||
74 | * | |MWLft|MWUp |NWDn |NWRght|QWERTY|CMK_VCP|MI_ON|MI_OF | | |MU_Mod| | ||
75 | * |-----------------------------------------------------------------------------| | ||
76 | * | | | |SLEEP| | | | | | | | | ||
77 | * `-----------------------------------------------------------------------------' | ||
78 | ``` \ No newline at end of file | ||
diff --git a/keyboards/planck/keymaps/ariccb/rules.mk b/keyboards/planck/keymaps/ariccb/rules.mk new file mode 100644 index 000000000..cc92ab40f --- /dev/null +++ b/keyboards/planck/keymaps/ariccb/rules.mk | |||
@@ -0,0 +1,10 @@ | |||
1 | BOOTMAGIC_ENABLE = no | ||
2 | CONSOLE_ENABLE = no | ||
3 | BACKLIGHT_ENABLE = yes | ||
4 | MIDI_ENABLE = yes | ||
5 | TAP_DANCE_ENABLE = yes | ||
6 | DIP_SWITCH_ENABLE = no | ||
7 | COMBO_ENABLE = yes | ||
8 | |||
9 | SRC += features/select_word.c | ||
10 | SRC += features/caps_word.c | ||