From 3d53ea439c277e49cd4149a6caea727304f41ace Mon Sep 17 00:00:00 2001 From: Yet Another Developer <50936645+yet-another-developer@users.noreply.github.com> Date: Mon, 21 Oct 2019 02:07:57 +0800 Subject: [PATCH] [Keymap] Ergodash keymap for yet-another-developer (#7046) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initialize ergodash rev 1 keymap ./util/new_keymap.sh ergodash/rev1 yet-another-developer * Add user space configurations referenced from drashna * Start community layout for ergodash in ortho_5x14 * Remove unused layers * Add userspace layers * Add Userspace gitignore Hide Secrets * Remove userspace unused drashna features * Scrap default keymap and follow drashna's template * Add code referenced from kuchosauronad0 * Make sure that the author is named Developer * Replace middle keys del and bksp with curly brace * Reduce ONESHOT_TIMEOUT from 3sec to 2sec * Remove adjust key AG_SWAP * Disable UNICODEMAP_ENABLE, remove code causing build fail * Increase TAPPING_TERM to 240 Reason: Because Space is also LOWER, space sometimes not registering. PS: I dont want to #define RETRO_TAPPING yet * Update KC_MAKE to use :flash * Remove TAP_ONCE, use tap_code Signed-off-by: Developer * Remove redundant code implementation of keyboard_post_init_user https://github.com/qmk/qmk_firmware/pull/7046 users/yet-another-developer/leader.c ``` static bool has_ran_yet; if (!has_ran_yet) { has_ran_yet = true; startup_user(); ``` Comment for lines +11 – +14 @drashna: Not needed anymore. You can use keyboard_post_init_user now. Signed-off-by: Developer --- .../keymaps/yet-another-developer/config.h | 67 ++++++ .../keymaps/yet-another-developer/keymap.c | 157 +++++++++++++ .../keymaps/yet-another-developer/rules.mk | 23 ++ .../ortho_5x14/yet-another-developer/config.h | 22 ++ .../ortho_5x14/yet-another-developer/keymap.c | 208 ++++++++++++++++++ .../ortho_5x14/yet-another-developer/rules.mk | 1 + users/yet-another-developer/.gitignore | 2 + users/yet-another-developer/README.md | 7 + users/yet-another-developer/combo.c | 27 +++ users/yet-another-developer/combo.h | 21 ++ users/yet-another-developer/config.h | 56 +++++ users/yet-another-developer/leader.c | 46 ++++ users/yet-another-developer/leader.h | 6 + users/yet-another-developer/process_records.c | 193 ++++++++++++++++ users/yet-another-developer/process_records.h | 109 +++++++++ users/yet-another-developer/rules.mk | 50 +++++ users/yet-another-developer/tap_dances.c | 55 +++++ users/yet-another-developer/tap_dances.h | 26 +++ users/yet-another-developer/unicode.c | 62 ++++++ users/yet-another-developer/unicode.h | 67 ++++++ users/yet-another-developer/wrappers.h | 166 ++++++++++++++ .../yet-another-developer.c | 160 ++++++++++++++ .../yet-another-developer.h | 87 ++++++++ 23 files changed, 1618 insertions(+) create mode 100644 keyboards/ergodash/rev1/keymaps/yet-another-developer/config.h create mode 100644 keyboards/ergodash/rev1/keymaps/yet-another-developer/keymap.c create mode 100644 keyboards/ergodash/rev1/keymaps/yet-another-developer/rules.mk create mode 100644 layouts/community/ortho_5x14/yet-another-developer/config.h create mode 100644 layouts/community/ortho_5x14/yet-another-developer/keymap.c create mode 100644 layouts/community/ortho_5x14/yet-another-developer/rules.mk create mode 100644 users/yet-another-developer/.gitignore create mode 100644 users/yet-another-developer/README.md create mode 100644 users/yet-another-developer/combo.c create mode 100644 users/yet-another-developer/combo.h create mode 100644 users/yet-another-developer/config.h create mode 100644 users/yet-another-developer/leader.c create mode 100644 users/yet-another-developer/leader.h create mode 100644 users/yet-another-developer/process_records.c create mode 100644 users/yet-another-developer/process_records.h create mode 100644 users/yet-another-developer/rules.mk create mode 100644 users/yet-another-developer/tap_dances.c create mode 100644 users/yet-another-developer/tap_dances.h create mode 100644 users/yet-another-developer/unicode.c create mode 100644 users/yet-another-developer/unicode.h create mode 100644 users/yet-another-developer/wrappers.h create mode 100644 users/yet-another-developer/yet-another-developer.c create mode 100644 users/yet-another-developer/yet-another-developer.h diff --git a/keyboards/ergodash/rev1/keymaps/yet-another-developer/config.h b/keyboards/ergodash/rev1/keymaps/yet-another-developer/config.h new file mode 100644 index 000000000..1005c4804 --- /dev/null +++ b/keyboards/ergodash/rev1/keymaps/yet-another-developer/config.h @@ -0,0 +1,67 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako +Copyright 2015 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 . +*/ + +#pragma once + + +/* Use I2C or Serial, not both */ +#define USE_SERIAL +// #define USE_I2C + +/* Select hand configuration */ + +//#define MASTER_LEFT +#define MASTER_RIGHT /* Cable connected to the right split keyboard */ +// #define EE_HANDS + +#define AUTO_SHIFT_TIMEOUT 210 + +#define TAPPING_TERM_PER_KEY + +// https://beta.docs.qmk.fm/features/feature_leader_key +//#define LEADER_PER_KEY_TIMING +//#define LEADER_TIMEOUT 280 + +// https://docs.qmk.fm/#/feature_mouse_keys +#define MK_3_SPEED // Constant Speed Mode + +#define MOUSEKEY_DELAY 300 +#define MOUSEKEY_INTERVAL 16 +#define MOUSEKEY_MAX_SPEED 3 +#define MOUSEKEY_TIME_TO_MAX 60 +#define MK_C_OFFSET_0 4 +#define MK_C_INTERVAL_0 28 +#define MK_C_OFFSET_1 8 +#define MK_C_INTERVAL_1 16 +#define MK_C_OFFSET_2 20 +#define MK_C_INTERVAL_2 16 + +#define MOUSEKEY_WHEEL_MAX_SPEED 4 +#define MOUSEKEY_WHEEL_TIME_TO_MAX 40 + +#define MK_W_OFFSET_0 1 +#define MK_W_INTERVAL_0 120 +#define MK_W_OFFSET_1 1 +#define MK_W_INTERVAL_1 100 +#define MK_W_OFFSET_2 1 +#define MK_W_INTERVAL_2 60 + +//#define STARTUP_RESET_EEPROM // EMERGENCY + diff --git a/keyboards/ergodash/rev1/keymaps/yet-another-developer/keymap.c b/keyboards/ergodash/rev1/keymaps/yet-another-developer/keymap.c new file mode 100644 index 000000000..1d51227cc --- /dev/null +++ b/keyboards/ergodash/rev1/keymaps/yet-another-developer/keymap.c @@ -0,0 +1,157 @@ +#include QMK_KEYBOARD_H +#include "yet-another-developer.h" + +#ifndef UNICODE_ENABLE +# define UC(x) KC_NO +#endif + +extern keymap_config_t keymap_config; + +#define EISU LALT(KC_GRV) + +#define LAYOUT_ergodash_pretty_wrapper(...) LAYOUT_ergodash_pretty(__VA_ARGS__) + + /* Keymap: BASE layer + * + * ,----------------------------------------------------. ,----------------------------------------------------. + * | ESC | 1 | 2 | 3 | 4 | 5 | [ | | ] | 6 | 7 | 8 | 9 | 0 | Pscree | + * |--------+--------+------+------+------+-------------| |------+------+------+------+------+--------+--------| + * | ` | K01 | K02 | K03 | K04 | K05 | - | | = | K06 | K07 | K08 | K09 | K0A | \ | + * |--------+--------+------+------+------+------|------| |------|------+------+------+------+--------+--------| + * | Tab | K11 | K12 | K13 | K14 | K15 | { | | } | K16 | K17 | K18 | K19 | K1A | " | + * |--------+--------+------+------+------+------|------' `------|------+------+------+------+--------+--------| + * | LShift | K21 | K22 | K23 | K24 | K25 | | K26 | K27 | K28 | K29 | K2A | RShift | + * |--------+--------+------+------+------+------' `------+------+------+------+--------+--------| + * | LCtrl | GUI | Alt | Alt | | LEFT | DOWN | UP | RIGHT | + * `-------------------------------' `-------------------------------' + * ,--------------. ,--------------. + * | Lower| | | | Raise | + * ,-------| / | Del | | Bksp + / +-------. + * |CMD/Spc| Space| | | | Enter |CMD/Spc| + * `----------------------' `----------------------' + */ +#define LAYOUT_ergodash_pretty_base( \ + K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \ + K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \ + K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \ + ) \ + LAYOUT_ergodash_pretty_wrapper( \ + KC_ESC, ________________NUMBER_LEFT________________, KC_LBRC, KC_RBRC, ________________NUMBER_RIGHT_______________, KC_PSCR, \ + KC_GRV, K01, K02, K03, K04, K05, KC_MINS, KC_EQL, K06, K07, K08, K09, K0A, KC_BSLS, \ + KC_TAB, K11, K12, K13, K14, K15, KC_LCBR, KC_RCBR, K16, K17, K18, K19, K1A, KC_QUOT, \ + OS_LSFT, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, OS_RSFT, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_LALT, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, \ + LT(_LOWER, KC_SPC), LT(_RAISE, KC_ENT), \ + OS_LGUI,LT(_LOWER, KC_SPC),KC_DEL, KC_BSPC, LT(_RAISE, KC_ENT), OS_RGUI \ + ) + +#define LAYOUT_ergodash_pretty_base_wrapper(...) LAYOUT_ergodash_pretty_base(__VA_ARGS__) + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = LAYOUT_ergodash_pretty_base_wrapper( + _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, + _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, + _________________QWERTY_L3_________________, _________________QWERTY_R3_________________ + ), + +/* Keymap: COLEMAK layer + * + * ,----------------------------------------------------. ,----------------------------------------------------. + * | ESC | 1 | 2 | 3 | 4 | 5 | [ | | ] | 6 | 7 | 8 | 9 | 0 | - | + * |--------+--------+------+------+------+-------------| |------+------+------+------+------+--------+--------| + * | ` | Q | W | F | P | G | - | | = | J | L | U | Y | ; | \ | + * |--------+--------+------+------+------+------|------| |------|------+------+------+------+--------+--------| + * | Tab | A | R | S | T | D | Del | | Bksp | H | N | E | I | O | ' | + * |--------+--------+------+------+------+------|------' `------|------+------+------+------+--------+--------| + * | LShift | Z | X | C | V | B | | K | M | , < | . > | / | RShift | + * |--------+--------+------+------+------+------' `------+------+------+------+--------+--------| + * | Ctrl | GUI | Alt | EISU | | LEFT | DOWN | UP | RIGHT | + * `-------------------------------' `-------------------------------' + * ,--------------. ,--------------. + * | Lower| | | | Raise | + * ,-------| / | Del | | Bksp + / +-------. + * |CMD/Spc| Space| | | | Enter |CMD/Spc| + * `----------------------' `----------------------' + */ + + +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* + [_COLEMAK] = LAYOUT_ergodash_pretty_base_wrapper( + _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, + _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, + _________________COLEMAK_L3________________, _________________COLEMAK_R3________________ + ), + + [_DVORAK] = LAYOUT_ergodash_pretty_base_wrapper( + _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, + _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, + _________________DVORAK_L3_________________, _________________DVORAK_R3_________________ + ), + + [_WORKMAN] = LAYOUT_ergodash_pretty_base_wrapper( + _________________WORKMAN_L1________________, _________________WORKMAN_R1________________, + _________________WORKMAN_L2________________, _________________WORKMAN_R2________________, + _________________WORKMAN_L3________________, _________________WORKMAN_R3________________ + ), + +#ifdef UNICODEMAP_ENABLE + [_UNICODE] = LAYOUT_ergodash_pretty_base_wrapper( + _______________UNICODE_L1__________________, _______________UNICODE_R1__________________, + _______________UNICODE_L2__________________, _______________UNICODE_R2__________________, + _______________UNICODE_L3__________________, _______________UNICODE_R3__________________ + ), +#endif + + [_LOWER] = LAYOUT_ergodash_pretty_wrapper( + KC_F11, _________________FUNC_LEFT_________________, KC_RST , KC_RST , _________________FUNC_RIGHT________________, KC_F12, + KC_TILD, _________________LOWER_L1__________________, _______, _______, _________________LOWER_R1__________________, KC_PIPE, + _______, _________________LOWER_L2__________________, _______, _______, _________________LOWER_R2__________________, KC_DQUO, + _______, _________________LOWER_L3__________________, _________________LOWER_R3__________________, KC_PSCR, + _______, _______, _______, _______, _______, _______, _______, KC_PAUS, + _______, _______, + _______, _______, _______, _______, _______, _______ + ), + + [_RAISE] = LAYOUT_ergodash_pretty_wrapper( + KC_F12, _________________FUNC_LEFT_________________, KC_RST, KC_RST , _________________FUNC_RIGHT________________, KC_F11, + KC_GRV, _________________RAISE_L1__________________, _______, _______, _________________RAISE_R1__________________, KC_BSLS, + _______, _________________RAISE_L2__________________, _______, _______, _________________RAISE_R2__________________, KC_QUOT, + _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, KC_PSCR, + _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, + _______, _______, + _______, _______, _______, _______, _______, _______ + ), + + [_ADJUST] = LAYOUT_ergodash_pretty_wrapper( + KC_MAKE, _______, _______, _______, _______, _______, _______, KC_NUKE, _______, _______, _______, _______, _______, KC_RST, + VRSN, _________________ADJUST_L1_________________, _______, _______, _________________ADJUST_R1_________________, EEP_RST, + _______, _________________ADJUST_L2_________________, _______, _______, _________________ADJUST_R2_________________, _______, + _______, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, _______, + _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, + _______, _______, _______, _______, _______, _______ + ), +}; + +#ifdef AUDIO_ENABLE +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +#endif + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + return true; +} +void matrix_init_keymap(void) { +#ifdef STARTUP_RESET_EEPROM + eeconfig_init(); +#endif +} + +// diff --git a/keyboards/ergodash/rev1/keymaps/yet-another-developer/rules.mk b/keyboards/ergodash/rev1/keymaps/yet-another-developer/rules.mk new file mode 100644 index 000000000..6ba6c5b22 --- /dev/null +++ b/keyboards/ergodash/rev1/keymaps/yet-another-developer/rules.mk @@ -0,0 +1,23 @@ +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) + +# Device +AUDIO_ENABLE = no + +RGBLIGHT_ENABLE = no +BACKLIGHT_ENABLE = no +INDICATOR_LIGHTS = no + +# QMK Features +AUTO_SHIFT_ENABLE = no +MOUSEKEY_ENABLE = no +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +LEADER_ENABLE = yes # default is yes +TAP_DANCE_ENABLE = no #(+1254) +UNICODE_ENABLE = no #(+1134) +UNICODEMAP_ENABLE = no +NKRO_ENABLE = no +MACROS_ENABLED = no + +# User Defined Features +NO_SECRETS = no diff --git a/layouts/community/ortho_5x14/yet-another-developer/config.h b/layouts/community/ortho_5x14/yet-another-developer/config.h new file mode 100644 index 000000000..7504338ff --- /dev/null +++ b/layouts/community/ortho_5x14/yet-another-developer/config.h @@ -0,0 +1,22 @@ +#pragma once + +/* ws2812 RGB LED */ +#if defined(KEYBOARD_fractal) +# define RGB_DI_PIN D2 +# undef RGBLED_NUM +# define RGBLIGHT_ANIMATIONS +# define RGBLED_NUM 29 // Number of LEDs +# undef RGBLIGHT_HUE_STEP +# define RGBLIGHT_HUE_STEP 8 +# undef RGBLIGHT_SAT_STEP +# define RGBLIGHT_SAT_STEP 8 +# undef RGBLIGHT_VAL_STEP +# define RGBLIGHT_VAL_STEP 8 +# define RGBLIGHT_LIMIT_VAL 175 +# define RGBLIGHT_SLEEP + +# define RGBLIGHT_EFFECT_KNIGHT_OFFSET 3 +# define RGBLIGHT_EFFECT_KNIGHT_LED_NUM 14 +# define B7_AUDIO +# define NO_MUSIC_MODE +#endif diff --git a/layouts/community/ortho_5x14/yet-another-developer/keymap.c b/layouts/community/ortho_5x14/yet-another-developer/keymap.c new file mode 100644 index 000000000..aea50508d --- /dev/null +++ b/layouts/community/ortho_5x14/yet-another-developer/keymap.c @@ -0,0 +1,208 @@ +#include QMK_KEYBOARD_H +#include "yet-another-developer.h" + +// clang-format off + +/* ---------- LEFT HAND ----------- ---------- RIGHT HAND ---------- */ +#define LAYOUT_ergodash_pretty( \ + L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06, \ + L10, L11, L12, L13, L14, L15, L16, R10, R11, R12, R13, R14, R15, R16, \ + L20, L21, L22, L23, L24, L25, L26, R20, R21, R22, R23, R24, R25, R26, \ + L30, L31, L32, L33, L34, L35, R31, R32, R33, R34, R35, R36, \ + L40, L41, L42, L43, R43, R44, R45, R46 \ + L36, R30, \ + L44, L45, L46, R40, R41, R42, \ + ) \ + /* matrix positions */ \ + { \ + { L00, L01, L02, L03, L04, L05, L06 }, \ + { L10, L11, L12, L13, L14, L15, L16 }, \ + { L20, L21, L22, L23, L24, L25, L26 }, \ + { L30, L31, L32, L33, L34, L35, L36 }, \ + { L40, L41, L42, L43, L44, L45, L46 }, \ + { R06, R05, R04, R03, R02, R01, R00 }, \ + { R16, R15, R14, R13, R12, R11, R10 }, \ + { R26, R25, R24, R23, R22, R21, R20 }, \ + { R36, R35, R34, R33, R32, R31, R30 }, \ + { R46, R45, R44, R43, R42, R41, R40 } \ + } + +#define LAYOUT_ergodash_pretty_wrapper(...) LAYOUT_ergodash_pretty(__VA_ARGS__) + +#define LAYOUT_ergodash_pretty_base( \ + K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \ + K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \ + K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \ + ) \ + LAYOUT_ergodox_pretty_wrapper( \ + KC_ESC, ________________NUMBER_LEFT________________, KC_LBRC, KC_RBRC, ________________NUMBER_RIGHT_______________, KC_PSCR, \ + KC_GRV, K01, K02, K03, K04, K05, KC_MINS, KC_EQL, K06, K07, K08, K09, K0A, KC_BSLS, \ + KC_TAB, ALT_T(K11), K12, K13, K14, K15, KC_DEL, KC_BSPC, K16, K17, K18, K19, K1A, RALT_T(KC_QUOT), \ + KC_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), KC_MRSF, \ + KC_LCTL, KC_LGUI, KC_LALT, EISU, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + LT(_LOWER, KC_SPC), LT(_RAISE, KC_ENT), \ + OS_LGUI,LT(_LOWER, KC_SPC),KC_DEL, KC_BSPC, LT(_RAISE, KC_ENT), OS_RGUI \ + ) + +#define LAYOUT_ergodash_pretty_base_wrapper(...) LAYOUT_ergodash_pretty_base(__VA_ARGS__) + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: QWERTY Layer + * + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | = + | 1 ! | 2 @ | 3 # | 4 $ | 5 % | TG(4)| | TG(4)| 6 ^ | 7 & | 8 * | 9 ( | 0 ) | - _ | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | TAB | Q | W | E | R | T | TG(3)| |TG(3) | Y | U | I | O | P | \ | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | Bksp | A | S | D | F | G |------| |------| H | J | K | L | ; | ' " | + * |--------+------+------+------+------+------| TG(2)| | TG(2)|------+------+------+------+------+--------| + * | Shift | Z | X | C | V | B | | | | N | M | , < | . > | ? / | Shift | + * |--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------| + * | `/SYM | MEH | LGUI | [ { | | LEFT | DOWN | UP |RIGHT | SYMB | + * `-----------------------------' `------------------------------------' + * ,--------------. ,--------------. + * |Alt/Ap| Win | | Alt |Ctl/Esc| + * ,------|------|-------| |------+-------+------. + * | | | Home | | PgUp | | | + * `---------------------' `---------------------' + */ + [_QWERTY] = LAYOUT_ergodash_pretty_base_wrapper( + _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, + _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, + _________________QWERTY_L3_________________, _________________QWERTY_R3_________________ + ), +/* Keymap 0: COLEMAK layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Del | Q | W | F | P | G | L1 | | L1 | J | L | U | Y | ; | \ | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | BkSp | A | R | S | T | D |------| |------| H | N | E | I |O / L2| ' | + * |--------+------+------+------+------+------| OVER | | Meh |------+------+------+------+------+--------| + * | LShift |Z/Ctrl| X | C | V | B | | | | K | M | , | . |//Ctrl| RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | `/SYM | MEH | LGUI | [ { | | LEFT | DOWN | UP |RIGHT | SYMB | + * `-----------------------------' `------------------------------------' + * ,--------------. ,--------------. + * |Alt/Ap| Win | | Alt |Ctl/Esc| + * ,------|------|-------| |------+-------+------. + * | | | Home | | PgUp | | | + * `---------------------' `---------------------' + */ +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* + [_COLEMAK] = LAYOUT_ergodash_pretty_base_wrapper( + _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, + _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, + _________________COLEMAK_L3________________, _________________COLEMAK_R3________________ + ), + +// Reverts OSM(Shift) to normal Shifts. However, may not need since we fixed the issue with RDP (LOCAL RESOURCES) + [_MODS] = LAYOUT_ergodash_pretty_wrapper( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_LSFT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RSFT, + _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______ + ), + + +/* Keymap 4: Customized Overwatch Layout + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | ESC | | | | | | | | | F9 | F10 | F11 | F12 | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | F1 | K | Q | W | E | R | T | | | | | | | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | TAB | G | A | S | D | F |------| |------| | | | | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | LCTR | LSHFT| Z | X | C | V | | | | N | M | | | | | + * |--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------| + * | `/SYM | MEH | LGUI | [ { | | LEFT | DOWN | UP |RIGHT | SYMB | + * `-----------------------------' `------------------------------------' + * ,--------------. ,--------------. + * |Alt/Ap| Win | | Alt |Ctl/Esc| + * ,------|------|-------| |------+-------+------. + * | | | Home | | PgUp | | | + * `---------------------' `---------------------' + */ + [_GAMEPAD] = LAYOUT_ergodash_pretty_wrapper( + KC_ESC, KC_NO, KC_1, KC_2, KC_3, HYPR(KC_Q), HYPR(KC_GRV), KC_TRNS, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, + KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, KC_T, UC_SHRG, UC_DISA, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, KC_I, KC_O, KC_NO, KC_NO, KC_NO, KC_NO, + KC_LCTL, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_TRNS, TG(_GAMEPAD), KC_N, KC_M, KC_NO, KC_NO, KC_NO, KC_NO, + KC_GRV, KC_U, KC_I, KC_Y, KC_T, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO, + KC_O, KC_P, MAGIC_TOGGLE_NKRO, LALT(KC_PSCR), + KC_LGUI, KC_HYPR, + KC_V, KC_SPC, KC_H, KC_NO, KC_NO, KC_SWAP_NUM + ), + +/* Keymap 3: + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | ESC | V | D | ALT | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | TAB | S | I | F | M | T | | | | | | | | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | Q | 1 | 2 | 3 | 4 | G |------| |------| | | | | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | NUMLOCK| NUM1 | NUM2 | NUM3 | NUM4 | Z | | | | | | | | | | + * |--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | `/SYM | MEH | LGUI | [ { | | LEFT | DOWN | UP |RIGHT | SYMB | + * `-----------------------------' `------------------------------------' + * ,--------------. ,--------------. + * |Alt/Ap| Win | | Alt |Ctl/Esc| + * ,------|------|-------| |------+-------+------. + * | | | Home | | PgUp | | | + * `---------------------' `---------------------' + */ + [_DIABLO] = LAYOUT_ergodash_pretty_wrapper( + KC_ESC, KC_V, KC_D, KC_LALT, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, + KC_TAB, KC_S, KC_I, KC_F, KC_M, KC_T, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_Q, KC_1, KC_2, KC_3, KC_4, KC_G, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_LCTL, KC_D3_1, KC_D3_2, KC_D3_3, KC_D3_4, KC_Z, KC_NO, KC_NO, KC_N, KC_M, KC_NO, KC_NO, KC_NO, KC_NO, + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_L, KC_J, KC_NO, KC_NO, + KC_F, KC_NO, + SFT_T(KC_SPACE), ALT_T(KC_Q), KC_DIABLO_CLEAR, KC_PGDN, KC_DEL, KC_ENT + ), + + [_LOWER] = LAYOUT_ergodash_pretty_wrapper( + KC_F12, _________________FUNC_LEFT_________________, _______, _______, _________________FUNC_RIGHT________________, KC_F11, + KC_TILD, _________________LOWER_L1__________________, _______, _______, _________________LOWER_R1__________________, KC_PIPE, + _______, ___________________BLANK___________________, _________________LOWER_R2__________________, KC_DQUO, + _______, ___________________BLANK___________________, _______, _______, _________________LOWER_R3__________________, KC_PSCR, + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PAUS, + _______, _______, _______, _______, + _______, _______, + _______, _______, _______, _______, _______, _______ + ), + + [_RAISE] = LAYOUT_ergodash_pretty_wrapper( + KC_F12, _________________FUNC_LEFT_________________, _______, _______, _________________FUNC_RIGHT________________, KC_F11, + KC_GRV, _________________RAISE_L1__________________, _______, _______, _________________RAISE_R1__________________, KC_BSLS, + _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_QUOT, + _______, _________________RAISE_L3__________________, _______, _______, _________________RAISE_R3__________________, KC_PSCR, + _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_SLCK, + _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______ + ), + + [_ADJUST] = LAYOUT_ergodash_pretty_wrapper( + KC_MAKE, _______, _______, _______, _______, _______, _______, KC_NUKE, _________________ADJUST_R1_________________, KC_RST, + VRSN, _________________ADJUST_L1_________________, _______, _______, _______, _______, _______, _______, _______, EEP_RST, + _______, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, RGB_IDL, + _______, _________________ADJUST_L3_________________, _______, _______, _________________ADJUST_R3_________________, TG(_MODS), + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, + _______, _______, _______, _______, _______, _______ + ), + +}; +// clang-format on diff --git a/layouts/community/ortho_5x14/yet-another-developer/rules.mk b/layouts/community/ortho_5x14/yet-another-developer/rules.mk new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/layouts/community/ortho_5x14/yet-another-developer/rules.mk @@ -0,0 +1 @@ + diff --git a/users/yet-another-developer/.gitignore b/users/yet-another-developer/.gitignore new file mode 100644 index 000000000..d81556914 --- /dev/null +++ b/users/yet-another-developer/.gitignore @@ -0,0 +1,2 @@ +secrets.c +secrets.h \ No newline at end of file diff --git a/users/yet-another-developer/README.md b/users/yet-another-developer/README.md new file mode 100644 index 000000000..3e528bcf5 --- /dev/null +++ b/users/yet-another-developer/README.md @@ -0,0 +1,7 @@ +# User Space for yet-another-developer + + +## Reference / Inspiration + - /u/kuchosauronad0 + - /u/drashna + - /u/not-quite-neo \ No newline at end of file diff --git a/users/yet-another-developer/combo.c b/users/yet-another-developer/combo.c new file mode 100644 index 000000000..b4e8e84ae --- /dev/null +++ b/users/yet-another-developer/combo.c @@ -0,0 +1,27 @@ +#include "combo.h" + +void process_combo_event(uint8_t combo_index, bool pressed){ + switch(combo_index) { + case ZV_COPY: + if (pressed) { + tap_code16(LCTL(KC_C)); + } + break; + case XV_CUT: + if (pressed) { + tap_code16(LCTL(KC_X)); + } + break; + + case CV_PASTE: + if (pressed) { + tap_code16(LCTL(KC_V)); + } + break; + case QP_SLEEP: + if (pressed) { + tap_code16(KC_SYSTEM_SLEEP); + } + break; + } +} diff --git a/users/yet-another-developer/combo.h b/users/yet-another-developer/combo.h new file mode 100644 index 000000000..e2ff09ab5 --- /dev/null +++ b/users/yet-another-developer/combo.h @@ -0,0 +1,21 @@ +#pragma once +#include "quantum.h" +enum combo_events { + ZV_COPY, + XV_CUT, + CV_PASTE, + QP_SLEEP +}; + +const uint16_t PROGMEM copy_combo[] = {KC_Z, KC_V, COMBO_END}; +const uint16_t PROGMEM cut_combo[] = {KC_X, KC_V, COMBO_END}; +const uint16_t PROGMEM paste_combo[] = {KC_C, KC_V, COMBO_END}; +const uint16_t PROGMEM sleep_combo[] = {KC_Q, KC_P, COMBO_END}; + +combo_t key_combos[COMBO_COUNT] = { + [ZV_COPY] = COMBO_ACTION(copy_combo), + [XV_CUT] = COMBO_ACTION(cut_combo), + [CV_PASTE] = COMBO_ACTION(paste_combo), + [QP_SLEEP] = COMBO_ACTION(sleep_combo), +}; + diff --git a/users/yet-another-developer/config.h b/users/yet-another-developer/config.h new file mode 100644 index 000000000..d46d487fe --- /dev/null +++ b/users/yet-another-developer/config.h @@ -0,0 +1,56 @@ +#pragma once + +/* Set Polling rate to 1000Hz */ +#define USB_POLLING_INTERVAL_MS 1 + +#ifndef ONESHOT_TAP_TOGGLE + #define ONESHOT_TAP_TOGGLE 2 +#endif // !ONESHOT_TAP_TOGGLE + +#ifndef ONESHOT_TIMEOUT + #define ONESHOT_TIMEOUT 2000 +#endif // !ONESHOT_TIMEOUT + +#ifndef QMK_KEYS_PER_SCAN + #define QMK_KEYS_PER_SCAN 4 +#endif // !QMK_KEYS_PER_SCAN + +#if defined(LEADER_ENABLE) + #define LEADER_PER_KEY_TIMING + #define LEADER_TIMEOUT 250 +#endif // !LEADER_ENABLE + +#if defined(COMBO_ENABLE) + #define COMBO_COUNT 4 + #define COMBO_TERM 150 +#endif // !COMBO_ENABLE + +#if defined(NKRO_ENABLE) + #define FORCE_NKRO +#endif // !NKRO_ENABLE + +// this makes it possible to do rolling combos (zx) with keys that +// convert to other keys on hold (z becomes ctrl when you hold it, +// and when this option isn't enabled, z rapidly followed by x +// actually sends Ctrl-x. That's bad.) +#define IGNORE_MOD_TAP_INTERRUPT +#undef PERMISSIVE_HOLD +//#define TAPPING_FORCE_HOLD +//#define RETRO_TAPPING + +#ifndef TAPPING_TOGGLE + #define TAPPING_TOGGLE 1 +#endif + +#ifdef TAPPING_TERM +# undef TAPPING_TERM +#endif // !TAPPING_TERM +#if defined(KEYBOARD_ergodash) + #define TAPPING_TERM 240 +#else + #define TAPPING_TERM 200 +#endif + +#define TAP_CODE_DELAY 5 //DEFAULT: 100 + +#define MACRO_TIMER 5 diff --git a/users/yet-another-developer/leader.c b/users/yet-another-developer/leader.c new file mode 100644 index 000000000..3cbbf8d70 --- /dev/null +++ b/users/yet-another-developer/leader.c @@ -0,0 +1,46 @@ +#include "leader.h" + +LEADER_EXTERNS(); + +// Runs constantly in the background, in a loop. +void matrix_scan_user(void){ + +#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. +// run_diablo_macro_check(); +#endif // TAP_DANCE_ENABLE + +#ifdef RGBLIGHT_ENABLE + matrix_scan_rgb(); +#endif // RGBLIGHT_ENABLE + + LEADER_DICTIONARY() { + leading = false; + leader_end(); + + SEQ_TWO_KEYS(KC_V, KC_Z){ + // vim: Zoom pane + tap_code16(LCTL(KC_W)); + tap_code16(LSFT(KC_BSLS)); + } + + SEQ_TWO_KEYS(KC_V, KC_R) { + // vim: Substitute and place cursor + SEND_STRING(":%s///g" SS_TAP(X_LEFT)); + tap_code(KC_LEFT); + tap_code(KC_LEFT); + } + + SEQ_TWO_KEYS(KC_V, KC_T) { + // vim: move current pane to new tab + tap_code16(LCTL(KC_W)); + tap_code16(LSFT(KC_T)); + } + + SEQ_THREE_KEYS(KC_BSPC, KC_BSPC, KC_BSPC){ + // Reset the keyboard + reset_keyboard(); + } + } + + matrix_scan_keymap(); +} diff --git a/users/yet-another-developer/leader.h b/users/yet-another-developer/leader.h new file mode 100644 index 000000000..7ed6c8a82 --- /dev/null +++ b/users/yet-another-developer/leader.h @@ -0,0 +1,6 @@ +#pragma once +#include "yet-another-developer.h" + +#include "leader.h" + +void matrix_scan_user(void); diff --git a/users/yet-another-developer/process_records.c b/users/yet-another-developer/process_records.c new file mode 100644 index 000000000..c7dbd704a --- /dev/null +++ b/users/yet-another-developer/process_records.c @@ -0,0 +1,193 @@ +#include "yet-another-developer.h" + +uint16_t copy_paste_timer; + +__attribute__ ((weak)) +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + return true; +} + +__attribute__ ((weak)) +bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { + return true; +} + +// Defines actions for my global custom keycodes. Defined in yet-another-developer.h file +// Then runs the _keymap's record handier if not processed here +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + + // If console is enabled, it will print the matrix position and status of each key pressed +#ifdef KEYLOGGER_ENABLE + #if defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_keebio_iris_rev2) + xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.row, record->event.key.col, record->event.pressed); + #else + xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed); + #endif +#endif //KEYLOGGER_ENABLE + + switch (keycode) { + case KC_QWERTY ... KC_UNICODE: + if (record->event.pressed) { + set_single_persistent_default_layer(keycode - KC_QWERTY); + } + break; + + case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader + if (!record->event.pressed) { + clear_mods(); + clear_oneshot_mods(); + send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), TAP_CODE_DELAY); + { + send_string_with_delay_P(PSTR(":flash"), TAP_CODE_DELAY); + } + } + break; + + /* Tap Dance */ + case MC_QT1: // "" + if(record->event.pressed){ + SEND_STRING("\"\""); + tap_code(KC_LEFT); + } + break; + case MC_QT2: // '' + if(record->event.pressed){ + SEND_STRING("''"); + tap_code(KC_LEFT); + } + break; + case MC_QT3: // `' + if(record->event.pressed){ + SEND_STRING("`'"); + tap_code(KC_LEFT); + } + break; + case MC_PAR: // Parenthesis + if(record->event.pressed){ + SEND_STRING("()"); + tap_code(KC_LEFT); + } + break; + case MC_CUR: // Curly bracket + if(record->event.pressed){ + SEND_STRING("{}"); + tap_code(KC_LEFT); + } + break; + case MC_SQR: // Square bracket + if(record->event.pressed){ + SEND_STRING("[]"); + tap_code(KC_LEFT); + } + break; + case MC_ABR: // Angle bracket + if(record->event.pressed){ + SEND_STRING("<>"); + tap_code(KC_LEFT); + } + break; + case MCT_NEW: // New Tmux Session + if(record->event.pressed){ + SEND_STRING(":neww"); + tap_code(KC_ENT); + } + break; + case MCT_SH: // Tmux horizontal split + if(record->event.pressed){ + SEND_STRING("%"); + } + break; + case MCT_SV: // Tmux vertical split + if(record->event.pressed){ + SEND_STRING("\""); + } + break; + case MCT_ZM: // Tmux zoom + if(record->event.pressed){ + tap_code(KC_Z); + } + break; + case MCT_SCR: // Tmux scroll mode + if(record->event.pressed){ + tap_code(KC_PGUP); + } + break; + case MCT_UP: // Tmux up + break; + case MCT_DW: // Tmux down + break; + case MCT_LFT: // Tmux left + break; + case MCT_RGT: // Tmux right + tap_code(KC_RIGHT); + break; + case MCV_B: // Vim begin of line + if(record->event.pressed){ + tap_code(KC_0); + } + break; + case MCV_E: // Vim end of line + if(record->event.pressed){ + SEND_STRING(":vsplit"); + tap_code(KC_ENT); + } + break; + case MCT_F: // Vim for loop + if(record->event.pressed){ + SEND_STRING(":help"); + tap_code(KC_ENT); + } + break; + + case VRSN: // Prints firmware version + if (record->event.pressed) { + send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY); + } + break; + + + case KC_CCCV: // One key copy/paste + if (record->event.pressed) { + copy_paste_timer = timer_read(); + } else { + if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy + register_code(KC_LCTL); + tap_code(KC_C); + unregister_code(KC_LCTL); + } else { // Tap, paste + register_code(KC_LCTL); + tap_code(KC_V); + unregister_code(KC_LCTL); + } + } + break; +#ifdef UNICODE_ENABLE + case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻ + if (record->event.pressed) { + send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B"); + } + break; + case UC_TABL: // ┬─┬ノ( º _ ºノ) + if (record->event.pressed) { + send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 30CE 0029"); + } + break; + case UC_SHRG: // ¯\_(ツ)_/¯ + if (record->event.pressed) { + send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF"); + } + break; + case UC_DISA: // ಠ_ಠ + if (record->event.pressed) { + send_unicode_hex_string("0CA0 005F 0CA0"); + } + break; +#endif // UNICODE_ENABLE + } + + return process_record_keymap(keycode, record) && +#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) + process_record_user_rgb(keycode, record) && +#endif // RGBLIGHT_ENABLE + process_record_secrets(keycode, record); +} diff --git a/users/yet-another-developer/process_records.h b/users/yet-another-developer/process_records.h new file mode 100644 index 000000000..d4576f541 --- /dev/null +++ b/users/yet-another-developer/process_records.h @@ -0,0 +1,109 @@ +#pragma once +#include "yet-another-developer.h" + +#if defined(KEYMAP_SAFE_RANGE) +# define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE +#else +# define PLACEHOLDER_SAFE_RANGE SAFE_RANGE +#endif + +enum userspace_custom_keycodes { + VRSN = PLACEHOLDER_SAFE_RANGE, // Prints QMK Firmware and board info + KC_QWERTY, // Sets default layer to QWERTY + KC_COLEMAK, // Sets default layer to COLEMAK + KC_DVORAK, // Sets default layer to DVORAK + KC_WORKMAN, // Sets default layer to WORKMAN + KC_UNICODE, // Sets default layer to UNICOD + + KC_MAKE, // Run keyboard's customized make command + KC_SECRET_1, // test1 + KC_SECRET_2, // test2 + KC_SECRET_3, // test3 + KC_SECRET_4, // test4 + KC_SECRET_5, // test5 + KC_CCCV, // Hold to copy, tap to paste + KC_NUKE, // NUCLEAR LAUNCH DETECTED!!! + UC_FLIP, // (ಠ痊ಠ)┻━┻ + UC_TABL, // ┬─┬ノ( º _ ºノ) + UC_SHRG, // ¯\_(ツ)_/¯ + UC_DISA, // ಠ_ಠ + + MC_QT1, // "" + MC_QT2, // '' + MC_QT3, // `' + MC_PAR, // Parenthesis + MC_CUR, // Curly bracket + MC_SQR, // Square bracket + MC_ABR, // Angle bracket + MCT_NEW, // New Tmux Session + MCT_SH, // Tmux horizontal split + MCT_SV, // Tmux vertical split + MCT_ZM, // Tmux zoom + MCT_SCR, // Tmux scroll mode + MCT_UP, // Tmux up + MCT_DW, // Tmux down + MCT_LFT, // Tmux left + MCT_RGT, // Tmux right + MCV_B, // Vim begin of line + MCV_E, // Vim end of line + MCT_F, // Vim for loop + MCG_A, // Git add + MCG_C, // Git commit + MCG_P, // Git push + MCG_R, // Git revert + MCG_L, // Git log + MCG_S, // Git status + + NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes +}; + +bool process_record_secrets(uint16_t keycode, keyrecord_t *record); +bool process_record_keymap( uint16_t keycode, keyrecord_t *record); + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) +#define ADJUST MO(_ADJUST) +#define TG_MODS TG(_MODS) +#define OS_LWR OSL(_LOWER) +#define OS_RSE OSL(_RAISE) +#define OS_UNI OSL(_UNICODE) + +#define KC_SEC1 KC_SECRET_1 +#define KC_SEC2 KC_SECRET_2 +#define KC_SEC3 KC_SECRET_3 +#define KC_SEC4 KC_SECRET_4 +#define KC_SEC5 KC_SECRET_5 + +#define QWERTY KC_QWERTY +#define DVORAK KC_DVORAK +#define COLEMAK KC_COLEMAK +#define WORKMAN KC_WORKMAN +#define UNICODE KC_UNICODE + +#define KC_RESET RESET +#define KC_RST KC_RESET + +#define BK_LWER LT(_LOWER, KC_BSPC) +#define SP_LWER LT(_LOWER, KC_SPC) +#define DL_RAIS LT(_RAISE, KC_DEL) +#define ET_RAIS LT(_RAISE, KC_ENTER) + +/* OSM keycodes, to keep things clean and easy to change */ +#define KC_MLSF OSM(MOD_LSFT) +#define KC_MRSF OSM(MOD_RSFT) + +#define OS_LGUI OSM(MOD_LGUI) +#define OS_RGUI OSM(MOD_RGUI) +#define OS_LSFT OSM(MOD_LSFT) +#define OS_RSFT OSM(MOD_RSFT) +#define OS_LCTL OSM(MOD_LCTL) +#define OS_RCTL OSM(MOD_RCTL) +#define OS_LALT OSM(MOD_LALT) +#define OS_RALT OSM(MOD_RALT) +#define OS_MEH OSM(MOD_MEH) +#define OS_HYPR OSM(MOD_HYPR) + +#define ALT_APP ALT_T(KC_APP) + +#define UC_IRNY UC(0x2E2E) +#define UC_CLUE UC(0x203D) diff --git a/users/yet-another-developer/rules.mk b/users/yet-another-developer/rules.mk new file mode 100644 index 000000000..597df6d0b --- /dev/null +++ b/users/yet-another-developer/rules.mk @@ -0,0 +1,50 @@ +SRC += yet-another-developer.c \ + process_records.c + +LINK_TIME_OPTIMIZATION_ENABLE = yes +SPACE_CADET_ENABLE = no + +ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) + SRC += tap_dances.c +endif + +ifeq ($(strip $(COMBO_ENABLE)), yes) + SRC += combo.c +endif + + +ifeq ($(strip $(LEADER_ENABLE)), yes) + SRC += leader.c +endif + + +ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") + SRC += secrets.c +endif + + +ifeq ($(strip $(NO_SECRETS)), yes) + OPT_DEFS += -DNO_SECRETS +endif + + +ifeq ($(strip $(UNICODEMAP_ENABLE)), yes) + SRC += unicode.c +endif + + +ifeq ($(strip $(MACROS_ENABLED)), yes) + OPT_DEFS += -DMACROS_ENABLED +endif + + +ifdef CONSOLE_ENABLE + ifeq ($(strip $(KEYLOGGER_ENABLE)), yes) + OPT_DEFS += -DKEYLOGGER_ENABLE + endif +endif + + +ifeq ($(strip $(MAKE_BOOTLOADER)), yes) + OPT_DEFS += -DMAKE_BOOTLOADER +endif diff --git a/users/yet-another-developer/tap_dances.c b/users/yet-another-developer/tap_dances.c new file mode 100644 index 000000000..66dcc60fa --- /dev/null +++ b/users/yet-another-developer/tap_dances.c @@ -0,0 +1,55 @@ +#include "tap_dances.h" + +void td_parenthesis (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { +// SEND_STRING ("\("); + tap_code(KC_QUOT); + reset_tap_dance (state); + } + else if (state->count == 2) { + SEND_STRING("()" SS_TAP(X_LEFT)); + reset_tap_dance (state); + } + else if (state->count == 3) { + SEND_STRING("[]" SS_TAP(X_LEFT)); + reset_tap_dance (state); + } + else if (state->count == 4) { + SEND_STRING("{}" SS_TAP(X_LEFT)); + reset_tap_dance (state); + } + else if (state->count >= 5) { + SEND_STRING("<>" SS_TAP(X_LEFT)); + reset_tap_dance (state); + } +} + +void safe_reset(qk_tap_dance_state_t *state, void *user_data) { + if (state->count >= 3) { + // Reset the keyboard if you tap the key more than three times + reset_keyboard(); + reset_tap_dance(state); + } +} + +qk_tap_dance_action_t tap_dance_actions[] = { + [TD_RESET] = ACTION_TAP_DANCE_FN(safe_reset), + [TD_NUM1] = ACTION_TAP_DANCE_DOUBLE(KC_1, KC_4), + [TD_NUM2] = ACTION_TAP_DANCE_DOUBLE(KC_2, KC_5), + [TD_NUM3] = ACTION_TAP_DANCE_DOUBLE(KC_3, KC_6), + [TD_QT1] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, MC_QT1), + [TD_QT2] = ACTION_TAP_DANCE_DOUBLE(LSFT(KC_QUOT), MC_QT2), + [TD_QT3] = ACTION_TAP_DANCE_DOUBLE(KC_GRV, MC_QT3), + + [TD_EOL] = ACTION_TAP_DANCE_DOUBLE(KC_E, MC_EOL), // end of line + [TD_BOL] = ACTION_TAP_DANCE_DOUBLE(KC_A, MC_BOL), // beginning of line + [TD_NW] = ACTION_TAP_DANCE_DOUBLE(KC_F, MC_NW), // next word + [TD_PW] = ACTION_TAP_DANCE_DOUBLE(KC_B, MC_PW), // pevious word + [TD_DW] = ACTION_TAP_DANCE_DOUBLE(KC_W, MC_DW), // pevious word + + [TD_SPC] = ACTION_TAP_DANCE_FN(td_parenthesis), // \(, (), [], {}, <> + [TD_PAR] = ACTION_TAP_DANCE_DOUBLE(KC_LPRN, MC_PAR), // () + [TD_SQR] = ACTION_TAP_DANCE_DOUBLE(KC_LBRC, MC_SQR), // [] + [TD_CUR] = ACTION_TAP_DANCE_DOUBLE(LSFT(KC_LCBR), MC_CUR),// {} + [TD_ABR] = ACTION_TAP_DANCE_DOUBLE(LSFT(KC_COMM), MC_ABR),// +}; diff --git a/users/yet-another-developer/tap_dances.h b/users/yet-another-developer/tap_dances.h new file mode 100644 index 000000000..8afda817c --- /dev/null +++ b/users/yet-another-developer/tap_dances.h @@ -0,0 +1,26 @@ +#pragma once +#include "yet-another-developer.h" + +#ifdef TAP_DANCE_ENABLE +enum { + TD_RESET = 0, + TD_SPC, // for special function td_parenthesis testing + TD_NUM1, // compact gaming numpad + TD_NUM2, // + TD_NUM3, // + TD_TMX, // tmux control sequence + TD_EOL, // end of line + TD_BOL, // beginning of line + TD_NW, // next word + TD_PW, // pevious word + TD_DW, // delete word + TD_QT1, // single double quote for ' + TD_QT2, // single double quote for " + TD_QT3, // single double quote for ` + TD_PAR, // single double parenthesis + TD_CUR, // single double curly braces + TD_SQR, // single double square brackets + TD_ABR // single double angle brackets +}; +#endif // TAP_DANCE_ENABLE +void td_parenthesis (qk_tap_dance_state_t *state, void *user_data); diff --git a/users/yet-another-developer/unicode.c b/users/yet-another-developer/unicode.c new file mode 100644 index 000000000..8b312deb6 --- /dev/null +++ b/users/yet-another-developer/unicode.c @@ -0,0 +1,62 @@ +#include "unicode.h" + +//#ifdef UNICODEMAP_ENABLE +const uint32_t PROGMEM unicode_map[] = { + [BANG] = 0x0203D,// ‽ + [IRONY] = 0x02E2E,// ⸮ + [DEGREE] = 0x000B0,// ° + [THINK] = 0x1F914,// 🤔 + [GRIN] = 0x1F600,// � + [MONOCL] = 0x1F9D0,// 🧐 + [DRUG0] = 0x1F92A,// 🤪 + [DRUG1] = 0x1F974,// 🥴 + [CLOWN] = 0x1F921,// 🤡 + [MNDBLWN] = 0x1F92F,// 🤯 + [MONEY] = 0x1F911,// 🤑 + [SHTUP] = 0x1F910,// 🤐 + [PARTY] = 0x1F973,// 🥳 + [SMRK] = 0x1F60F,// 😏 + [WEARY] = 0x1F629,// 😩 + [UNAMU] = 0x1F612,// 😒 + [SPY] = 0x1F575,//🕵 + [DAFUQ] = 0x1F47A,// 👺 + [FIST0] = 0x1F91B,// 🤛 + [FIST1] = 0x1F91C,// 🤜 + [FIST2] = 0x270A, // ✊ + [FIST3] = 0x1F44A,// 👊 + [WIFIHAND] = 0x1F44B,// 👋 + [OKOK] = 0x1F44C,// 👌 + [EFFU] = 0x1F595,// 🖕 + [SPOCK] = 0x1F596,// 🖖 + [INUP] = 0x1F446,// 👆 + [THDN] = 0x1F44E,// 👎 + [THUP] = 0x1F44D,// 👍 + [TUMBLER] = 0x1F943,// 🥃 + [DRAGON0] = 0x1F409,// 🐉 + [DRAGON1] = 0x1F432,// 🐲 + [TIGER0] = 0x1F405,// 🐅 + [TIGER1] = 0x1F42F,// 🐯 + [COOL] = 0x1F192,// 🆒 + [UCHART] = 0x1F4C8,// 📈 + [DCHART] = 0x1F4C9,// 📉 + [BCHART] = 0x1F4CA,// 📊 + [NOPRCY] = 0x1F572,// 🕲 + [PRCY] = 0x1F571,// 🕱 + [BBB] = 0x1F171,// 🅱 + [POO] = 0x1F4A9,// 💩 + [HUNDR] = 0x1F4AF,// 💯 + [EGGPL] = 0x1F346,// 🍆 + [WATER] = 0x1F4A6,// 💦 + [LIT] = 0x1F525,// 🔥 + [SNEK] = 0x1F40D,// 🐍 + [PENGUIN] = 0x1F427,// 🐧 + [BOAR] = 0x1F417,// 🐗 + [MONKEY] = 0x1F412,// 🐒 + [CHICK] = 0x1F425,// 🐥 + [DASH] = 0x1F4A8,// 💨 + [DIZZY] = 0x1F4AB,// 💫 + [KEEB] = 0x1F5AE,// 🖮 + [HOLE] = 0x1F573,// 🕳 + [SAUCER] = 0x1F6F8// 🛸 + }; +//#endif // UNICODEMAP_ENABLE diff --git a/users/yet-another-developer/unicode.h b/users/yet-another-developer/unicode.h new file mode 100644 index 000000000..cb550243e --- /dev/null +++ b/users/yet-another-developer/unicode.h @@ -0,0 +1,67 @@ +#pragma once + +#include "quantum.h" + +void send_unicode_hex_string(const char* str); + +/* use X(n) to call the */ +#ifdef UNICODEMAP_ENABLE +enum unicode_name { +OKOK, // +BANG, // ‽ +IRONY, // ⸮ +DEGREE, // ° +THINK, // 🤔 +GRIN, // � +MONOCL, // 🧐 +DRUG0, // 🤪 +DRUG1, // 🥴 +CLOWN, // 🤡 +MNDBLWN, // 🤯 +MONEY, // 🤑 +SHTUP, // 🤐 +PARTY, // 🥳 +SMRK, // 😏 +WEARY, // 😩 +UNAMU, // 😒 +SPY, // 🕵 +DAFUQ, // 👺 +FIST0, // 🤛 +FIST1, // 🤜 +FIST2, // ✊ +FIST3, // 👊 +WIFIHAND, // 👌 +EFFU, // 🖕 +SPOCK, // 🖖 +INUP, // 👆 +THDN, // 👎 +THUP, // 👍 +TUMBLER, // 🥃 +DRAGON0, // 🐉 +DRAGON1, // 🐅 +TIGER0, // 🐅 +TIGER1, // 🐯 +COOL, // 🆒 +UCHART, // 📈 +DCHART, // 📉 +BCHART, // 📊 +NOPRCY, // 🕲 +PRCY, // 🕱 +BBB, // 🅱 +POO, // 💩 +HUNDR, // 💯 +EGGPL, // 🍆 +WATER, // 💦 +LIT, // 🔥 +SNEK, // 🐍 +PENGUIN, // 🐧 +BOAR, // 🐗 +MONKEY, // 🐒 +CHICK, // 🐥 +DASH, // 💨 +DIZZY, // 💫 +KEEB, // 🖮 +HOLE, // 🕳 +SAUCER // 🛸 +}; +#endif diff --git a/users/yet-another-developer/wrappers.h b/users/yet-another-developer/wrappers.h new file mode 100644 index 000000000..cd21032a4 --- /dev/null +++ b/users/yet-another-developer/wrappers.h @@ -0,0 +1,166 @@ +#pragma once +#include "yet-another-developer.h" + +/* +Since our quirky block definitions are basically a list of comma separated +arguments, we need a wrapper in order for these definitions to be +expanded before being used as arguments to the LAYOUT_xxx macro. +*/ +#if (!defined(LAYOUT) && defined(KEYMAP)) +# define LAYOUT KEYMAP +#endif + +// clang-format off + +#define KEYMAP_wrapper(...) LAYOUT(__VA_ARGS__) +#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) +#define LAYOUT_ortho_5x14_wrapper(...) LAYOUT_ortho_5x14(__VA_ARGS__) + +/* ---------- LEFT HAND ----------- ---------- RIGHT HAND ---------- */ +#define LAYOUT_ergodash_pretty( \ + L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06, \ + L10, L11, L12, L13, L14, L15, L16, R10, R11, R12, R13, R14, R15, R16, \ + L20, L21, L22, L23, L24, L25, L26, R20, R21, R22, R23, R24, R25, R26, \ + L30, L31, L32, L33, L34, L35, R31, R32, R33, R34, R35, R36, \ + L40, L41, L42, L43, R43, R44, R45, R46, \ + L36, R30, \ + L44, L45, L46, R40, R41, R42 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05, L06 }, \ + { L10, L11, L12, L13, L14, L15, L16 }, \ + { L20, L21, L22, L23, L24, L25, L26 }, \ + { L30, L31, L32, L33, L34, L35, L36 }, \ + { L40, L41, L42, L43, L44, L45, L46 }, \ + { R06, R05, R04, R03, R02, R01, R00 }, \ + { R16, R15, R14, R13, R12, R11, R10 }, \ + { R26, R25, R24, R23, R22, R21, R20 }, \ + { R36, R35, R34, R33, R32, R31, R30 }, \ + { R46, R45, R44, R43, R42, R41, R40 } \ + } + +/* +Blocks for each of the four major keyboard layouts +Organized so we can quickly adapt and modify all of them +at once, rather than for each keyboard, one at a time. +And this allows for much cleaner blocks in the keymaps. +For instance Tap/Hold for Control on all of the layouts + +NOTE: These are all the same length. If you do a search/replace + then you need to add/remove underscores to keep the + lengths consistent. +*/ + +#define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T +#define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G +#define _________________QWERTY_L3_________________ KC_Z, KC_X, KC_C, KC_V, KC_B + +#define _________________QWERTY_R1_________________ KC_Y, KC_U, KC_I, KC_O, KC_P +#define _________________QWERTY_R2_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN +#define _________________QWERTY_R3_________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLASH + + +#ifdef TAP_DANCE_ENABLE + #define _________________COLEMAK_L1________________ KC_Q, KC_W, KC_F, KC_P, KC_G + #define _________________COLEMAK_L2________________ KC_BOL, KC_R, KC_S, KC_T, KC_D + #define _________________COLEMAK_L3________________ KC_Z, KC_X, KC_C, KC_V, KC_B + + #define _________________COLEMAK_R1________________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN + #define _________________COLEMAK_R2________________ KC_H, KC_N, KC_E, KC_I, KC_O + #define _________________COLEMAK_R3________________ KC_K, KC_M, KC_COMM, KC_DOT, KC_SLASH +#else + #define _________________COLEMAK_L1________________ KC_Q, KC_W, KC_F, KC_P, KC_G + #define _________________COLEMAK_L2________________ KC_A, KC_R, KC_S, KC_T, KC_D + #define _________________COLEMAK_L3________________ KC_Z, KC_X, KC_C, KC_V, KC_B + + #define _________________COLEMAK_R1________________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN + #define _________________COLEMAK_R2________________ KC_H, KC_N, KC_E, KC_I, KC_O + #define _________________COLEMAK_R3________________ KC_K, KC_M, KC_COMM, KC_DOT, KC_SLASH +#endif + + + + +#define _________________DVORAK_L1_________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y +#define _________________DVORAK_L2_________________ KC_A, KC_O, KC_E, KC_U, KC_I +#define _________________DVORAK_L3_________________ KC_SCLN, KC_Q, KC_J, KC_K, KC_X + +#define _________________DVORAK_R1_________________ KC_F, KC_G, KC_C, KC_R, KC_L +#define _________________DVORAK_R2_________________ KC_D, KC_H, KC_T, KC_N, KC_S +#define _________________DVORAK_R3_________________ KC_B, KC_M, KC_W, KC_V, KC_Z + + +#define _________________WORKMAN_L1________________ KC_Q, KC_D, KC_R, KC_W, KC_B +#define _________________WORKMAN_L2________________ KC_A, KC_S, KC_H, KC_T, KC_G +#define _________________WORKMAN_L3________________ KC_Z, KC_X, KC_M, KC_C, KC_V + +#define _________________WORKMAN_R1________________ KC_J, KC_F, KC_U, KC_P, KC_SCLN +#define _________________WORKMAN_R2________________ KC_Y, KC_N, KC_E, KC_O, KC_I +#define _________________WORKMAN_R3________________ KC_K, KC_L, KC_COMM, KC_DOT, KC_SLASH + +// #define _________________WHITE_R1__________________ KC_V, KC_Y, KC_D, KC_COMM, KC_QUOT +// #define _________________WHITE_R2__________________ KC_A, KC_T, KC_H, KC_E, KC_B +// #define _________________WHITE_R3__________________ KC_P, KC_K, KC_G, KC_W, KC_Q + +// #define _________________WHITE_L1__________________ KC_INT1, KC_J, KC_M, KC_L, KC_U +// #define _________________WHITE_L2__________________ KC_MINS, KC_C, KC_S, KC_N, KC_O // KC_I +// #define _________________WHITE_L3__________________ KC_X, KC_R, KC_F, KC_DOT, KC_Z + + +#ifdef UNICODE_ENABLE +#define _______________UNICODE_L1__________________ UC_DISA,UC_DISA, UC_DISA, UC_DISA, UC_DISA +#define _______________UNICODE_L2__________________ UC_DISA,UC_DISA, UC_DISA, UC_DISA, UC_DISA +#define _______________UNICODE_L3__________________ UC_DISA,UC_DISA, UC_DISA, UC_DISA, UC_DISA + +#define _______________UNICODE_R1__________________ UC_SHRG, UC_SHRG, UC_SHRG, UC_SHRG, UC_SHRG +#define _______________UNICODE_R2__________________ UC_SHRG, UC_SHRG, UC_SHRG, UC_SHRG, UC_SHRG +#define _______________UNICODE_R3__________________ UC_SHRG, UC_SHRG, UC_SHRG, UC_SHRG, UC_SHRG +#endif + +#ifdef UNICODEMAP_ENABLE +#define _______________UNICODE_L1__________________ X(SMRK), X(THINK), X(CLOWN), X(HUNDR), X(BANG) +#define _______________UNICODE_L2__________________ X(GRIN), X(MONKEY), X(OKOK), X(EGGPL), X(LIT) +#define _______________UNICODE_L3__________________ X(WEARY), X(UNAMU), X(EFFU), X(MONOCL), X(IRONY) + +#define _______________UNICODE_R1__________________ X(DRUG0), X(THUP), X(INUP), X(DIZZY), X(COOL) +#define _______________UNICODE_R2__________________ X(FIST0), X(FIST2),X(FIST3),X(FIST1), X(OKOK) +#define _______________UNICODE_R3__________________ X(MNDBLWN), X(THDN), X(SPOCK),X(HOLE), X(DASH) +#endif + +#define ________________NUMBER_LEFT________________ KC_1, KC_2, KC_3, KC_4, KC_5 +#define ________________NUMBER_RIGHT_______________ KC_6, KC_7, KC_8, KC_9, KC_0 +#define _________________FUNC_LEFT_________________ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5 +#define _________________FUNC_RIGHT________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10 + +#define ___________________BLANK___________________ _______, _______, _______, _______, _______ + + +#define _________________LOWER_L1__________________ KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC +#define _________________LOWER_L2__________________ _________________FUNC_LEFT_________________ +#define _________________LOWER_L3__________________ _________________FUNC_RIGHT________________ + +#define _________________LOWER_R1__________________ KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN +#define _________________LOWER_R2__________________ OS_UNI, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR +#define _________________LOWER_R3__________________ _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + + + +#define _________________RAISE_L1__________________ ________________NUMBER_LEFT________________ +#define _________________RAISE_L2__________________ ___________________BLANK___________________ +#define _________________RAISE_L3__________________ ___________________BLANK___________________ + +#define _________________RAISE_R1__________________ ________________NUMBER_RIGHT_______________ +#define _________________RAISE_R2__________________ _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC +#define _________________RAISE_R3__________________ _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END + + + +#define _________________ADJUST_L1_________________ ___________________BLANK___________________ +#define _________________ADJUST_L2_________________ _________________FUNC_LEFT_________________ +#define _________________ADJUST_L3_________________ _______, QWERTY, COLEMAK, DVORAK, WORKMAN + +#define _________________ADJUST_R1_________________ KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5 +#define _________________ADJUST_R2_________________ _________________FUNC_RIGHT________________ +#define _________________ADJUST_R3_________________ KC_MUTE, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT + +// clang-format on diff --git a/users/yet-another-developer/yet-another-developer.c b/users/yet-another-developer/yet-another-developer.c new file mode 100644 index 000000000..b729c0621 --- /dev/null +++ b/users/yet-another-developer/yet-another-developer.c @@ -0,0 +1,160 @@ +#include "quantum.h" +#include "yet-another-developer.h" + +userspace_config_t userspace_config; + +#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) + #define YAD_UNICODE_MODE UC_WIN +#else +// set to 2 for UC_WIN, set to 4 for UC_WINC + #define YAD_UNICODE_MODE 2 +#endif + + +bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed) { + static uint16_t this_timer; + if (pressed) { + this_timer = timer_read(); + } else { + if (timer_elapsed(this_timer) < TAPPING_TERM) { + tap_code(code); + } else { + register_code(mod_code); + tap_code(code); + unregister_code(mod_code); + } + } + return false; +} + +bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer) { + if (pressed) { + this_timer = timer_read(); + } else { + if (timer_elapsed(this_timer) < TAPPING_TERM) { + tap_code(code); + } else { + register_code(mod_code); + tap_code(code); + unregister_code(mod_code); + } + } + return false; +} + +// Add reconfigurable functions here, for keymap customization +// This allows for a global, userspace functions, and continued +// customization of the keymap. Use _keymap instead of _user +// functions in the keymaps +__attribute__ ((weak)) +void matrix_init_keymap(void) {} + +// Call user matrix init, set default RGB colors and then +// call the keymap's init function +void matrix_init_user(void) { + userspace_config.raw = eeconfig_read_user(); + + #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) + set_unicode_input_mode(YAD_UNICODE_MODE); + get_unicode_input_mode(); + #endif //UNICODE_ENABLE + + matrix_init_keymap(); +} + +__attribute__((weak)) +void keyboard_post_init_keymap(void) {} + +void keyboard_post_init_user(void) { +#ifdef RGBLIGHT_ENABLE + keyboard_post_init_rgb(); +#endif + keyboard_post_init_keymap(); +} + +__attribute__((weak)) +void suspend_power_down_keymap(void) {} + +void suspend_power_down_user(void) { + suspend_power_down_keymap(); +} + +__attribute__((weak)) +void suspend_wakeup_init_keymap(void) {} + +void suspend_wakeup_init_user(void) { + suspend_wakeup_init_keymap(); +} + +__attribute__((weak)) +void matrix_scan_keymap(void) {} + +__attribute__ ((weak)) +void matrix_scan_user(void){ + +#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. +// run_diablo_macro_check(); +#endif // TAP_DANCE_ENABLE + +#ifdef RGBLIGHT_ENABLE + matrix_scan_rgb(); +#endif // RGBLIGHT_ENABLE + + matrix_scan_keymap(); +} + +__attribute__((weak)) +layer_state_t layer_state_set_keymap(layer_state_t state) { + return state; +} + +// on layer change, no matter where the change was initiated +// Then runs keymap's layer change check +layer_state_t layer_state_set_user(layer_state_t state) { + state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); +#ifdef RGBLIGHT_ENABLE + state = layer_state_set_rgb(state); +#endif // RGBLIGHT_ENABLE + return layer_state_set_keymap(state); +} + +__attribute__((weak)) +layer_state_t default_layer_state_set_keymap(layer_state_t state) { + return state; +} + +// Runs state check and changes underglow color and animation +layer_state_t default_layer_state_set_user(layer_state_t state) { + state = default_layer_state_set_keymap(state); +#if 0 +#ifdef RGBLIGHT_ENABLE + state = default_layer_state_set_rgb(state); +#endif // RGBLIGHT_ENABLE +#endif + return state; +} + +__attribute__ ((weak)) +void led_set_keymap(uint8_t usb_led) {} + +// Any custom LED code goes here. +// So far, I only have keyboard specific code, +// So nothing goes here. +void led_set_user(uint8_t usb_led) { + led_set_keymap(usb_led); +} + +__attribute__ ((weak)) +void eeconfig_init_keymap(void) {} + +void eeconfig_init_user(void) { + userspace_config.raw = 0; + userspace_config.rgb_layer_change = true; + eeconfig_update_user(userspace_config.raw); + #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) + set_unicode_input_mode(YAD_UNICODE_MODE); + get_unicode_input_mode(); + #else + eeprom_update_byte(EECONFIG_UNICODEMODE, YAD_UNICODE_MODE); + #endif +} diff --git a/users/yet-another-developer/yet-another-developer.h b/users/yet-another-developer/yet-another-developer.h new file mode 100644 index 000000000..e0d02f707 --- /dev/null +++ b/users/yet-another-developer/yet-another-developer.h @@ -0,0 +1,87 @@ +#pragma once +#include "quantum.h" +#include "version.h" +#include "eeprom.h" +#include "wrappers.h" +#include "process_records.h" + +#ifdef TAP_DANCE_ENABLE + #include "tap_dances.h" + #define KC_TMX TD(TD_TMX) // tap1: 't' tap2: +b + #define KC_EOL TD(TD_EOL) // tap1: 'e' tap2: +e + #define KC_BOL TD(TD_BOL) // tap1: 'a' tap2: +a + #define KC_NW TD(TD_NW) // tap1: 'f' tap2: +f + #define KC_PW TD(TD_PW) // tap1: 'b' tap2: +b + #define KC_DW TD(TD_DW) // tap1: 'w' tap2: +w +#endif //!TAP_DANCE_ENABLE +#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) + #include "rgb_stuff.h" +#endif +#if defined(UNICODEMAP_ENABLE) || defined(UNICODE_ENABLE) + #include "unicode.h" +#endif //!UNICODE_ENABLE + +#define MC_BOL LCTL(KC_A) // jump to beginning of line +#define MC_EOL LCTL(KC_E) // jump to end of line +#define MC_NW LALT(KC_F) // next word +#define MC_PW LALT(KC_B) // previous word +#define MC_DW LCTL(KC_W) // delete word + +/* Define layer names */ +enum userspace_layers { + _QWERTY = 0, + _NUMLOCK = 0, + _COLEMAK, + _DVORAK, + _WORKMAN, + _UNICODE, + _MODS, /* layer 8 */ + _MACROS, + _MEDIA, + _LOWER, + _RAISE, + _ADJUST, +}; + +bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed); +bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer); +void matrix_init_keymap(void); +void suspend_power_down_keymap(void); +void suspend_wakeup_init_keymap(void); +void matrix_scan_keymap(void); +layer_state_t layer_state_set_keymap(layer_state_t state); +layer_state_t default_layer_state_set_keymap(layer_state_t state); +void led_set_keymap(uint8_t usb_led); +void eeconfig_init_keymap(void); + +typedef union { + uint32_t raw; + struct { + bool rgb_layer_change :1; + bool is_overwatch :1; + bool nuke_switch :1; + uint8_t unicode_mod :4; + bool swapped_numbers :1; + }; +} userspace_config_t; + +extern userspace_config_t userspace_config; + +/* +Custom Keycodes for Diablo 3 layer +But since TD() doesn't work when tap dance is disabled +We use custom codes here, so we can substitute the right stuff +*/ +#ifdef TAP_DANCE_ENABLE +#define KC_D3_1 TD(TD_D3_1) +#define KC_D3_2 TD(TD_D3_2) +#define KC_D3_3 TD(TD_D3_3) +#define KC_D3_4 TD(TD_D3_4) +#else // TAP_DANCE_ENABLE +#define KC_D3_1 KC_1 +#define KC_D3_2 KC_2 +#define KC_D3_3 KC_3 +#define KC_D3_4 KC_4 +#endif // TAP_DANCE_ENABLE + +