From c23233f41ab9221577fc83bbae0a230452a38231 Mon Sep 17 00:00:00 2001 From: Joe Wasson Date: Wed, 19 Sep 2018 16:13:58 -0700 Subject: [PATCH] Keymap: Talljoe's keymap for oddball keyboards (#3910) * Create layout for JD45 * Tweak layout to better support JD45 and add more tap dancing. * Add Maltron and tweak layout for 40% enter compatibility. * Switch back to `BL_TOGGLE` for backlight. * More tweaks * Rename talljoe_gherkin to talljoe-gherkin * Make NAV layer tab C_S_T also. * Add missing RESET key. * Add Talljoe layout for minivan. * MTI is not for me * Tweak keymap. * Add talljoe keymap to Atreus. * Minor tweaks. * Fix talljoe keymaps to work with new Zeal60 commit. --- .../atreus/keymaps/talljoe-atreus/config.h | 42 +++++ .../atreus/keymaps/talljoe-atreus/keymap.c | 1 + .../atreus/keymaps/talljoe-atreus/rules.mk | 1 + .../config.h | 0 .../keymap.c | 0 .../rules.mk | 0 keyboards/jd45/keymaps/talljoe/config.h | 22 +++ keyboards/jd45/keymaps/talljoe/keymap.c | 1 + .../tv44/keymaps/talljoe-minivan/config.h | 53 ++++++ .../tv44/keymaps/talljoe-minivan/keymap.c | 1 + .../tv44/keymaps/talljoe-minivan/rules.mk | 3 + keyboards/zeal60/rules.mk | 3 +- .../60_ansi_split_bs_rshift/talljoe/keymap.c | 25 +-- .../60_ansi_split_bs_rshift/talljoe/rules.mk | 1 + .../talljoe/solarized.c | 23 +++ .../talljoe/solarized.h | 27 +++ users/talljoe/config.h | 2 +- users/talljoe/talljoe.c | 53 +++--- users/talljoe/talljoe.h | 76 +++++++-- users/talljoe/tapdance.c | 154 +++++++++++++++--- 20 files changed, 420 insertions(+), 68 deletions(-) create mode 100644 keyboards/atreus/keymaps/talljoe-atreus/config.h create mode 100644 keyboards/atreus/keymaps/talljoe-atreus/keymap.c create mode 100644 keyboards/atreus/keymaps/talljoe-atreus/rules.mk rename keyboards/gherkin/keymaps/{talljoe_gherkin => talljoe-gherkin}/config.h (100%) rename keyboards/gherkin/keymaps/{talljoe_gherkin => talljoe-gherkin}/keymap.c (100%) rename keyboards/gherkin/keymaps/{talljoe_gherkin => talljoe-gherkin}/rules.mk (100%) create mode 100644 keyboards/jd45/keymaps/talljoe/config.h create mode 100644 keyboards/jd45/keymaps/talljoe/keymap.c create mode 100644 keyboards/tv44/keymaps/talljoe-minivan/config.h create mode 100644 keyboards/tv44/keymaps/talljoe-minivan/keymap.c create mode 100644 keyboards/tv44/keymaps/talljoe-minivan/rules.mk create mode 100644 layouts/community/60_ansi_split_bs_rshift/talljoe/rules.mk create mode 100644 layouts/community/60_ansi_split_bs_rshift/talljoe/solarized.c create mode 100644 layouts/community/60_ansi_split_bs_rshift/talljoe/solarized.h diff --git a/keyboards/atreus/keymaps/talljoe-atreus/config.h b/keyboards/atreus/keymaps/talljoe-atreus/config.h new file mode 100644 index 0000000000..87b68ffc65 --- /dev/null +++ b/keyboards/atreus/keymaps/talljoe-atreus/config.h @@ -0,0 +1,42 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include QMK_KEYBOARD_CONFIG_H + +#define PREVENT_STUCK_MODIFIERS +#define SPACE_COUNT 2 + +#define TEMPLATE( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K40, K41, K42, K44, K45, K46, K48, K49, K4B, K4C \ +) LAYOUT( \ + K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \ + K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, \ + K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, \ + K10, K41, K42, K30, K44, K1D, K20, K45, K3C, K0D, K2B, K3D \ +) + +#define TEMPLATE_NUM( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K40, K41, K42, K44, K45, K46, K48, K49, K4B, K4C \ +) LAYOUT( \ + K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \ + K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, \ + K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, \ + K10, K41, K42, K30, K44, K1D, K20, K45, K48, K49, K2B, K3D \ +) + + +#define TEMPLATE_RESET LAYOUT( \ + RESET , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + RESET , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX \ +) +#endif diff --git a/keyboards/atreus/keymaps/talljoe-atreus/keymap.c b/keyboards/atreus/keymaps/talljoe-atreus/keymap.c new file mode 100644 index 0000000000..7812add812 --- /dev/null +++ b/keyboards/atreus/keymaps/talljoe-atreus/keymap.c @@ -0,0 +1 @@ +// This space intentionally left blank diff --git a/keyboards/atreus/keymaps/talljoe-atreus/rules.mk b/keyboards/atreus/keymaps/talljoe-atreus/rules.mk new file mode 100644 index 0000000000..92007fe8ad --- /dev/null +++ b/keyboards/atreus/keymaps/talljoe-atreus/rules.mk @@ -0,0 +1 @@ +USER_NAME := talljoe diff --git a/keyboards/gherkin/keymaps/talljoe_gherkin/config.h b/keyboards/gherkin/keymaps/talljoe-gherkin/config.h similarity index 100% rename from keyboards/gherkin/keymaps/talljoe_gherkin/config.h rename to keyboards/gherkin/keymaps/talljoe-gherkin/config.h diff --git a/keyboards/gherkin/keymaps/talljoe_gherkin/keymap.c b/keyboards/gherkin/keymaps/talljoe-gherkin/keymap.c similarity index 100% rename from keyboards/gherkin/keymaps/talljoe_gherkin/keymap.c rename to keyboards/gherkin/keymaps/talljoe-gherkin/keymap.c diff --git a/keyboards/gherkin/keymaps/talljoe_gherkin/rules.mk b/keyboards/gherkin/keymaps/talljoe-gherkin/rules.mk similarity index 100% rename from keyboards/gherkin/keymaps/talljoe_gherkin/rules.mk rename to keyboards/gherkin/keymaps/talljoe-gherkin/rules.mk diff --git a/keyboards/jd45/keymaps/talljoe/config.h b/keyboards/jd45/keymaps/talljoe/config.h new file mode 100644 index 0000000000..f8b0333cfb --- /dev/null +++ b/keyboards/jd45/keymaps/talljoe/config.h @@ -0,0 +1,22 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include QMK_KEYBOARD_CONFIG_H + +#define PREVENT_STUCK_MODIFIERS +#define SPACE_COUNT 2 + +#define TEMPLATE( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K40, K41, K42, K44, K45, K46, K48, K49, K4B, K4C \ +) { \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K0D, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2C, KC_NO }, \ + { K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, KC_NO }, \ + { K40, K00, K41, K42, K44, KC_NO, K45, KC_NO, K48, K49, K3D, K4C, KC_NO } \ +} + +#endif diff --git a/keyboards/jd45/keymaps/talljoe/keymap.c b/keyboards/jd45/keymaps/talljoe/keymap.c new file mode 100644 index 0000000000..7812add812 --- /dev/null +++ b/keyboards/jd45/keymaps/talljoe/keymap.c @@ -0,0 +1 @@ +// This space intentionally left blank diff --git a/keyboards/tv44/keymaps/talljoe-minivan/config.h b/keyboards/tv44/keymaps/talljoe-minivan/config.h new file mode 100644 index 0000000000..fa1f43adce --- /dev/null +++ b/keyboards/tv44/keymaps/talljoe-minivan/config.h @@ -0,0 +1,53 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include QMK_KEYBOARD_CONFIG_H + +#define SPACE_COUNT 2 + +#define TEMPLATE( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K40, K41, K42, K44, K45, K46, K48, K49, K4B, K4C \ +) KEYMAP_ARROW( \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K0D, \ + K41, K49, K42, K44, K45, K3C, K0B, K00, K3D \ +) + +#define TEMPLATE_ALT( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K40, K41, K42, K44, K45, K46, K48, K49, K4B, K4C \ +) KEYMAP_ARROW( \ + K00, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2C, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, \ + K41, K49, K42, K44, K45, K48, K49, K4B, K4C \ +) + +#define TEMPLATE_ADJUST( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K40, K41, K42, K44, K45, K46, K48, K49, K4B, K4C \ +) KEYMAP_ARROW( \ + K00, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K2D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2C, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, \ + K40, K49, K42, K44, K45, K48, K0B, K0C, K4C \ +) + +#define TEMPLATE_RESET KEYMAP_ARROW( \ + RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RESET, \ + 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, RESET) + +#endif diff --git a/keyboards/tv44/keymaps/talljoe-minivan/keymap.c b/keyboards/tv44/keymaps/talljoe-minivan/keymap.c new file mode 100644 index 0000000000..7812add812 --- /dev/null +++ b/keyboards/tv44/keymaps/talljoe-minivan/keymap.c @@ -0,0 +1 @@ +// This space intentionally left blank diff --git a/keyboards/tv44/keymaps/talljoe-minivan/rules.mk b/keyboards/tv44/keymaps/talljoe-minivan/rules.mk new file mode 100644 index 0000000000..a4e40d0ba6 --- /dev/null +++ b/keyboards/tv44/keymaps/talljoe-minivan/rules.mk @@ -0,0 +1,3 @@ +USER_NAME := talljoe + +COMMAND_ENABLE = no # Commands for debug and configuration diff --git a/keyboards/zeal60/rules.mk b/keyboards/zeal60/rules.mk index c4686f9852..f099ea9fdd 100644 --- a/keyboards/zeal60/rules.mk +++ b/keyboards/zeal60/rules.mk @@ -53,7 +53,7 @@ BOOTLOADER = atmel-dfu OPT_DEFS += -DNO_SUSPEND_POWER_DOWN # Build Options -# change to "no" to disable the options, or define them in the Makefile in +# change to "no" to disable the options, or define them in the Makefile in # the appropriate keymap folder that will get included automatically # BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) @@ -76,3 +76,4 @@ RAW_ENABLE = yes DYNAMIC_KEYMAP_ENABLE = yes CIE1931_CURVE = yes +LAYOUTS = 60_ansi 60_iso 60_hhkb 60_ansi_split_bs_rshift diff --git a/layouts/community/60_ansi_split_bs_rshift/talljoe/keymap.c b/layouts/community/60_ansi_split_bs_rshift/talljoe/keymap.c index b5dc544927..cfad9da8a3 100644 --- a/layouts/community/60_ansi_split_bs_rshift/talljoe/keymap.c +++ b/layouts/community/60_ansi_split_bs_rshift/talljoe/keymap.c @@ -1,7 +1,7 @@ #ifdef KEYBOARD_zeal60 #include "config.h" #include "zeal60.h" -#include "zeal_backlight.h" +#include "rgb_backlight.h" #include "action_layer.h" #include "solarized.h" #include "talljoe.h" @@ -9,7 +9,7 @@ // from zeal_backlight.c // we want to be able to set indicators for the spacebar stabs // but they are not represented by a row/index. -extern zeal_backlight_config g_config; +extern backlight_config g_config; void map_row_column_to_led( uint8_t row, uint8_t column, uint8_t *led ); void set_backlight_defaults(void) { @@ -17,7 +17,7 @@ void set_backlight_defaults(void) { uint8_t caps_lock; map_row_column_to_led(3, 12, &caps_lock); map_row_column_to_led(4, 7, &space); - zeal_backlight_config default_values = { + backlight_config default_values = { .use_split_backspace = USE_SPLIT_BACKSPACE, .use_split_left_shift = USE_SPLIT_LEFT_SHIFT, .use_split_right_shift = USE_SPLIT_RIGHT_SHIFT, @@ -34,15 +34,17 @@ void set_backlight_defaults(void) { .layer_2_indicator = { .index = space, .color = solarized.yellow }, .layer_3_indicator = { .index = 254, .color = solarized.red }, .alphas_mods = { - BACKLIGHT_ALPHAS_MODS_ROW_0, - BACKLIGHT_ALPHAS_MODS_ROW_1, - BACKLIGHT_ALPHAS_MODS_ROW_2, - BACKLIGHT_ALPHAS_MODS_ROW_3, - BACKLIGHT_ALPHAS_MODS_ROW_4 } + RGB_BACKLIGHT_ALPHAS_MODS_ROW_0, + RGB_BACKLIGHT_ALPHAS_MODS_ROW_1, + RGB_BACKLIGHT_ALPHAS_MODS_ROW_2, + RGB_BACKLIGHT_ALPHAS_MODS_ROW_3, + RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 } }; - memcpy(&g_config, &default_values, sizeof(zeal_backlight_config)); + memcpy(&g_config, &default_values, sizeof(backlight_config)); backlight_config_save(); +#undef CUSTOM_RGB_LAYOUTS +#ifdef CUSTOM_RGB_LAYOUTS solarized_t* S = &solarized; HSV alphas = S->base2; HSV custom_color_map[MATRIX_ROWS][MATRIX_COLS] = CM( @@ -54,9 +56,12 @@ void set_backlight_defaults(void) { ); for (uint8_t row = 0; row < MATRIX_ROWS; ++row) { for (uint8_t col = 0; col < MATRIX_COLS; ++col) { - backlight_set_key_color(row, col, custom_color_map[row][col]); + uint8_t index; + map_row_column_to_led( row, col, &index ); + set_key_color(index, custom_color_map[row][col]); } } +#endif // CUSTOM_RGB_LAYOUTS } bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { diff --git a/layouts/community/60_ansi_split_bs_rshift/talljoe/rules.mk b/layouts/community/60_ansi_split_bs_rshift/talljoe/rules.mk new file mode 100644 index 0000000000..239f03091a --- /dev/null +++ b/layouts/community/60_ansi_split_bs_rshift/talljoe/rules.mk @@ -0,0 +1 @@ +SRC += $(KEYMAP_PATH)/solarized.c diff --git a/layouts/community/60_ansi_split_bs_rshift/talljoe/solarized.c b/layouts/community/60_ansi_split_bs_rshift/talljoe/solarized.c new file mode 100644 index 0000000000..3e9e726b95 --- /dev/null +++ b/layouts/community/60_ansi_split_bs_rshift/talljoe/solarized.c @@ -0,0 +1,23 @@ +#include "solarized.h" + +#define MAKE_COLOR(_H, _S, _V) \ + { .h = (((uint32_t)_H) * 255) / 360, .s = (((uint16_t)_S) * 255) / 100, .v = (((uint16_t)_V) * 255) / 100 } + +solarized_t solarized = { + .base03 = MAKE_COLOR(193, 100, 21), + .base02 = MAKE_COLOR(192, 90, 26), + .base01 = MAKE_COLOR(194, 25, 46), + .base00 = MAKE_COLOR(195, 23, 51), + .base0 = MAKE_COLOR(186, 13, 59), + .base1 = MAKE_COLOR(180, 9, 63), + .base2 = MAKE_COLOR( 44, 11, 93), + .base3 = MAKE_COLOR( 44, 10, 99), + .yellow = MAKE_COLOR( 45, 100, 71), + .orange = MAKE_COLOR( 18, 89, 80), + .red = MAKE_COLOR( 1, 79, 86), + .magenta = MAKE_COLOR(331, 74, 83), + .violet = MAKE_COLOR(237, 45, 77), + .blue = MAKE_COLOR(205, 82, 82), + .cyan = MAKE_COLOR(175, 74, 63), + .green = MAKE_COLOR( 68, 100, 60), +}; diff --git a/layouts/community/60_ansi_split_bs_rshift/talljoe/solarized.h b/layouts/community/60_ansi_split_bs_rshift/talljoe/solarized.h new file mode 100644 index 0000000000..3b00caea70 --- /dev/null +++ b/layouts/community/60_ansi_split_bs_rshift/talljoe/solarized.h @@ -0,0 +1,27 @@ +#ifndef SOLARIZED_H +#define SOLARIZED_H + +#include "quantum/color.h" + +typedef struct { + HSV base03; + HSV base02; + HSV base01; + HSV base00; + HSV base0; + HSV base1; + HSV base2; + HSV base3; + HSV yellow; + HSV orange; + HSV red; + HSV magenta; + HSV violet; + HSV blue; + HSV cyan; + HSV green; +} solarized_t; + +extern solarized_t solarized; + +#endif diff --git a/users/talljoe/config.h b/users/talljoe/config.h index 1cdbb5a412..0d06a0b12d 100644 --- a/users/talljoe/config.h +++ b/users/talljoe/config.h @@ -1,7 +1,7 @@ #ifndef USERSPACE_CONFIG_H #define USERSPACE_CONFIG_H -#define IGNORE_MOD_TAP_INTERRUPT +#define PERMISSIVE_HOLD #define RESET_LAYER 15 diff --git a/users/talljoe/talljoe.c b/users/talljoe/talljoe.c index e9c69b016a..7a343e7768 100644 --- a/users/talljoe/talljoe.c +++ b/users/talljoe/talljoe.c @@ -5,10 +5,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_BASE] = TEMPLATE_TKL( KC_ESC, 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_PSCR, KC_SLCK, MO_ADJ , - KC_GRV , 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_INS , KC_HOME, KC_PGUP, - 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_DEL , KC_END , KC_PGDN, - US_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G , KC_H, KC_J, KC_K, KC_L, US_SCLN, US_QUOT, US_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, KC_UP , + US_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_MINS, KC_EQL , US_BSLS, KC_INS , KC_HOME, KC_PGUP, + US_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_DEL , KC_END , KC_PGDN, + CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G , KC_H, KC_J, KC_K, KC_L, US_SCLN, US_QUOT, US_ENT , + SH_LBRC, KC_Z, KC_X, KC_C, KC_V, KC_B , KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SH_RBRC, KC_UP , KC_LCTL, KC_LGUI, KC_LALT, KC_SPC2, KC_SPC1, KC_SPC3, KC_RALT, KC_RGUI, KC_RCTL, KC_PTT , KC_LEFT, KC_DOWN, KC_RGHT), [_WORKMAN] = TEMPLATE( _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -34,41 +34,44 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, KC_A, KC_R, KC_S, KC_T, KC_D , KC_H, KC_N, KC_E, KC_I, KC_O , _______, _______, _______, KC_Z, KC_X, KC_C, KC_V, KC_B , KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), - +#if (SPACE_COUNT > 1) + // A tweaked version of the Maltron layout + [_MALTROFF] = TEMPLATE( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, KC_Q, KC_P, KC_Y, KC_G, KC_B , KC_J, KC_M, KC_U, KC_K, KC_L, _______, _______, _______, + _______, KC_A, KC_N, KC_I, KC_S, KC_F , KC_D, KC_T, KC_H, KC_O, KC_R , US_ENT , KC_BSPC, + _______, KC_Z, KC_X, KC_C, KC_V, US_QUOT, KC_SCLN, KC_W, KC_COMM, KC_DOT, KC_SLSH, _______, _______, + _______, _______, _______, MLT_E , _______, _______, _______, _______, _______, _______), +#endif #ifdef ENABLE_GAME_LAYER [_GAME] = TEMPLATE( 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, MO_NAV , 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, MO_ADJ , - KC_LCTL, KC_PTT , KC_PGDN, KC_SPC , KC_SPC , KC_SPC , KC_RALT, KC_APP , KC_RCTL, KC_PTT ), + KC_LCTL, KC_PTT , KC_PGDN, KC_SPC , KC_SPC , KC_SPC , KC_RALT, KC_APP , KC_RCTL, KC_PTT ), #endif - [_NAV] = TEMPLATE( + [_NAV] = TEMPLATE_NAV( KC_GRV , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - KC_TAB , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_VOLU, KC_INS , KC_PGUP, KC_UP , KC_PGDN, KC_BTN1, KC_BTN2, KC_BTN3, KC_DEL , - US_CAPS, KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_MUTE, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END , KC_RCTL, TG_ADJ , - KC_LSFT, KC_F9 , KC_F10 , KC_F11 , KC_F12 , KC_VOLD, KC_END , KC_PGDN, KC_WBAK, KC_WFWD, KC_WREF, KC_RSFT, KC_APP , + US_TAB , KC_EXLM, KC_AT , KC_HASH, KC_DLR , KC_PERC, KC_INS , KC_PGUP, KC_UP , KC_PGDN, KC_BTN1, KC_BTN3, KC_BTN2, KC_DEL , + CTL_ESC, KC_LCBR, KC_RCBR, KC_LPRN, KC_RPRN, KC_AMPR, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END , US_QUOT, TG_ADJ , + KC_LSFT, KC_EQL, KC_PLUS, KC_MINS, KC_UNDS, KC_ASTR, KC_CALC, US_GRV , KC_WBAK, KC_WFWD, KC_WREF, KC_RSFT, KC_APP , KC_LCTL, KC_LGUI, KC_LALT, NV_SPC2, NV_SPC1, NV_SPC3, KC_RALT, KC_RGUI, KC_RCTL, KC_PTT ), - [_NUM] = TEMPLATE( + [_NUM] = TEMPLATE_NUM( XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - KC_GRV , KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, XXXXXXX, KC_DEL , - US_CAPS, KC_LCBR, KC_RCBR, KC_LPRN, KC_RPRN, KC_LBRC, KC_RBRC, KC_4, KC_5, KC_6, KC_PPLS, KC_PENT, XXXXXXX, - KC_LSFT, KC_EQL, KC_PLUS, KC_BSLS, KC_PIPE, KC_SCLN, XXXXXXX, KC_1, KC_2, KC_3, KC_PAST, KC_PSLS, XXXXXXX, + KC_GRV , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_VOLU, KC_CIRC, KC_7, KC_8, KC_9, KC_PMNS, XXXXXXX, XXXXXXX, KC_DEL , + CTL_ESC, KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_MUTE, KC_PENT, KC_4, KC_5, KC_6, KC_PPLS, XXXXXXX, KC_ENT , + KC_LSFT, KC_F9 , KC_F10 , KC_F11 , KC_F12 , KC_VOLD, KC_PIPE, KC_1, KC_2, KC_3, KC_PAST, KC_PSLS, TG_NUM , KC_LCTL, KC_LGUI, KC_LALT, NM_SPC2, NM_SPC1, NM_SPC3, KC_PDOT, KC_PCMM, KC_RCTL, KC_PTT ), // Adjust layer is on the split-shift key; or NAV+Enter (for non-split keyboards) - [_ADJUST] = TEMPLATE( - MO_RST , FX(1) , FX(2) , FX(3) , FX(4) , FX(5) , FX(6) , FX(7) , FX(8) , FX(9) , FX(10) , BR_DEC , BR_INC , XXXXXXX, MO_RST , - XXXXXXX, H1_INC , S1_INC , H2_INC , S2_INC , EF_INC , RGB_HUI, RGB_SAI, RGB_MOD, RGB_M_P, DFAULTS, RGB_VAD, RGB_VAI, KC_DEL , + [_ADJUST] = TEMPLATE_ADJUST( + MO_RST , FX(1) , FX(2) , FX(3) , FX(4) , FX(5) , FX(8) , FX(9) , FX(10) , FX(20) , FX(0) , BR_DEC , BR_INC , XXXXXXX, MO_RST , + MO_RST , H1_INC , S1_INC , H2_INC , S2_INC , EF_INC , RGB_HUI, RGB_SAI, RGB_MOD, RGB_M_P, DFAULTS, RGB_VAD, RGB_VAI, MO_RST , XXXXXXX, H1_DEC , S1_DEC , H2_DEC , S2_DEC , EF_DEC , RGB_HUD, RGB_SAD, RGB_RMOD,RGB_M_K, RGB_M_B, RGB_M_G, TG_ADJ , - TG_NKRO, LY_QWER, LY_WORK, LY_NRMN, LY_DVRK, LY_CLMK, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MAKE, KC_CAPS, XXXXXXX, - MO_RST , AG_NORM, AG_SWAP, XXXXXXX, BL_STEP, XXXXXXX, RGB_TOG, XXXXXXX, XXXXXXX, TG_GAME), + TG_NKRO, LY_QWER, LY_WORK, LY_NRMN, LY_DVRK, LY_CLMK, XXXXXXX, LY_MALT, XXXXXXX, XXXXXXX, KC_MAKE, KC_CAPS, XXXXXXX, + MO_RST , AG_SWAP, AG_NORM, XXXXXXX, BL_TOGG, XXXXXXX, RGB_TOG, XXXXXXX, XXXXXXX, TG_GAME), // To Reset hit FN + ` + Esc - [_RESET] = TEMPLATE( - RESET , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET , - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - RESET , XXXXXXX, XXXXXXX, XXXXXXX, KC_SLEP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX), + [_RESET] = TEMPLATE_RESET, }; void matrix_scan_user(void) { diff --git a/users/talljoe/talljoe.h b/users/talljoe/talljoe.h index 7c34cd41ff..4436c0a044 100644 --- a/users/talljoe/talljoe.h +++ b/users/talljoe/talljoe.h @@ -8,7 +8,7 @@ enum userspace_custom_keycodes { DFAULTS, TOGGLE_BACKLIGHT, EFFECT, - EFFECT_END = EFFECT + 10 + EFFECT_END = EFFECT + 20 }; #ifndef RESET_LAYER @@ -21,6 +21,7 @@ enum layers { _NORMAN, _DVORAK, _COLMAK, + _MALTROFF, _GAME, _NAV, _NUM, @@ -29,7 +30,9 @@ enum layers { }; enum tap_dancers { - TD_SEMICOLON + TD_SEMICOLON, + TD_GRAVE, + TD_QUOTE, }; #define _______ KC_TRNS @@ -39,6 +42,7 @@ enum tap_dancers { #define MO_ADJ MO(_ADJUST) #define MO_RST MO(_RESET) #define TG_ADJ TG(_ADJUST) +#define TG_NUM TG(_NUM) #ifdef ENABLE_GAME_LAYER #define TG_GAME TG(_GAME) #else @@ -49,16 +53,28 @@ enum tap_dancers { #define LY_NRMN DF(_NORMAN) #define LY_DVRK DF(_DVORAK) #define LY_CLMK DF(_COLMAK) +#if SPACE_COUNT >= 2 + #define LY_MALT DF(_MALTROFF) +#else + #define LY_MALT KC_NO +#endif #define TG_NKRO MAGIC_TOGGLE_NKRO #define KC_PTT KC_F24 #define MS_MID KC_MS_BTN3 #define FX(x) (EFFECT + x) -#define US_CAPS CTL_T(KC_ESC) -#define US_QUOT RCTL_T(KC_QUOT) +#define CTL_ESC CTL_T(KC_ESC) +#define US_ENT RCTL_T(KC_ENT) #define US_MINS RCTL_T(KC_QUOT) +#define US_BSLS LCA_T(KC_BSLS) #define US_SCLN TD(TD_SEMICOLON) -#define US_ENT LT(_NUM, KC_ENT) +#define US_GRV TD(TD_GRAVE) +#define US_QUOT TD(TD_QUOTE) +#define US_TAB C_S_T(KC_TAB) +#define SH_LBRC LSFT_T(KC_LBRC) +#define SH_RBRC RSFT_T(KC_RBRC) + +#define MLT_E LT(_NUM, KC_E) #ifndef SPACE_COUNT #define SPACE_COUNT 1 @@ -75,17 +91,34 @@ enum tap_dancers { #define NM_SPC1 _______ #define NM_SPC2 _______ #define NM_SPC3 _______ +#elif (SPACE_COUNT == 2) + #define KC_SPC1 LT(_NAV,KC_SPC) + #define KC_SPC2 LT(_NUM,KC_ENT) + + #define NV_SPC1 KC_SPC + #define NV_SPC2 KC_ENT + + #define NM_SPC1 KC_0 + #define NM_SPC2 KC_SPC + + #define KC_SPC3 XXXXXXX + #define NV_SPC3 XXXXXXX + #define NM_SPC3 XXXXXXX #elif (SPACE_COUNT == 3) - #define KC_SPC1 KC_BSPC + #ifdef SWAP_HANDS_ENABLE + #define KC_SPC1 SH_T(KC_BSPC) + #else + #define KC_SPC1 KC_BSPC + #endif #define KC_SPC2 LT(_NUM,KC_ENT) #define KC_SPC3 LT(_NAV,KC_SPC) #define NV_SPC1 KC_SPC - #define NV_SPC2 C_S_T(KC_ENT) + #define NV_SPC2 KC_ENT #define NV_SPC3 KC_SPC - #define NM_SPC2 XXXXXXX #define NM_SPC1 KC_SPC + #define NM_SPC2 XXXXXXX #define NM_SPC3 KC_0 #else #error "Unsupported space count:" SPACE_COUNT @@ -110,7 +143,7 @@ enum tap_dancers { #define FN_MO2 KC_NO #endif -#ifdef TEMPLATE_TKL +#ifndef TEMPLATE #define _X_ KC_NO #define TEMPLATE( \ KJ4, KJ7, KI7, KH7, KG7, KG4, KF4, KF7, KE7, KD7, KR7, KR4, KE4, KB2, KJ6, \ @@ -126,7 +159,8 @@ enum tap_dancers { KN2, KJ1, KI1, KH1, KG1, KG0, KF0, KF1, KE1, KD1, KR0, KN3, _X_, \ KA4, KP2, KC6, KX1, KK6, KX2, KC0, KM3, KD0, KA1, _X_, _X_, _X_ \ ) -#else +#endif +#ifndef TEMPLATE_TKL #define TEMPLATE_TKL( \ KJ6, KI4, KH4, KH2, KH6, KA7, KE6, KD2, KD4, KB4, KB7, KB6, KB0, KC7, KC5, KA5, \ KJ4, KJ7, KI7, KH7, KG7, KG4, KF4, KF7, KE7, KD7, KR7, KR4, KE4, KB2, KL4, KO4, KQ4, \ @@ -143,4 +177,26 @@ enum tap_dancers { ) #endif +#ifndef TEMPLATE_ALT + #define TEMPLATE_ALT TEMPLATE +#endif +#ifndef TEMPLATE_NUM + #define TEMPLATE_NUM TEMPLATE_ALT +#endif +#ifndef TEMPLATE_NAV + #define TEMPLATE_NAV TEMPLATE_ALT +#endif +#ifndef TEMPLATE_ADJUST + #define TEMPLATE_ADJUST TEMPLATE_ALT +#endif + +#ifndef TEMPLATE_RESET + #define TEMPLATE_RESET TEMPLATE_ALT( \ + RESET , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET , \ + RESET , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET , \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + RESET , XXXXXXX, XXXXXXX, XXXXXXX, RESET , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX) +#endif + #endif diff --git a/users/talljoe/tapdance.c b/users/talljoe/tapdance.c index 3198fc67f0..c4d6025f0f 100644 --- a/users/talljoe/tapdance.c +++ b/users/talljoe/tapdance.c @@ -1,34 +1,146 @@ //Tap Dance #include "talljoe.h" -// Send semin-colon + enter on two taps -void tap_dance_semicolon(qk_tap_dance_state_t *state, void *user_data) { +enum { + SINGLE_TAP = 1, + SINGLE_HOLD = 2, + DOUBLE_TAP = 3, + DOUBLE_HOLD = 4, + DOUBLE_SINGLE_TAP = 5, //send two single taps + TRIPLE_TAP = 6, + TRIPLE_HOLD = 7, + SPECIAL = 8 +}; + +static struct { + int quote; + int semicolon; +} tap_state = {0}; + +int cur_dance (qk_tap_dance_state_t *state) { + if (state->count == 1) { + //If count = 1, and it has been interrupted - it doesn't matter if it is pressed or not: Send SINGLE_TAP + if (state->interrupted) { + // if (!state->pressed) return SINGLE_TAP; + //need "permissive hold" here. + // else return SINGLE_HOLD; + //If the interrupting key is released before the tap-dance key, then it is a single HOLD + //However, if the tap-dance key is released first, then it is a single TAP + //But how to get access to the state of the interrupting key???? + return SINGLE_TAP; + } + else { + if (!state->pressed) return SINGLE_TAP; + else return SINGLE_HOLD; + } + } + //If count = 2, and it has been interrupted - assume that user is trying to type the letter associated + //with single tap. + else if (state->count == 2) { + if (state->interrupted) return DOUBLE_SINGLE_TAP; + else if (state->pressed) return DOUBLE_HOLD; + else return DOUBLE_TAP; + } + else if ((state->count == 3) && ((state->interrupted) || (!state->pressed))) return TRIPLE_TAP; + else if (state->count == 3) return TRIPLE_HOLD; + else return SPECIAL; +} + +int hold_cur_dance (qk_tap_dance_state_t *state) { + if (state->count == 1) { + if (state->interrupted) { + if (!state->pressed) return SINGLE_TAP; + else return SINGLE_HOLD; + } + else { + if (!state->pressed) return SINGLE_TAP; + else return SINGLE_HOLD; + } + } + //If count = 2, and it has been interrupted - assume that user is trying to type the letter associated + //with single tap. + else if (state->count == 2) { + if (state->pressed) return DOUBLE_HOLD; + else return DOUBLE_TAP; + } + else if (state->count == 3) { + if (!state->pressed) return TRIPLE_TAP; + else return TRIPLE_HOLD; + } + else return SPECIAL; +} + +// Send semi-colon + enter on two taps +void tap_dance_semicolon_finished(qk_tap_dance_state_t *state, void *user_data) { + tap_state.semicolon = hold_cur_dance(state); + switch (tap_state.semicolon) { + case SINGLE_TAP: case DOUBLE_HOLD: register_code(KC_SCLN); break; + case SINGLE_HOLD: layer_on(_NUM); break; + } +} + +void tap_dance_semicolon_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (tap_state.semicolon) { + case SINGLE_TAP: case DOUBLE_HOLD: unregister_code(KC_SCLN); break; + case DOUBLE_TAP: { + if (get_mods()) { + SEND_STRING(";;"); // send normal when mods are pressed + } + else { + SEND_STRING(";\n"); + } + break; + } + case TRIPLE_TAP: { + SEND_STRING(";\n\n"); + } + case SPECIAL: layer_invert(_NUM); break; + case SINGLE_HOLD: layer_off(_NUM); break; + } + tap_state.semicolon = 0; +} + +// Send `. ~. ``` +void tap_dance_grave_finished(qk_tap_dance_state_t *state, void *user_data) { switch(state->count) { case 1: - register_code(KC_SCLN); - unregister_code(KC_SCLN); + SEND_STRING("`"); break; case 2: - register_code(KC_SCLN); - unregister_code(KC_SCLN); - - uint8_t mods = get_mods(); - if (mods) { - clear_mods(); - } - - register_code(KC_ENT); - unregister_code(KC_ENT); - - if (mods) { - set_mods(mods); - } - - reset_tap_dance(state); + SEND_STRING("~"); break; } } +void tap_dance_grave_each(qk_tap_dance_state_t *state, void *user_data) { + if(state->count == 3) { + SEND_STRING("```"); + } else if (state->count > 3) { + SEND_STRING("`"); + } +} + + +void tap_dance_quote_finished(qk_tap_dance_state_t *state, void *user_data) { + tap_state.quote = hold_cur_dance(state); + switch (tap_state.quote) { + case SINGLE_TAP: case DOUBLE_HOLD: register_code(KC_QUOT); break; + case SINGLE_HOLD: layer_on(_NAV); break; + } +} + +void tap_dance_quote_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (tap_state.quote) { + case SINGLE_TAP: case DOUBLE_HOLD: unregister_code(KC_QUOTE); break; + case DOUBLE_TAP: SEND_STRING("\""); break; + case TRIPLE_TAP: layer_invert(_NAV); break; + case SINGLE_HOLD: layer_off(_NAV); break; + } + tap_state.quote = 0; +} + qk_tap_dance_action_t tap_dance_actions[] = { - [TD_SEMICOLON] = ACTION_TAP_DANCE_FN(tap_dance_semicolon), + [TD_SEMICOLON] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tap_dance_semicolon_finished, tap_dance_semicolon_reset), + [TD_GRAVE] = ACTION_TAP_DANCE_FN_ADVANCED(tap_dance_grave_each, tap_dance_grave_finished, NULL), + [TD_QUOTE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tap_dance_quote_finished, tap_dance_quote_reset), };