summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2022-02-10 01:04:13 +0000
committerQMK Bot <hello@qmk.fm>2022-02-10 01:04:13 +0000
commit6339b6dab7dba90efed1effcd3f3b910d7214c85 (patch)
tree21c2efb3eb994eb42bf1fa5f4ede725f98a2c881
parentae6f471f1c02cbd107549cfdfa84bb490571c321 (diff)
parent9d74c952152a4689e48c37f82a211c96a951c983 (diff)
Merge remote-tracking branch 'origin/master' into develop
-rw-r--r--keyboards/planck/keymaps/ariccb/.vscode/settings.json5
-rw-r--r--keyboards/planck/keymaps/ariccb/config.h56
-rw-r--r--keyboards/planck/keymaps/ariccb/features/caps_word.c122
-rw-r--r--keyboards/planck/keymaps/ariccb/features/caps_word.h101
-rw-r--r--keyboards/planck/keymaps/ariccb/features/select_word.c110
-rw-r--r--keyboards/planck/keymaps/ariccb/features/select_word.h37
-rw-r--r--keyboards/planck/keymaps/ariccb/keymap.c664
-rw-r--r--keyboards/planck/keymaps/ariccb/readme.md78
-rw-r--r--keyboards/planck/keymaps/ariccb/rules.mk10
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 0000000000..31e9436a77
--- /dev/null
+++ b/keyboards/planck/keymaps/ariccb/.vscode/settings.json
@@ -0,0 +1,5 @@
+{
+ "files.associations": {
+ "select_word.h": "c"
+ }
+} \ 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 0000000000..322aa9277f
--- /dev/null
+++ b/keyboards/planck/keymaps/ariccb/config.h
@@ -0,0 +1,56 @@
+/* Copyright 2015-2021 Jack Humbert
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#ifdef AUDIO_ENABLE
+# define STARTUP_SONG SONG(PLANCK_SOUND)
+// #define STARTUP_SONG SONG(NO_SOUND)
+
+# define DEFAULT_LAYER_SONGS \
+ { SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND) }
+#endif
+/*
+ * MIDI options
+ */
+
+/* enable basic MIDI features:
+ - MIDI notes can be sent when in Music mode is on
+*/
+#define MIDI_BASIC
+/* enable advanced MIDI features:
+ - MIDI notes can be added to the keymap
+ - Octave shift and transpose
+ - Virtual sustain, portamento, and modulation wheel
+ - etc.
+*/
+//#define MIDI_ADVANCED
+
+#define TAPPING_TERM 150
+#define IGNORE_MOD_TAP_INTERRUPT
+// #define IGNORE_MOD_TAP_INTERRUPT
+// #define HOLD_ON_OTHER_KEY_PRESS
+
+#define COMBO_TERM 20
+
+
+
+#define MOUSEKEY_INTERVAL 16 //Time between cursor movements in milliseconds.
+ //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
+#define MOUSEKEY_MAX_SPEED 8 //Maximum cursor speed at which acceleration stops
+#define MOUSEKEY_TIME_TO_MAX 50 //Time until maximum scroll speed is reached
+#define MOUSEKEY_DELAY 100 //Delay between pressing a movement key and cursor movement
+#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 0000000000..c37e65d28a
--- /dev/null
+++ b/keyboards/planck/keymaps/ariccb/features/caps_word.c
@@ -0,0 +1,122 @@
+// Copyright 2021-2022 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// For full documentation, see
+// https://getreuer.info/posts/keyboards/caps-word
+
+#include "caps_word.h"
+
+static bool caps_word_active = false;
+
+bool process_caps_word(uint16_t keycode, keyrecord_t* record) {
+#ifndef NO_ACTION_ONESHOT
+ const uint8_t mods = get_mods() | get_oneshot_mods();
+#else
+ const uint8_t mods = get_mods();
+#endif // NO_ACTION_ONESHOT
+
+ if (!caps_word_active) {
+ // Pressing both shift keys at the same time enables caps word.
+ if ((mods & MOD_MASK_SHIFT) == MOD_MASK_SHIFT) {
+ caps_word_set(true); // Activate Caps Word.
+ return false;
+ }
+ return true;
+ }
+
+ if (!record->event.pressed) { return true; }
+
+ if (!(mods & ~MOD_MASK_SHIFT)) {
+ switch (keycode) {
+ // Ignore MO, TO, TG, TT, and OSL layer switch keys.
+ case QK_MOMENTARY ... QK_MOMENTARY + 255:
+ case QK_TO ... QK_TO + 255:
+ case QK_TOGGLE_LAYER ... QK_TOGGLE_LAYER + 255:
+ case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE + 255:
+ case QK_ONE_SHOT_LAYER ... QK_ONE_SHOT_LAYER + 255:
+ return true;
+
+#ifndef NO_ACTION_TAPPING
+ case QK_MOD_TAP ... QK_MOD_TAP_MAX:
+ if (record->tap.count == 0) {
+ // Deactivate if a mod becomes active through holding a mod-tap key.
+ caps_word_set(false);
+ return true;
+ }
+ keycode &= 0xff;
+ break;
+
+#ifndef NO_ACTION_LAYER
+ case QK_LAYER_TAP ... QK_LAYER_TAP_MAX:
+#endif // NO_ACTION_LAYER
+ if (record->tap.count == 0) { return true; }
+ keycode &= 0xff;
+ break;
+#endif // NO_ACTION_TAPPING
+
+#ifdef SWAP_HANDS_ENABLE
+ case QK_SWAP_HANDS ... QK_SWAP_HANDS_MAX:
+ if (keycode > 0x56F0 || record->tap.count == 0) { return true; }
+ keycode &= 0xff;
+ break;
+#endif // SWAP_HANDS_ENABLE
+ }
+
+ if (caps_word_press_user(keycode)) {
+ return true;
+ }
+ }
+
+ caps_word_set(false); // Deactivate Caps Word.
+ return true;
+}
+
+void caps_word_set(bool active) {
+ if (active != caps_word_active) {
+ if (active) {
+ clear_mods();
+#ifndef NO_ACTION_ONESHOT
+ clear_oneshot_mods();
+#endif // NO_ACTION_ONESHOT
+ }
+
+ caps_word_active = active;
+ caps_word_set_user(active);
+ }
+}
+
+bool caps_word_get(void) { return caps_word_active; }
+
+__attribute__((weak)) void caps_word_set_user(bool active) {}
+
+__attribute__((weak)) bool caps_word_press_user(uint16_t keycode) {
+ switch (keycode) {
+ // Keycodes that continue Caps Word, with shift applied.
+ case KC_A ... KC_Z:
+ add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to the next key.
+ return true;
+
+ // Keycodes that continue Caps Word, without shifting.
+ case KC_1 ... KC_0:
+ case KC_P1 ... KC_P0:
+ case KC_BSPC:
+ case KC_MINS:
+ case KC_UNDS:
+ return true;
+
+ default:
+ return false; // Deactivate Caps Word.
+ }
+} \ 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 0000000000..523c815157
--- /dev/null
+++ b/keyboards/planck/keymaps/ariccb/features/caps_word.h
@@ -0,0 +1,101 @@
+// Copyright 2021-2022 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// Caps Word, activated by pressing both shift keys at the same time.
+//
+// This library implements "Caps Word", which is like conventional Caps Lock,
+// but automatically disables itself at the end of the word. This is useful for
+// typing all-caps identifiers like `MOD_MASK_ALT`.
+//
+// Caps Word is activated by pressing the left and right shift keys at the same
+// time. This way you don't need a dedicated key for using Caps Word. I've
+// tested that this works as expected with one-shot mods and Space Cadet Shift.
+// If your shift keys are mod-taps, activate Caps Word by holding both shift
+// mod-tap keys until the tapping term, release them, then begin typing.
+//
+// For full documentation, see
+// https://getreuer.info/posts/keyboards/caps-word
+
+#pragma once
+
+#include QMK_KEYBOARD_H
+
+// Call this function from `process_record_user()` to implement Caps Word.
+bool process_caps_word(uint16_t keycode, keyrecord_t* record);
+
+// Activates or deactivates Caps Word. For instance activate Caps Word with a
+// combo by defining a `COMBO_ACTION` that calls `caps_word_set(true)`:
+//
+// void process_combo_event(uint16_t combo_index, bool pressed) {
+// switch(combo_index) {
+// case CAPS_COMBO:
+// if (pressed) {
+// caps_word_set(true); // Activate Caps Word.
+// }
+// break;
+//
+// // Other combos...
+// }
+// }
+void caps_word_set(bool active);
+
+// Returns whether Caps Word is currently active.
+bool caps_word_get(void);
+
+// An optional callback that gets called when Caps Word turns on or off. This is
+// useful to represent the current Caps Word state, e.g. by setting an LED or
+// playing a sound. In your keymap, define
+//
+// void caps_word_set_user(bool active) {
+// if (active) {
+// // Do something when Caps Word activates.
+// } else {
+// // Do something when Caps Word deactivates.
+// }
+// }
+void caps_word_set_user(bool active);
+
+// An optional callback which is called on every key press while Caps Word is
+// active. When the key should be shifted (that is, a letter key), the callback
+// should call `add_weak_mods(MOD_BIT(KC_LSFT))` to shift the key. The callback
+// also determines whether the key should continue Caps Word. Returning true
+// continues the current "word", while returning false is "word breaking" and
+// deactivates Caps Word. The default callback is
+//
+// bool caps_word_press_user(uint16_t keycode) {
+// switch (keycode) {
+// // Keycodes that continue Caps Word, with shift applied.
+// case KC_A ... KC_Z:
+// add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to the next key.
+// return true;
+//
+// // Keycodes that continue Caps Word, without shifting.
+// case KC_1 ... KC_0:
+// case KC_BSPC:
+// case KC_MINS:
+// case KC_UNDS:
+// return true;
+//
+// default:
+// return false; // Deactivate Caps Word.
+// }
+// }
+//
+// To customize, copy the above function into your keymap and add/remove
+// keycodes to the above cases.
+//
+// NOTE: Outside of this callback, you can use `caps_word_set(false)` to
+// deactivate Caps Word.
+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 0000000000..c0ffe0a90d
--- /dev/null
+++ b/keyboards/planck/keymaps/ariccb/features/select_word.c
@@ -0,0 +1,110 @@
+// Copyright 2021 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// For full documentation, see
+// https://getreuer.info/posts/keyboards/select-word
+
+#include "select_word.h"
+
+// Mac users, uncomment this line:
+// #define MAC_HOTKEYS
+
+enum { STATE_NONE, STATE_SELECTED, STATE_WORD, STATE_FIRST_LINE, STATE_LINE };
+
+bool process_select_word(uint16_t keycode, keyrecord_t* record,
+ uint16_t sel_keycode) {
+ static uint8_t state = STATE_NONE;
+
+ if (keycode == KC_LSFT || keycode == KC_RSFT) { return true; }
+
+ if (keycode == sel_keycode && record->event.pressed) { // On key press.
+ const uint8_t mods = get_mods();
+#ifndef NO_ACTION_ONESHOT
+ const uint8_t all_mods = mods | get_oneshot_mods();
+#else
+ const uint8_t all_mods = mods;
+#endif // NO_ACTION_ONESHOT
+ if ((all_mods & MOD_MASK_SHIFT) == 0) { // Select word.
+#ifdef MAC_HOTKEYS
+ register_code(KC_LALT);
+#else
+ register_code(KC_LCTL);
+#endif // MAC_HOTKEYS
+ if (state == STATE_NONE) {
+ tap_code(KC_RGHT);
+ tap_code(KC_LEFT);
+ }
+ register_code(KC_LSFT);
+ register_code(KC_RGHT);
+ state = STATE_WORD;
+ } else { // Select line.
+ if (state == STATE_NONE) {
+ clear_mods();
+#ifndef NO_ACTION_ONESHOT
+ clear_oneshot_mods();
+#endif // NO_ACTION_ONESHOT
+#ifdef MAC_HOTKEYS
+ register_code16(LCTL(KC_A));
+ tap_code16(LSFT(KC_E));
+ unregister_code16(LCTL(KC_A));
+#else
+ tap_code(KC_HOME);
+ tap_code16(LSFT(KC_END));
+#endif // MAC_HOTKEYS
+ set_mods(mods);
+ state = STATE_FIRST_LINE;
+ } else {
+ register_code(KC_DOWN);
+ state = STATE_LINE;
+ }
+ }
+ return false;
+ }
+
+ // `sel_keycode` was released, or another key was pressed.
+ switch (state) {
+ case STATE_WORD:
+ unregister_code(KC_RGHT);
+ unregister_code(KC_LSFT);
+#ifdef MAC_HOTKEYS
+ unregister_code(KC_LALT);
+#else
+ unregister_code(KC_LCTL);
+#endif // MAC_HOTKEYS
+ state = STATE_SELECTED;
+ break;
+
+ case STATE_FIRST_LINE:
+ state = STATE_SELECTED;
+ break;
+
+ case STATE_LINE:
+ unregister_code(KC_DOWN);
+ state = STATE_SELECTED;
+ break;
+
+ case STATE_SELECTED:
+ if (keycode == KC_ESC) {
+ tap_code(KC_RGHT);
+ state = STATE_NONE;
+ return false;
+ }
+ // Fallthrough.
+ default:
+ state = STATE_NONE;
+ }
+
+ return true;
+}
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 0000000000..f762ba1179
--- /dev/null
+++ b/keyboards/planck/keymaps/ariccb/features/select_word.h
@@ -0,0 +1,37 @@
+// Copyright 2021 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//
+// Select word/line button.
+//
+// Implements a button that selects the current word, assuming conventional text
+// editor hotkeys. Pressing it again extends the selection to the following
+// word. The effect is similar to word selection (W) in the Kakoune editor.
+//
+// Pressing the button with shift selects the current line, and pressing the
+// button again extends the selection to the following line.
+//
+// Note for Mac users: Windows/Linux editing hotkeys are assumed by default.
+// Uncomment the `#define MAC_HOTKEYS` line in select_word.c for Mac hotkeys.
+// The Mac implementation is untested, let me know if it has problems.
+//
+// For full documentation, see
+// https://getreuer.info/posts/keyboards/select-word
+
+#pragma once
+
+#include QMK_KEYBOARD_H
+
+bool process_select_word(uint16_t keycode, keyrecord_t* record,
+ 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 0000000000..c0b4e490fa
--- /dev/null
+++ b/keyboards/planck/keymaps/ariccb/keymap.c
@@ -0,0 +1,664 @@
+ /* Copyright 2021 Aric Crosson Bouwers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include QMK_KEYBOARD_H
+#include "muse.h"
+#include "features/select_word.h"
+#include "features/caps_word.h"
+
+// using the Word Selection QMK Macro by Pascal Getreuer, found here: https://getreuer.info/posts/keyboards/select-word/index.html
+// THANKS Pascal for such amazing functionality!!
+
+// Each layer gets a name for readability, which is then used in the keymap matrix below.
+// The underscores don't mean anything - you can have a layer called STUFF or any other name.
+// Layer names don't all need to be of the same length, obviously, and you can also skip them
+// entirely and just use numbers.
+#define _QWERTY 0
+#define _COLEMAK_VCP 1
+#define _LOWER 2
+#define _RAISE 3
+#define _NUMPAD 4
+#define _FN 5
+#define _ADJUST 6
+#define _GAMING 7
+
+#define MICMUTE LALT(KC_M)
+#define DESKTR LGUI(LCTL(KC_RGHT)) // move one virtual desktop to the right
+#define DESKTL LGUI(LCTL(KC_LEFT)) // move one virtual desktop to the left
+#define MTLCTL_F9 MT(MOD_LCTL, KC_F9)
+#define MTLSFT_F10 MT(MOD_LSFT, KC_F10)
+#define MTLALT_F11 MT(MOD_LALT, KC_F11)
+#define MTLGUI_Z MT(MOD_LGUI, KC_Z)
+#define MTLALT_PL MT(MOD_LALT, KC_MPLY)
+#define MTLALT_NXT MT(MOD_LALT, KC_MNXT)
+#define MTENTER MT(MOD_LCTL, KC_ENT)
+#define MTRSFTBSLS MT(MOD_RSFT, KC_BSLS)
+#define MTRCTLQUO MT(MOD_RCTL, KC_QUOT)
+#define MTTAB MT(MOD_LCTL | MOD_LGUI | MOD_LALT, KC_TAB)
+#define LTESC LT(_FN, KC_ESC)
+#define MTPLAY MT(MOD_RALT, KC_MPLY)
+#define KC_COPY LCTL(KC_C)
+#define KC_CUT LCTL(KC_X)
+#define KC_PASTE LCTL(KC_V)
+#define KC_WINPASTE LGUI(KC_V)
+#define KC_PTXT LCTL(LSFT(KC_V))
+#define KC_UNDO LCTL(KC_Z)
+#define KC_REDO LCTL(KC_Y)
+
+enum planck_keycodes {
+ QWERTY = SAFE_RANGE,
+ COLEMAK_VCP,
+ LOWER,
+ RAISE,
+ FN,
+ ADJUST,
+ NUMPAD,
+ GAMING,
+ EXT_NUM,
+ EXT_GAMING,
+ SELWORD,
+ BRACES,
+ BRACES2,
+ ARROW,
+ ALT_TAB
+};
+
+// Define a type for as many tap dance states as you need
+typedef enum {
+ TD_NONE,
+ TD_UNKNOWN,
+ TD_SINGLE_TAP,
+ TD_SINGLE_HOLD,
+ TD_DOUBLE_TAP
+} td_state_t;
+
+typedef struct {
+ bool is_press_action;
+ td_state_t state;
+} td_tap_t;
+
+ // Our custom tap dance keys; add any other tap dance keys to this enum
+enum {
+ UNDS_LOWER,
+ PLAY_RAISE
+};
+
+// Declare the functions to be used with your tap dance key(s)
+// Function associated with all tap dances
+td_state_t cur_dance(qk_tap_dance_state_t *state);
+
+// Functions associated with individual tap dances
+void usl_finished(qk_tap_dance_state_t *state, void *user_data);
+void usl_reset(qk_tap_dance_state_t *state, void *user_data);
+
+/* ----------------------------------------------------------------------------------------------------------------------------- */
+
+// This is a completely modified layout that stikes a balance between muscle memory for keys, where I was coming from a standard
+// Qwerty keyboard, and efficiency gained by using layers. I've switched tab and esc because it's more natural to me this way, and
+// added layer switch on hold functionality for each key. Enter has moved to the key beside LOWER, to allow usage while still having
+// the right hand on the mouse.
+
+// 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
+// calculators and math are located around the numpad, and coding symbols are placed in easy to remember spots.
+
+// 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.
+// Play/Pause has a prime spot on the base layer, and the Fn version skips to next track
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/* MIT Layout (QWERTY)
+ *
+ * ,------------------------------------------------------------------------.
+ * |FN,Esc| q | w | e | r | t | y | u | i | o | p |Bsp |
+ * |------------------------------------------------------------------------|
+ |CSW,Tab| a | s | d | f | g | h | j | k | l | ; |Ctl,'|
+ * |------------------------------------------------------------------------|
+ * |Shift |Win,z| x | c | v | b | n | m | , | . | / |Sft,\|
+ * |------------------------------------------------------------------------|
+ * | | | |Ctl,Ent|LOWER| Space |RAISE|Alt,Play| | | |
+ * `------------------------------------------------------------------------'
+ */
+[_QWERTY] = LAYOUT_planck_grid( /* QWERTY */
+ LTESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
+ MTTAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, MTRCTLQUO,
+ KC_LSFT, MTLGUI_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, MTRSFTBSLS,
+ KC_NO, KC_NO, KC_NO, MTENTER, TD(UNDS_LOWER), KC_SPC, KC_SPC, MO(3), MTLALT_PL, KC_NO, KC_NO, KC_NO
+ ),
+
+ /* MIT Layout (COLEMAK_VCP)
+ *
+ * ,------------------------------------------------------------------------.
+ * |FN,ESC| q | w | f | d | b | j | l | u | y | ; | Bsp |
+ * |------------------------------------------------------------------------|
+ |CSW,Tab| a | r | s | t | g | m | n | e | i | o |Ctl,'|
+ * |------------------------------------------------------------------------|
+ * |Shift |Win,z| x | v | c | p | k | h | , | . | / |Sft,\|
+ * |------------------------------------------------------------------------|
+ * | | | |Ctl,Ent|LWR,_| Space |RAISE|Alt,Play| | | |
+ * `------------------------------------------------------------------------'
+ */
+[_COLEMAK_VCP] = LAYOUT_planck_grid( /* COLEMAK_VCP */
+ LTESC, KC_Q, KC_W, KC_F, KC_D, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC,
+ MTTAB, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, MTRCTLQUO,
+ KC_LSFT, MTLGUI_Z, KC_X, KC_V, KC_C, KC_P, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, MTRSFTBSLS,
+ KC_NO, KC_NO, KC_NO, MTENTER, TD(UNDS_LOWER), KC_SPC, KC_SPC, MO(3), MTLALT_PL, KC_NO, KC_NO, KC_NO
+ ),
+
+/* MIT Layout (RAISE)
+ *
+ * ,----------------------------------------------------------------------------.
+ * | ~ | ! | | | | | | Cut | Undo| Redo|P2TXT| Bsp |
+ * |----------------------------------------------------------------------------|
+ * | |Menu | | | | |ARROW |SELWORD|Copy|Paste|WinPst| " |
+ * |----------------------------------------------------------------------------|
+ * | |Vol+ |Vol- | Mute| | |Braces|Braces2| < | > | ? | ! |
+ * |----------------------------------------------------------------------------|
+ * | | | | |Adjust| | | | | | |
+ * `----------------------------------------------------------------------------'
+ */
+[_RAISE] = LAYOUT_planck_grid( /* RAISE */
+ KC_TILD, KC_EXLM, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_CUT, KC_UNDO, KC_REDO, KC_PTXT, KC_BSPC,
+ KC_TRNS, KC_APP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ARROW, SELWORD, KC_COPY, KC_PASTE, KC_WINPASTE, KC_DQUO,
+ KC_TRNS, KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, BRACES, BRACES2, KC_LABK, KC_RABK, KC_QUES, KC_EXLM,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(6), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO
+),
+
+/* MIT Layout (LOWER)
+ * XZ
+ * ,-----------------------------------------------------------------------.
+ * | ` | ! | # | $ | < | > | : | 7 | 8 | 9 | = | Bsp |
+ * |-----------------------------------------------------------------------|
+ * | ' | _ | ^ | % | ( | ) | M | 4 | 5 | 6 | - | + |
+ * |-----------------------------------------------------------------------|
+ * |Shift| | | & | " | { | } | @ | 1 | 2 | 3 | / | * |
+ * |-----------------------------------------------------------------------|
+ * | | | | | | |MO(6),0| . | | | |
+ * `-----------------------------------------------------------------------'
+ */
+[_LOWER] = LAYOUT_planck_grid( /* LOWER */
+ KC_GRV, KC_EXLM, KC_HASH, KC_DLR, KC_LABK, KC_RABK, KC_COLN, KC_P7, KC_P8, KC_P9, KC_EQL, KC_BSPC,
+ KC_QUOT, KC_UNDS, KC_CIRC, KC_PERC, KC_LPRN, KC_RPRN, KC_M, KC_P4, KC_P5, KC_P6, KC_PMNS, KC_PPLS,
+ KC_TRNS, KC_PIPE, KC_AMPR, KC_DQUO, KC_LCBR, KC_RCBR, KC_AT, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_PAST,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_PDOT, KC_NO, KC_NO, KC_NO
+),
+
+/* MIT Layout (GAMING)
+ *.
+ * ,-----------------------------------------------------------------------.
+ * |ESC,`| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 |EXIT GAMING|
+ * |-----------------------------------------------------------------------|
+ * | TAB | Q | W | E | R | T | I | 4 | 5 | 6 | - | + |
+ * |-----------------------------------------------------------------------|
+ * |Shift| A | S | D | F | G | K | 1 | 2 | 3 | / | * |
+ * |-----------------------------------------------------------------------|
+ * | | | | Ctl | Alt | SPACE | 0 | . | | | |
+ * `-----------------------------------------------------------------------'
+ */
+[_GAMING] = LAYOUT_planck_grid( /* GAMING */
+ KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_P8, KC_9, KC_0, EXT_GAMING,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_I, KC_P4, KC_P5, KC_P6, KC_PMNS, KC_PPLS,
+ KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_K, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_PAST,
+ KC_NO, KC_NO, KC_NO, KC_LCTL, KC_LALT, KC_SPC, KC_SPC, KC_P0, KC_PDOT, KC_NO, KC_NO, KC_NO
+),
+
+/* MIT Layout (FN)
+ *
+ * ,----------------------------------------------------------------------------.
+ * | |Ctl,F9 |Sft,F10|Alt,F11| F12 |MyComp|Calc |home | up | end |PrtScr| Del |
+ * |-----------------------------------------------------------------------------|
+ * | | F5 | F6 | F7 | F8 |DeskL |DeskR |left | down |right|ScrLck| CAPS|
+ * |-----------------------------------------------------------------------------|
+ * | | F1 | F2 | F3 | F4 |ALT_TAB|MicM |pgup |LCA_dn| pgdn|Pse/Brk| Ins|
+ * |-----------------------------------------------------------------------------|
+ * | | | | | | | |Alt,MNext| | | |
+ * `-----------------------------------------------------------------------------'
+ */
+[_FN] = LAYOUT_planck_grid( /* FUNCTION */
+ KC_TRNS, MTLCTL_F9, MTLSFT_F10, MTLALT_F11, KC_F12, KC_MYCM, KC_CALC, KC_HOME, KC_UP, KC_END, KC_PSCR, KC_DEL,
+ KC_TRNS, KC_F5, KC_F6, KC_F7, KC_F8, DESKTL, DESKTR, KC_LEFT, KC_DOWN, KC_RGHT, KC_SLCK, KC_CAPS,
+ KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, ALT_TAB, MICMUTE, KC_PGUP, LCA(KC_DOWN), KC_PGDN, KC_PAUSE, KC_INS,
+ KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MTLALT_NXT, KC_NO, KC_NO, KC_NO
+),
+
+/* MIT Layout (ADJUST)
+ *
+ * ,-----------------------------------------------------------------------------.
+ * |RGBtog|Ms3 | Ms2 |MsUp | Ms1 | Hue+| Hue- | Sat+| Sat- |Brt+ |Brt- | RESET|
+ * |-----------------------------------------------------------------------------|
+ * |RGBMod| MWL | MsL |MDn |MsR |GAMING| |AU_ON|AU_OFF|MU_ON|MU_OF| DEBUG|
+ * |-----------------------------------------------------------------------------|
+ * | |MWLft|MWUp |NWDn |NWRght|QWERTY|CMK_VCP|MI_ON|MI_OF | | |MU_Mod|
+ * |-----------------------------------------------------------------------------|
+ * | | | |SLEEP| | | | | | | |
+ * `-----------------------------------------------------------------------------'
+ */
+[_ADJUST] = LAYOUT_planck_grid( /* ADJUST LAYER */
+ RGB_TOG, KC_BTN3, KC_BTN2, KC_MS_U, KC_BTN1, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, RESET,
+ 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,
+ 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,
+ KC_NO, KC_NO, KC_NO, KC_SLEP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO
+)
+};
+
+#ifdef AUDIO_ENABLE
+float layerswitch_song[][2] = SONG(PLANCK_SOUND);
+float tone_startup[][2] = SONG(STARTUP_SOUND);
+float tone_qwerty[][2] = SONG(QWERTY_SOUND);
+float tone_COLEMAK_VCP[][2] = SONG(COLEMAK_SOUND);
+float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
+float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
+
+#endif
+
+bool is_alt_tab_active = false;
+layer_state_t layer_state_set_user(layer_state_t state) {
+
+ static bool is_this_layer_on = false;
+ if (layer_state_cmp(state, 4) != is_this_layer_on) {
+ is_this_layer_on = layer_state_cmp(state, 4);
+ if (is_this_layer_on) {
+ PLAY_SONG(layerswitch_song);
+ }
+ else {
+ stop_all_notes();
+ }
+ }
+ if (is_alt_tab_active) {
+ unregister_code(KC_LALT);
+ is_alt_tab_active = false;
+ }
+ return state;
+
+ switch (get_highest_layer(state)) {
+ case _ADJUST:
+ rgblight_setrgb (0xFF, 0x00, 0x00);
+ break;
+ case _LOWER:
+ rgblight_setrgb (0x00, 0x00, 0xFF);
+ break;
+ case _NUMPAD:
+ rgblight_setrgb (0x00, 0x00, 0xFF);
+ break;
+ case _RAISE:
+ rgblight_setrgb (0x7A, 0x00, 0xFF);
+ break;
+ case _FN:
+ rgblight_setrgb (0x00, 0xFF, 0x00);
+ break;
+ default: // for any other layers, or the default layer
+ rgblight_setrgb (0xFF, 0xFF, 0xFF);
+ break;
+ }
+ return state;
+}
+
+// void dance_media (qk_tap_dance_state_t *state, void *user_data)
+// if (state->count == 1) {
+// tap_code(KC_MPLY);
+// } else if (state->count == 2) {
+// tap_code (KC_MNXT);
+// } else if (state->count == 3) {
+// tap_code(KC_MPRV);
+// } else {
+// reset_tap_dance (state);
+// }
+// }
+
+// qk_tap_dance_action_t tap_dance_actions[] = {
+// [0] = ACTION_TAP_DANCE_FN (dance_media),
+// };
+
+// Determine the current tap dance state
+td_state_t cur_dance(qk_tap_dance_state_t *state) {
+ if (state->interrupted) return TD_SINGLE_HOLD;
+ if (state->count == 1) {
+ if (!state->pressed) return TD_SINGLE_TAP;
+ else return TD_SINGLE_HOLD;
+ } else if (state->count == 2) return TD_DOUBLE_TAP;
+ else return TD_UNKNOWN;
+}
+
+// Initialize tap structure associated with example tap dance key
+static td_tap_t usl_tap_state = {
+ .is_press_action = true,
+ .state = TD_NONE
+};
+
+// Functions that control what our tap dance key does
+void usl_finished(qk_tap_dance_state_t *state, void *user_data) {
+ usl_tap_state.state = cur_dance(state);
+ switch (usl_tap_state.state) {
+ case TD_SINGLE_TAP:
+ tap_code16(KC_UNDS);
+ break;
+ case TD_SINGLE_HOLD:
+ layer_on(_LOWER);
+ // update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ break;
+ case TD_DOUBLE_TAP:
+ // Check to see if the layer is already set
+ if (layer_state_is(_LOWER)) {
+ // If already set, then switch it off
+ layer_off(_LOWER);
+ #ifdef AUDIO_ENABLE
+ PLAY_SONG(tone_goodbye);
+ #endif
+ } else {
+ // If not already set, then switch the layer on
+ layer_on(_LOWER);
+ #ifdef AUDIO_ENABLE
+ PLAY_SONG(layerswitch_song);
+ #endif
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void usl_reset(qk_tap_dance_state_t *state, void *user_data) {
+ // If the key was held down and now is released then switch off the layer
+ if (usl_tap_state.state == TD_SINGLE_HOLD) {
+ layer_off(_LOWER);
+ // update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ }
+ usl_tap_state.state = TD_NONE;
+}
+
+// Associate our tap dance key with its functionality
+qk_tap_dance_action_t tap_dance_actions[] = {
+ [UNDS_LOWER] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, usl_finished, usl_reset, 175)
+};
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ if (!process_select_word(keycode, record, SELWORD)) { return false; }
+ if (!process_caps_word(keycode, record)) { return false; }
+
+ const uint8_t mods = get_mods();
+ const uint8_t oneshot_mods = get_oneshot_mods();
+
+ switch (keycode) {
+ case QWERTY:
+ if (record->event.pressed) {
+ set_single_persistent_default_layer(_QWERTY);
+ }
+ return false;
+ break;
+ case KC_CAPS:
+ if (record->event.pressed) {
+ #ifdef AUDIO_ENABLE
+ PLAY_SONG(tone_qwerty);
+ #endif
+ register_code(KC_CAPS);
+ }
+ return false;
+ break;
+ case GAMING:
+ if (record->event.pressed) {
+ layer_off(_RAISE);
+ layer_off(_LOWER);
+ layer_off(_ADJUST);
+ layer_on(_GAMING);
+ #ifdef AUDIO_ENABLE
+ PLAY_SONG(layerswitch_song);
+ #endif
+ }
+ return false;
+ break;
+ case EXT_GAMING:
+ if (record->event.pressed) {
+ layer_off(_GAMING);
+ #ifdef AUDIO_ENABLE
+ PLAY_SONG(tone_goodbye);
+ #endif
+ }
+ return false;
+ break;
+ case COLEMAK_VCP:
+ if (record->event.pressed) {
+ set_single_persistent_default_layer(_COLEMAK_VCP);
+ }
+ return false;
+ break;
+ case BRACES: // Types (), or {}, and puts cursor between braces.
+ if (record->event.pressed) {
+ clear_mods(); // Temporarily disable mods.
+ clear_oneshot_mods();
+ if ((mods | oneshot_mods) & MOD_MASK_SHIFT) {
+ SEND_STRING("{}");
+ } else {
+ SEND_STRING("<>");
+ }
+ tap_code(