diff options
Diffstat (limited to 'users/cwebster2/keycodes.c')
| -rw-r--r-- | users/cwebster2/keycodes.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/users/cwebster2/keycodes.c b/users/cwebster2/keycodes.c new file mode 100644 index 000000000..39b4341bd --- /dev/null +++ b/users/cwebster2/keycodes.c | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | /* Copyright 2020 Casey Webster <casey@e1337.dev> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #include "keycodes.h" | ||
| 17 | |||
| 18 | __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } | ||
| 19 | |||
| 20 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 21 | static uint16_t my_colon_timer; | ||
| 22 | |||
| 23 | switch (keycode) { | ||
| 24 | case KC_LCCL: | ||
| 25 | if (record->event.pressed) { | ||
| 26 | my_colon_timer = timer_read(); | ||
| 27 | register_code(KC_LCTL); | ||
| 28 | } else { | ||
| 29 | unregister_code(KC_LCTL); | ||
| 30 | if (timer_elapsed(my_colon_timer) < TAPPING_TERM) { | ||
| 31 | SEND_STRING(":"); | ||
| 32 | } | ||
| 33 | } | ||
| 34 | return false; | ||
| 35 | } | ||
| 36 | return process_record_keymap(keycode, record); | ||
| 37 | } | ||
| 38 | |||
| 39 | uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { | ||
| 40 | switch (keycode) { | ||
| 41 | case LGUI_T(KC_A): | ||
| 42 | case LALT_T(KC_S): | ||
| 43 | case LCTL_T(KC_D): | ||
| 44 | case LSFT_T(KC_F): | ||
| 45 | case RSFT_T(KC_J): | ||
| 46 | case RCTL_T(KC_K): | ||
| 47 | case RALT_T(KC_L): | ||
| 48 | case RGUI_T(KC_SCLN): | ||
| 49 | return TAPPING_TERM + 150; | ||
| 50 | default: | ||
| 51 | return TAPPING_TERM; | ||
| 52 | } | ||
| 53 | } | ||
