diff options
| -rw-r--r-- | users/pcoves/.gitignore | 2 | ||||
| -rw-r--r-- | users/pcoves/combo.c | 44 | ||||
| -rw-r--r-- | users/pcoves/config.h | 2 | ||||
| -rw-r--r-- | users/pcoves/pcoves.c | 44 | ||||
| -rw-r--r-- | users/pcoves/pcoves.h | 32 | ||||
| -rw-r--r-- | users/pcoves/rainbowUnicorn.c | 42 | ||||
| -rw-r--r-- | users/pcoves/rainbowUnicorn.h | 5 | ||||
| -rw-r--r-- | users/pcoves/readme.md | 14 | ||||
| -rw-r--r-- | users/pcoves/rules.mk | 30 | ||||
| -rw-r--r-- | users/pcoves/tapDance.c | 127 | ||||
| -rw-r--r-- | users/pcoves/tapDance.h | 8 | ||||
| -rw-r--r-- | users/pcoves/unicode.c | 20 | ||||
| -rw-r--r-- | users/pcoves/unicode.h | 5 |
13 files changed, 375 insertions, 0 deletions
diff --git a/users/pcoves/.gitignore b/users/pcoves/.gitignore new file mode 100644 index 000000000..c0579ed32 --- /dev/null +++ b/users/pcoves/.gitignore | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | secret.h | ||
| 2 | secret.c | ||
diff --git a/users/pcoves/combo.c b/users/pcoves/combo.c new file mode 100644 index 000000000..a9a1ffe98 --- /dev/null +++ b/users/pcoves/combo.c | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | #include "quantum.h" | ||
| 2 | |||
| 3 | enum { | ||
| 4 | MIN, | ||
| 5 | EQL, | ||
| 6 | |||
| 7 | ESC, | ||
| 8 | BSP, | ||
| 9 | DEL, | ||
| 10 | |||
| 11 | TAB, | ||
| 12 | BSL, | ||
| 13 | |||
| 14 | CUT, | ||
| 15 | GRA, | ||
| 16 | }; | ||
| 17 | |||
| 18 | const uint16_t PROGMEM min[] = {KC_C, KC_V, COMBO_END}; | ||
| 19 | const uint16_t PROGMEM eql[] = {KC_M, KC_COMM, COMBO_END}; | ||
| 20 | |||
| 21 | const uint16_t PROGMEM esc[] = {KC_D, KC_F, COMBO_END}; | ||
| 22 | const uint16_t PROGMEM bsp[] = {KC_J, KC_K, COMBO_END}; | ||
| 23 | const uint16_t PROGMEM del[] = {KC_DOWN, KC_UP, COMBO_END}; | ||
| 24 | |||
| 25 | const uint16_t PROGMEM tab[] = {KC_S, KC_F, COMBO_END}; | ||
| 26 | const uint16_t PROGMEM bsl[] = {KC_J, KC_L, COMBO_END}; | ||
| 27 | |||
| 28 | const uint16_t PROGMEM cut[] = {KC_K, KC_L, COMBO_END}; | ||
| 29 | const uint16_t PROGMEM gra[] = {KC_S, KC_D, COMBO_END}; | ||
| 30 | |||
| 31 | combo_t key_combos[COMBO_COUNT] = { | ||
| 32 | [MIN] = COMBO(min, KC_MINS), | ||
| 33 | [EQL] = COMBO(eql, KC_EQL), | ||
| 34 | |||
| 35 | [ESC] = COMBO(esc, KC_ESC), | ||
| 36 | [BSP] = COMBO(bsp, KC_BSPC), | ||
| 37 | [DEL] = COMBO(del, KC_DEL), | ||
| 38 | |||
| 39 | [TAB] = COMBO(tab, KC_TAB), | ||
| 40 | [BSL] = COMBO(bsl, KC_BSLS), | ||
| 41 | |||
| 42 | [CUT] = COMBO(cut, KC_QUOT), | ||
| 43 | [GRA] = COMBO(gra, KC_GRAVE), | ||
| 44 | }; | ||
diff --git a/users/pcoves/config.h b/users/pcoves/config.h new file mode 100644 index 000000000..645dcbbf4 --- /dev/null +++ b/users/pcoves/config.h | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | #define COMBO_TERM 200 | ||
| 2 | #define COMBO_COUNT 9 | ||
diff --git a/users/pcoves/pcoves.c b/users/pcoves/pcoves.c new file mode 100644 index 000000000..af5b987a6 --- /dev/null +++ b/users/pcoves/pcoves.c | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | #include "pcoves.h" | ||
| 2 | |||
| 3 | #ifdef RAINBOW_UNICORN_ENABLE | ||
| 4 | #include "rainbowUnicorn.h" | ||
| 5 | #endif | ||
| 6 | |||
| 7 | #ifdef UNICODE_ENABLE | ||
| 8 | #include "unicode.h" | ||
| 9 | #endif | ||
| 10 | |||
| 11 | #if SECRET_ENABLE | ||
| 12 | #include "secret.h" | ||
| 13 | #endif | ||
| 14 | |||
| 15 | __attribute__((weak)) void eeconfig_init_keymap(void) {} | ||
| 16 | |||
| 17 | void eeconfig_init_user(void) { | ||
| 18 | #ifdef UNICODE_ENABLE | ||
| 19 | set_unicode_input_mode(UC_LNX); | ||
| 20 | #endif | ||
| 21 | eeconfig_init_keymap(); | ||
| 22 | } | ||
| 23 | |||
| 24 | __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } | ||
| 25 | |||
| 26 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 27 | switch (keycode) { | ||
| 28 | case AUTRUCHE: | ||
| 29 | if (record->event.pressed) SEND_STRING("Autruche"); | ||
| 30 | return true; | ||
| 31 | } | ||
| 32 | |||
| 33 | return process_record_keymap(keycode, record) | ||
| 34 | #ifdef RAINBOW_UNICORN_ENABLE | ||
| 35 | && process_record_rainbowUnicorn(keycode, record) | ||
| 36 | #endif | ||
| 37 | #ifdef UNICODE_ENABLE | ||
| 38 | && process_record_unicode(keycode, record) | ||
| 39 | #endif | ||
| 40 | #if SECRET_ENABLE | ||
| 41 | && process_record_secret(keycode, record) | ||
| 42 | #endif | ||
| 43 | ; | ||
| 44 | } | ||
diff --git a/users/pcoves/pcoves.h b/users/pcoves/pcoves.h new file mode 100644 index 000000000..10dfc56bd --- /dev/null +++ b/users/pcoves/pcoves.h | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "quantum.h" | ||
| 4 | |||
| 5 | #define SECRET_ENABLE (__has_include("secret.h") && !defined(NO_SECRET)) | ||
| 6 | |||
| 7 | enum { | ||
| 8 | AUTRUCHE = SAFE_RANGE, | ||
| 9 | #ifdef RAINBOW_UNICORN_ENABLE | ||
| 10 | RAINBOW_UNICORN_TOGGLE, | ||
| 11 | #endif | ||
| 12 | #ifdef UNICODE_ENABLE | ||
| 13 | EMOTE0, | ||
| 14 | EMOTE1, | ||
| 15 | EMOTE2, | ||
| 16 | EMOTE3, | ||
| 17 | #endif | ||
| 18 | #if SECRET_ENABLE | ||
| 19 | SECRET0, | ||
| 20 | SECRET1, | ||
| 21 | SECRET2, | ||
| 22 | SECRET3, | ||
| 23 | SECRET4, | ||
| 24 | #endif | ||
| 25 | PCOVES_SAFE_RANGE, | ||
| 26 | }; | ||
| 27 | |||
| 28 | __attribute__((weak)) void eeconfig_init_keymap(void); | ||
| 29 | void eeconfig_init_user(void); | ||
| 30 | |||
| 31 | __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record); | ||
| 32 | bool process_record_user(uint16_t keycode, keyrecord_t *record); | ||
diff --git a/users/pcoves/rainbowUnicorn.c b/users/pcoves/rainbowUnicorn.c new file mode 100644 index 000000000..952041505 --- /dev/null +++ b/users/pcoves/rainbowUnicorn.c | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | #include "rainbowUnicorn.h" | ||
| 2 | #include "pcoves.h" | ||
| 3 | |||
| 4 | static struct { | ||
| 5 | bool enabled; | ||
| 6 | uint8_t color; | ||
| 7 | char string[2]; | ||
| 8 | uint8_t mods; | ||
| 9 | } state = {false, 0}; | ||
| 10 | |||
| 11 | bool process_record_rainbowUnicorn(uint16_t keycode, keyrecord_t* record) { | ||
| 12 | if (keycode == RAINBOW_UNICORN_TOGGLE) { | ||
| 13 | state.enabled ^= true; | ||
| 14 | return false; | ||
| 15 | } | ||
| 16 | |||
| 17 | if (!state.enabled) return true; | ||
| 18 | |||
| 19 | switch (keycode) { | ||
| 20 | case KC_A ... KC_Z: | ||
| 21 | case KC_1 ... KC_0: | ||
| 22 | case ALT_T(KC_A)... ALT_T(KC_Z): | ||
| 23 | case CTL_T(KC_A)... CTL_T(KC_Z): | ||
| 24 | case GUI_T(KC_A)... GUI_T(KC_Z): | ||
| 25 | case SFT_T(KC_A)... SFT_T(KC_Z): | ||
| 26 | if (record->event.pressed) { | ||
| 27 | state.mods = get_mods(); | ||
| 28 | clear_mods(); | ||
| 29 | |||
| 30 | tap_code16(C(KC_C)); | ||
| 31 | |||
| 32 | itoa(state.color + 3, state.string, 10); | ||
| 33 | send_string(state.string); | ||
| 34 | |||
| 35 | set_mods(state.mods); | ||
| 36 | } else { | ||
| 37 | state.color = (state.color + 1) % 11; | ||
| 38 | } | ||
| 39 | } | ||
| 40 | |||
| 41 | return true; | ||
| 42 | } | ||
diff --git a/users/pcoves/rainbowUnicorn.h b/users/pcoves/rainbowUnicorn.h new file mode 100644 index 000000000..0c709b4b7 --- /dev/null +++ b/users/pcoves/rainbowUnicorn.h | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "quantum.h" | ||
| 4 | |||
| 5 | __attribute__((weak)) bool process_record_rainbowUnicorn(uint16_t keycode, keyrecord_t* keyrecord); | ||
diff --git a/users/pcoves/readme.md b/users/pcoves/readme.md new file mode 100644 index 000000000..1d076d92f --- /dev/null +++ b/users/pcoves/readme.md | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | Copyright 2020 @pcoves | ||
| 2 | |||
| 3 | This program is free software: you can redistribute it and/or modify | ||
| 4 | it under the terms of the GNU General Public License as published by | ||
| 5 | the Free Software Foundation, either version 2 of the License, or | ||
| 6 | (at your option) any later version. | ||
| 7 | |||
| 8 | This program is distributed in the hope that it will be useful, | ||
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | GNU General Public License for more details. | ||
| 12 | |||
| 13 | You should have received a copy of the GNU General Public License | ||
| 14 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
diff --git a/users/pcoves/rules.mk b/users/pcoves/rules.mk new file mode 100644 index 000000000..400497b15 --- /dev/null +++ b/users/pcoves/rules.mk | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | SRC += pcoves.c | ||
| 2 | |||
| 3 | RAINBOW_UNICORN_ENABLE ?= no | ||
| 4 | ifneq ($(strip $(RAINBOW_UNICORN_ENABLE)), no) | ||
| 5 | SRC += rainbowUnicorn.c | ||
| 6 | OPT_DEFS += -DRAINBOW_UNICORN_ENABLE | ||
| 7 | endif | ||
| 8 | |||
| 9 | ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) | ||
| 10 | SRC += tapDance.c | ||
| 11 | endif | ||
| 12 | |||
| 13 | ifeq ($(strip $(COMBO_ENABLE)), yes) | ||
| 14 | SRC += combo.c | ||
| 15 | endif | ||
| 16 | |||
| 17 | ifeq ($(strip $(UNICODE_ENABLE)), yes) | ||
| 18 | SRC += unicode.c | ||
| 19 | OPT_DEFS += -DUNICODE_ENABLE | ||
| 20 | endif | ||
| 21 | |||
| 22 | ifneq ($(strip $(NO_SECRET)), yes) | ||
| 23 | ifneq ("$(wildcard $(USER_PATH)/secret.c)","") | ||
| 24 | SRC += secret.c | ||
| 25 | else | ||
| 26 | OPT_DEFS += -DNO_SECRET | ||
| 27 | endif | ||
| 28 | else | ||
| 29 | OPT_DEFS += -DNO_SECRET | ||
| 30 | endif | ||
diff --git a/users/pcoves/tapDance.c b/users/pcoves/tapDance.c new file mode 100644 index 000000000..f8c9aaf46 --- /dev/null +++ b/users/pcoves/tapDance.c | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | #include "tapDance.h" | ||
| 2 | |||
| 3 | #include "quantum.h" | ||
| 4 | |||
| 5 | void left(qk_tap_dance_state_t* state, void* user_data) { | ||
| 6 | switch (state->count) { | ||
| 7 | case 1: | ||
| 8 | if (state->pressed) | ||
| 9 | tap_code16(S(KC_LBRACKET)); | ||
| 10 | else | ||
| 11 | tap_code16(S(KC_9)); | ||
| 12 | break; | ||
| 13 | case 2: | ||
| 14 | if (state->pressed) | ||
| 15 | tap_code16(S(KC_COMM)); | ||
| 16 | else | ||
| 17 | tap_code(KC_LBRACKET); | ||
| 18 | break; | ||
| 19 | default: | ||
| 20 | reset_tap_dance(state); | ||
| 21 | } | ||
| 22 | } | ||
| 23 | |||
| 24 | void right(qk_tap_dance_state_t* state, void* user_data) { | ||
| 25 | switch (state->count) { | ||
| 26 | case 1: | ||
| 27 | if (state->pressed) | ||
| 28 | tap_code16(S(KC_RBRACKET)); | ||
| 29 | else | ||
| 30 | tap_code16(S(KC_0)); | ||
| 31 | break; | ||
| 32 | case 2: | ||
| 33 | if (state->pressed) | ||
| 34 | tap_code16(S(KC_DOT)); | ||
| 35 | else | ||
| 36 | tap_code(KC_RBRACKET); | ||
| 37 | break; | ||
| 38 | default: | ||
| 39 | reset_tap_dance(state); | ||
| 40 | } | ||
| 41 | } | ||
| 42 | |||
| 43 | enum { REST, HOLD1, HOLD2, HOLD3 }; | ||
| 44 | |||
| 45 | static int Alt = REST; | ||
| 46 | void altFinish(qk_tap_dance_state_t* state, void* user_data) { | ||
| 47 | switch (state->count) { | ||
| 48 | case 1: | ||
| 49 | if (state->pressed) { | ||
| 50 | register_code(KC_LALT); | ||
| 51 | Alt = HOLD1; | ||
| 52 | } | ||
| 53 | break; | ||
| 54 | case 2: | ||
| 55 | if (state->pressed) { | ||
| 56 | register_code(KC_RALT); | ||
| 57 | Alt = HOLD2; | ||
| 58 | } | ||
| 59 | break; | ||
| 60 | case 3: | ||
| 61 | if (state->pressed) { | ||
| 62 | register_code(KC_RALT); | ||
| 63 | register_code(KC_RSHIFT); | ||
| 64 | Alt = HOLD3; | ||
| 65 | } | ||
| 66 | break; | ||
| 67 | default: | ||
| 68 | reset_tap_dance(state); | ||
| 69 | } | ||
| 70 | } | ||
| 71 | |||
| 72 | void altReset(qk_tap_dance_state_t* state, void* user_data) { | ||
| 73 | switch (Alt) { | ||
| 74 | case HOLD1: | ||
| 75 | unregister_code(KC_LALT); | ||
| 76 | break; | ||
| 77 | case HOLD2: | ||
| 78 | unregister_code(KC_RALT); | ||
| 79 | break; | ||
| 80 | case HOLD3: | ||
| 81 | unregister_code(KC_RSHIFT); | ||
| 82 | unregister_code(KC_RALT); | ||
| 83 | break; | ||
| 84 | } | ||
| 85 | Alt = REST; | ||
| 86 | } | ||
| 87 | |||
| 88 | static int Ctrl = REST; | ||
| 89 | void ctrlFinish(qk_tap_dance_state_t* state, void* user_data) { | ||
| 90 | switch (state->count) { | ||
| 91 | case 1: | ||
| 92 | if (state->pressed) { | ||
| 93 | register_code(KC_LCTL); | ||
| 94 | Ctrl = HOLD1; | ||
| 95 | } else { | ||
| 96 | tap_code(KC_ESC); | ||
| 97 | } | ||
| 98 | break; | ||
| 99 | case 2: | ||
| 100 | if (state->pressed) { | ||
| 101 | register_code(KC_LGUI); | ||
| 102 | Ctrl = HOLD2; | ||
| 103 | } | ||
| 104 | break; | ||
| 105 | default: | ||
| 106 | reset_tap_dance(state); | ||
| 107 | } | ||
| 108 | } | ||
| 109 | |||
| 110 | void ctrlReset(qk_tap_dance_state_t* state, void* user_data) { | ||
| 111 | switch (Ctrl) { | ||
| 112 | case HOLD1: | ||
| 113 | unregister_code(KC_LCTL); | ||
| 114 | break; | ||
| 115 | case HOLD2: | ||
| 116 | unregister_code(KC_LGUI); | ||
| 117 | break; | ||
| 118 | } | ||
| 119 | Ctrl = REST; | ||
| 120 | } | ||
| 121 | |||
| 122 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
| 123 | [ALT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, altFinish, altReset), | ||
| 124 | [CTRL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctrlFinish, ctrlReset), | ||
| 125 | [LEFT] = ACTION_TAP_DANCE_FN(left), | ||
| 126 | [RIGHT] = ACTION_TAP_DANCE_FN(right), | ||
| 127 | }; | ||
diff --git a/users/pcoves/tapDance.h b/users/pcoves/tapDance.h new file mode 100644 index 000000000..98fd8ae2c --- /dev/null +++ b/users/pcoves/tapDance.h | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | enum { | ||
| 4 | ALT, | ||
| 5 | CTRL, | ||
| 6 | LEFT, | ||
| 7 | RIGHT, | ||
| 8 | }; | ||
diff --git a/users/pcoves/unicode.c b/users/pcoves/unicode.c new file mode 100644 index 000000000..966a9d385 --- /dev/null +++ b/users/pcoves/unicode.c | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #include "unicode.h" | ||
| 2 | #include "pcoves.h" | ||
| 3 | |||
| 4 | bool process_record_unicode(uint16_t keycode, keyrecord_t *record) { | ||
| 5 | switch (keycode) { | ||
| 6 | case EMOTE0: | ||
| 7 | if (record->event.pressed) send_unicode_string("(╯°□°)╯︵┻━┻"); | ||
| 8 | return false; | ||
| 9 | case EMOTE1: | ||
| 10 | if (record->event.pressed) send_unicode_string("(ヘ・_・)ヘ┳━┳"); | ||
| 11 | return false; | ||
| 12 | case EMOTE2: | ||
| 13 | if (record->event.pressed) send_unicode_string("¯\\_(ツ)_/¯"); | ||
| 14 | return false; | ||
| 15 | case EMOTE3: | ||
| 16 | if (record->event.pressed) send_unicode_string("ಠ_ಠ"); | ||
| 17 | return false; | ||
| 18 | } | ||
| 19 | return true; | ||
| 20 | } | ||
diff --git a/users/pcoves/unicode.h b/users/pcoves/unicode.h new file mode 100644 index 000000000..ba8a88178 --- /dev/null +++ b/users/pcoves/unicode.h | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "quantum.h" | ||
| 4 | |||
| 5 | __attribute__((weak)) bool process_record_unicode(uint16_t keycode, keyrecord_t *record); | ||
