From 163cab1b64f4439f524e3b47074711150deb5a37 Mon Sep 17 00:00:00 2001 From: sheldonmlee Date: Sun, 31 Jan 2021 00:44:42 +0800 Subject: [PATCH] First commit. --- config.h | 7 ++++ keymap.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 config.h create mode 100644 keymap.c diff --git a/config.h b/config.h new file mode 100644 index 0000000..a501e74 --- /dev/null +++ b/config.h @@ -0,0 +1,7 @@ +#pragma once + +// place overrides here + +#define TAPPING_TOGGLE 2 +#define TAPPING_TERM 200 +#define PERMISSIVE_HOLD diff --git a/keymap.c b/keymap.c new file mode 100644 index 0000000..86eb9bd --- /dev/null +++ b/keymap.c @@ -0,0 +1,103 @@ + +#include QMK_KEYBOARD_H + +/* THIS FILE WAS GENERATED! + * + * This file was generated by qmk json2c. You may or may not want to + * edit it directly. + */ + +enum layers { + COLEMAK_0, + COLEMAK_1, + QWERTY, + HHKB_FN, + SPACE_FN, + OTHER +}; + +enum custom_keycodes { + LT_CUSTOM = 0x7100, +}; + +enum tap_dance { + TEST +}; + +bool layer_interrupted = false; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + // colemak + [COLEMAK_0] = LAYOUT_60_hhkb( +KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, \ +KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, KC_RBRC, KC_BSPC, \ +LCTL_T(KC_CAPS), KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_ENT, \ +KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, TT(HHKB_FN), \ +KC_LALT, KC_LGUI, LT(SPACE_FN, KC_SPC), KC_RGUI, KC_RALT + ), + // colemak with out tap/hold layers + [COLEMAK_1] = LAYOUT_60_hhkb( +KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, \ +KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, KC_RBRC, KC_BSPC, \ +KC_LCTL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_ENT, \ +KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, TT(HHKB_FN), \ +KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT + ), + // qwerty + [QWERTY] = LAYOUT_60_hhkb( +KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, \ +KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, \ +KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ +KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, TT(HHKB_FN), \ +KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT + ), + // hhkb fn layer + [HHKB_FN] = LAYOUT_60_hhkb( +KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, \ +KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS, \ +KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, \ +KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, \ +KC_TRNS, KC_TRNS, KC_TRNS, MO(OTHER), KC_TRNS \ + ), + // spacefn + [SPACE_FN] = LAYOUT_60_hhkb( +KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS, \ +KC_TRNS, KC_UNDS, KC_PLUS, KC_LPRN, KC_RPRN, KC_TRNS, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_PIPE, KC_TILD, KC_TRNS, KC_DEL, \ +KC_TRNS, KC_MINS, KC_EQL, KC_LCBR, KC_RCBR, KC_TRNS, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_BSLS, KC_GRV, KC_TRNS, \ +KC_TRNS, KC_TRNS, KC_TRNS, KC_LBRC, KC_RBRC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ +KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + // others + [OTHER] = LAYOUT_60_hhkb( +KC_PWR, RGB_TOG, RGB_RMOD, RGB_MOD, NK_OFF, NK_ON, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ +KC_NO, DF(COLEMAK_0), DF(COLEMAK_1), DF(QWERTY), 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_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_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 + ) +}; + +// custom keycode behavior +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch(keycode) { + // Alternate space fn LT layer for faster symbols. + // Does not work well for regular typing at the moment. + case LT_CUSTOM: + if (record->event.pressed) { + layer_interrupted = false; + layer_on(SPACE_FN); + } else { + if (!layer_interrupted) { + register_code(KC_SPC); + unregister_code(KC_SPC); + } + layer_off(SPACE_FN); + } + return false; + break; + default: + layer_interrupted = true; + break; + } + return true; +}