diff options
author | Ryan <fauxpark@gmail.com> | 2021-07-15 03:52:45 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-15 03:52:45 +1000 |
commit | fd8628ccdc97482aae1814cec5c2059c2978daad (patch) | |
tree | b4cb8d8811023236254ddd631bc45120bcd2bb84 /layouts/community/ergodox/deadcyclo/keymap.c | |
parent | e69c325a9ce84bc144dbc89978f800fc7560757d (diff) |
Migrate more `fn_actions` stuff (#13502)
Diffstat (limited to 'layouts/community/ergodox/deadcyclo/keymap.c')
-rw-r--r-- | layouts/community/ergodox/deadcyclo/keymap.c | 371 |
1 files changed, 97 insertions, 274 deletions
diff --git a/layouts/community/ergodox/deadcyclo/keymap.c b/layouts/community/ergodox/deadcyclo/keymap.c index 0ae1ef7fb2..345e25e03e 100644 --- a/layouts/community/ergodox/deadcyclo/keymap.c +++ b/layouts/community/ergodox/deadcyclo/keymap.c @@ -1,6 +1,4 @@ #include QMK_KEYBOARD_H -#include "debug.h" -#include "action_layer.h" #include "version.h" #define BASE 0 // default layer @@ -9,45 +7,19 @@ #define UNI 3 // unicode 1 #define UNI2 4 // unicode 2 -enum macros { - RUN -}; - -enum function_ids { - EMOJI, - EMOJI2, - EPRM, +enum custom_keycodes { + I3_RUN = SAFE_RANGE, VRSN, - RGB_SLD, - GO_GROUP -}; - -/* opt can only be 0-15 */ -enum emojis { - SHRUG, - YAY, - HUG, - SMILE, - SMILE2, - HMM1, - HMM2, - BEAR1, - BEAR2, - FUU, - EGGY1, - EGGY2, - FACE1, - FACE2, - UHU, - SMRK1 -}; - -enum emojis2 { - SMRK2, - LOVE -}; - -enum progmem_ids { + I3_GO_GROUP_1, + I3_GO_GROUP_2, + I3_GO_GROUP_3, + I3_GO_GROUP_4, + I3_GO_GROUP_5, + I3_GO_GROUP_6, + I3_GO_GROUP_7, + I3_GO_GROUP_8, + I3_GO_GROUP_9, + I3_GO_GROUP_10, EMOJI_SHRUG, EMOJI_YAY, EMOJI_HUG, @@ -65,20 +37,7 @@ enum progmem_ids { EMOJI_UHU, EMOJI_SMRK1, EMOJI_SMRK2, - EMOJI_LOVE, - F_EPRM, - F_VRSN, - F_RGB_SLD, - I3_GO_GROUP_10, - I3_GO_GROUP_1, - I3_GO_GROUP_2, - I3_GO_GROUP_3, - I3_GO_GROUP_4, - I3_GO_GROUP_5, - I3_GO_GROUP_6, - I3_GO_GROUP_7, - I3_GO_GROUP_8, - I3_GO_GROUP_9, + EMOJI_LOVE }; // TODO: Finish the macros for i3 (Macros should potentially be own function instead to make things easier? some of them at least, f. ex. the ones that use 1-0 keys so we can have a single switch) @@ -163,7 +122,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, RGB_TOG,RGB_MOD, - F(F_RGB_SLD), + RGB_M_P, RGB_VAD,RGB_VAI,KC_TRNS, // right hand KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, @@ -173,7 +132,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS, RGB_HUD, RGB_HUI, KC_TRNS, - F(F_EPRM), KC_DEL, KC_TRNS + EEP_RST, KC_DEL, KC_TRNS ), /* Keymap 2: Media, mouse and navigation * @@ -198,8 +157,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ // MEDIA , MOUSE and NAVIGATION [MDIA] = LAYOUT_ergodox( - KC_TRNS, F(I3_GO_GROUP_1), F(I3_GO_GROUP_2), F(I3_GO_GROUP_3), F(I3_GO_GROUP_4), F(I3_GO_GROUP_5), F(I3_GO_GROUP_6), -KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, M(RUN), KC_TRNS, KC_TRNS, + KC_TRNS, I3_GO_GROUP_1, I3_GO_GROUP_2, I3_GO_GROUP_3, I3_GO_GROUP_4, I3_GO_GROUP_5, I3_GO_GROUP_6, +KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, I3_RUN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2, @@ -207,7 +166,7 @@ KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, M(RUN), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, // right hand - F(I3_GO_GROUP_6), F(I3_GO_GROUP_7), F(I3_GO_GROUP_8), F(I3_GO_GROUP_9), F(I3_GO_GROUP_10), KC_TRNS, KC_TRNS, + I3_GO_GROUP_6, I3_GO_GROUP_7, I3_GO_GROUP_8, I3_GO_GROUP_9, I3_GO_GROUP_10, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT, KC_TRNS, KC_MPLY, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, KC_TRNS, @@ -241,10 +200,10 @@ KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, M(RUN), KC_TRNS, KC_TRNS, // Unicode [UNI] = LAYOUT_ergodox( KC_TRNS, UC(0x250c), UC(0x2510), UC(0x2514), UC(0x2518), UC(0x2502), UC(0x2500), - KC_TRNS, F(EMOJI_SHRUG), F(EMOJI_YAY), F(EMOJI_HUG), F(EMOJI_SMILE), F(EMOJI_SMILE2), KC_TRNS, - KC_TRNS, F(EMOJI_HMM1), F(EMOJI_HMM2), F(EMOJI_BEAR1), F(EMOJI_BEAR2), F(EMOJI_FUU), - KC_TRNS, F(EMOJI_EGGY1), F(EMOJI_EGGY2), F(EMOJI_FACE1), F(EMOJI_FACE2), F(EMOJI_UHU), KC_TRNS, - KC_TRNS, F(EMOJI_SMRK1), F(EMOJI_SMRK2), F(EMOJI_LOVE), F(F_VRSN), + KC_TRNS, EMOJI_SHRUG, EMOJI_YAY, EMOJI_HUG, EMOJI_SMILE, EMOJI_SMILE2, KC_TRNS, + KC_TRNS, EMOJI_HMM1, EMOJI_HMM2, EMOJI_BEAR1, EMOJI_BEAR2, EMOJI_FUU, + KC_TRNS, EMOJI_EGGY1, EMOJI_EGGY2, EMOJI_FACE1, EMOJI_FACE2, EMOJI_UHU, KC_TRNS, + KC_TRNS, EMOJI_SMRK1, EMOJI_SMRK2, EMOJI_LOVE, VRSN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, @@ -302,220 +261,84 @@ KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, M(RUN), KC_TRNS, KC_TRNS, ), }; -const uint16_t PROGMEM fn_actions[] = { - [EMOJI_SHRUG] = ACTION_FUNCTION_OPT(EMOJI, SHRUG), - [EMOJI_YAY] = ACTION_FUNCTION_OPT(EMOJI, YAY), - [EMOJI_HUG] = ACTION_FUNCTION_OPT(EMOJI,HUG), - [EMOJI_SMILE] = ACTION_FUNCTION_OPT(EMOJI,SMILE), - [EMOJI_SMILE2] = ACTION_FUNCTION_OPT(EMOJI,SMILE2), - [EMOJI_HMM1] = ACTION_FUNCTION_OPT(EMOJI,HMM1), - [EMOJI_HMM2] = ACTION_FUNCTION_OPT(EMOJI,HMM2), - [EMOJI_BEAR1] = ACTION_FUNCTION_OPT(EMOJI,BEAR1), - [EMOJI_BEAR2] = ACTION_FUNCTION_OPT(EMOJI,BEAR2), - [EMOJI_FUU] = ACTION_FUNCTION_OPT(EMOJI,FUU), - [EMOJI_EGGY1] = ACTION_FUNCTION_OPT(EMOJI,EGGY1), - [EMOJI_EGGY2] = ACTION_FUNCTION_OPT(EMOJI,EGGY2), - [EMOJI_FACE1] = ACTION_FUNCTION_OPT(EMOJI,FACE1), - [EMOJI_FACE2] = ACTION_FUNCTION_OPT(EMOJI,FACE2), - [EMOJI_UHU] = ACTION_FUNCTION_OPT(EMOJI,UHU), - [EMOJI_SMRK1] = ACTION_FUNCTION_OPT(EMOJI,SMRK1), - [EMOJI_SMRK2] = ACTION_FUNCTION_OPT(EMOJI2,SMRK2), - [EMOJI_LOVE] = ACTION_FUNCTION_OPT(EMOJI2,LOVE), - [F_EPRM] = ACTION_FUNCTION(EPRM), - [F_VRSN] = ACTION_FUNCTION(VRSN), - [F_RGB_SLD] = ACTION_FUNCTION(RGB_SLD), - [I3_GO_GROUP_10]= ACTION_FUNCTION_OPT(GO_GROUP,0), - [I3_GO_GROUP_1] = ACTION_FUNCTION_OPT(GO_GROUP,1), - [I3_GO_GROUP_2] = ACTION_FUNCTION_OPT(GO_GROUP,2), - [I3_GO_GROUP_3] = ACTION_FUNCTION_OPT(GO_GROUP,3), - [I3_GO_GROUP_4] = ACTION_FUNCTION_OPT(GO_GROUP,4), - [I3_GO_GROUP_5] = ACTION_FUNCTION_OPT(GO_GROUP,5), - [I3_GO_GROUP_6] = ACTION_FUNCTION_OPT(GO_GROUP,6), - [I3_GO_GROUP_7] = ACTION_FUNCTION_OPT(GO_GROUP,7), - [I3_GO_GROUP_8] = ACTION_FUNCTION_OPT(GO_GROUP,8), - [I3_GO_GROUP_9] = ACTION_FUNCTION_OPT(GO_GROUP,9), -}; - -#define TAP_ONCE(code) \ - register_code (code); \ - unregister_code (code) - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - if (record->event.pressed) { - switch(id) { - case EPRM: - eeconfig_init(); - break; - case VRSN: - SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); - break; - case RGB_SLD: -#ifdef RGBLIGHT_ENABLE - rgblight_mode(1); -#endif - break; - case GO_GROUP: - register_code(KC_LCTL); TAP_ONCE(KC_I); unregister_code(KC_LCTL); - TAP_ONCE(KC_G); - if (opt == 0) { - TAP_ONCE(39); - } else { - TAP_ONCE(29+opt); - } - break; - case EMOJI: - switch(opt) { - case SHRUG: - unicode_input_start(); register_hex(0xaf); unicode_input_finish(); - TAP_ONCE (KC_BSLS); - register_code (KC_RSFT); TAP_ONCE (KC_MINS); TAP_ONCE (KC_9); unregister_code (KC_RSFT); - unicode_input_start (); register_hex(0x30c4); unicode_input_finish(); - register_code (KC_RSFT); TAP_ONCE (KC_0); TAP_ONCE (KC_MINS); unregister_code (KC_RSFT); - TAP_ONCE (KC_SLSH); - unicode_input_start (); register_hex(0xaf); unicode_input_finish(); - break; - case YAY: - SEND_STRING ("\\o/"); - break; - case HUG: - unicode_input_start(); register_hex(0x0f3c); unicode_input_finish(); - TAP_ONCE (KC_SPC); - unicode_input_start(); register_hex(0x3064); unicode_input_finish(); - TAP_ONCE (KC_SPC); - unicode_input_start(); register_hex(0x25d5); unicode_input_finish(); - unicode_input_start(); register_hex(0x005f); unicode_input_finish(); - unicode_input_start(); register_hex(0x25d5); unicode_input_finish(); - TAP_ONCE (KC_SPC); - unicode_input_start(); register_hex(0x0f3d); unicode_input_finish(); - unicode_input_start(); register_hex(0x3064); unicode_input_finish(); - break; - case SMILE: - unicode_input_start(); register_hex(0x0298); unicode_input_finish(); - unicode_input_start(); register_hex(0x203f); unicode_input_finish(); - unicode_input_start(); register_hex(0x0298); unicode_input_finish(); - break; - case SMILE2: - unicode_input_start(); register_hex(0x0028); unicode_input_finish(); - unicode_input_start(); register_hex(0x0298); unicode_input_finish(); - unicode_input_start(); register_hex(0x203f); unicode_input_finish(); - unicode_input_start(); register_hex(0x0298); unicode_input_finish(); - unicode_input_start(); register_hex(0x0029); unicode_input_finish(); - break; - case HMM1: - unicode_input_start(); register_hex(0x0ca0); unicode_input_finish(); - unicode_input_start(); register_hex(0x005f); unicode_input_finish(); - unicode_input_start(); register_hex(0x0ca0); unicode_input_finish(); - break; - case HMM2: - unicode_input_start(); register_hex(0x0028); unicode_input_finish(); - unicode_input_start(); register_hex(0x0ca0); unicode_input_finish(); - unicode_input_start(); register_hex(0x005f); unicode_input_finish(); - unicode_input_start(); register_hex(0x0ca0); unicode_input_finish(); - unicode_input_start(); register_hex(0x0029); unicode_input_finish(); - break; - case BEAR1: - unicode_input_start(); register_hex(0x0295); unicode_input_finish(); - unicode_input_start(); register_hex(0x2022); unicode_input_finish(); - unicode_input_start(); register_hex(0x1d25); unicode_input_finish(); - unicode_input_start(); register_hex(0x2022); unicode_input_finish(); - unicode_input_start(); register_hex(0x0294); unicode_input_finish(); - break; - case BEAR2: - unicode_input_start(); register_hex(0x0028); unicode_input_finish(); - unicode_input_start(); register_hex(0x1d54); unicode_input_finish(); - unicode_input_start(); register_hex(0x1d25); unicode_input_finish(); - unicode_input_start(); register_hex(0x1d54); unicode_input_finish(); - unicode_input_start(); register_hex(0x0029); unicode_input_finish(); - break; - case FUU: - unicode_input_start(); register_hex(0x256d); unicode_input_finish(); - unicode_input_start(); register_hex(0x2229); unicode_input_finish(); - unicode_input_start(); register_hex(0x256e); unicode_input_finish(); - unicode_input_start(); register_hex(0x0028); unicode_input_finish(); - unicode_input_start(); register_hex(0x002d); unicode_input_finish(); - unicode_input_start(); register_hex(0x005f); unicode_input_finish(); - unicode_input_start(); register_hex(0x002d); unicode_input_finish(); - unicode_input_start(); register_hex(0x0029); unicode_input_finish(); - unicode_input_start(); register_hex(0x256d); unicode_input_finish(); - unicode_input_start(); register_hex(0x2229); unicode_input_finish(); - unicode_input_start(); register_hex(0x256e); unicode_input_finish(); - break; - case EGGY1: - unicode_input_start(); register_hex(0x0028); unicode_input_finish(); - unicode_input_start(); register_hex(0x256f); unicode_input_finish(); - unicode_input_start(); register_hex(0x00b0); unicode_input_finish(); - unicode_input_start(); register_hex(0x25a1); unicode_input_finish(); - unicode_input_start(); register_hex(0x00b0); unicode_input_finish(); - unicode_input_start(); register_hex(0xff09); unicode_input_finish(); - unicode_input_start(); register_hex(0x256f); unicode_input_finish(); - break; - case EGGY2: - unicode_input_start(); register_hex(0x30ce); unicode_input_finish(); - unicode_input_start(); register_hex(0x0028); unicode_input_finish(); - unicode_input_start(); register_hex(0x0020); unicode_input_finish(); - unicode_input_start(); register_hex(0x309c); unicode_input_finish(); - unicode_input_start(); register_hex(0x002d); unicode_input_finish(); - unicode_input_start(); register_hex(0x309c); unicode_input_finish(); - unicode_input_start(); register_hex(0x30ce); unicode_input_finish(); - unicode_input_start(); register_hex(0x0029); unicode_input_finish(); - break; - case FACE1: - unicode_input_start(); register_hex(0x0028); unicode_input_finish(); - unicode_input_start(); register_hex(0x002d); unicode_input_finish(); - unicode_input_start(); register_hex(0x005f); unicode_input_finish(); - unicode_input_start(); register_hex(0x002d); unicode_input_finish(); - unicode_input_start(); register_hex(0x0029); unicode_input_finish(); - break; - case FACE2: - unicode_input_start(); register_hex(0x0028); unicode_input_finish(); - unicode_input_start(); register_hex(0x2022); unicode_input_finish(); - unicode_input_start(); register_hex(0x005f); unicode_input_finish(); - unicode_input_start(); register_hex(0x2022); unicode_input_finish(); - unicode_input_start(); register_hex(0x0029); unicode_input_finish(); - break; - case UHU: - unicode_input_start(); register_hex(0x2299); unicode_input_finish(); - unicode_input_start(); register_hex(0xfe4f); unicode_input_finish(); - unicode_input_start(); register_hex(0x2299); unicode_input_finish(); - break; - case SMRK1: - unicode_input_start(); register_hex(0x005e); unicode_input_finish(); - unicode_input_start(); register_hex(0x032e); unicode_input_finish(); - unicode_input_start(); register_hex(0x005e); unicode_input_finish(); - break; - } - break; - case EMOJI2: - switch(opt) { - case SMRK2: - unicode_input_start(); register_hex(0x0028); unicode_input_finish(); - unicode_input_start(); register_hex(0x005e); unicode_input_finish(); - unicode_input_start(); register_hex(0x032e); unicode_input_finish(); - unicode_input_start(); register_hex(0x005e); unicode_input_finish(); - unicode_input_start(); register_hex(0x0029); unicode_input_finish(); - break; - case LOVE: - unicode_input_start(); register_hex(0x2665); unicode_input_finish(); - unicode_input_start(); register_hex(0x203f); unicode_input_finish(); - unicode_input_start(); register_hex(0x2665); unicode_input_finish(); - break; - } - break; +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + switch (keycode) { + case I3_RUN: + tap_code16(C(KC_I)); + tap_code(KC_R); + return false; + case VRSN: + SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + return false; + case I3_GO_GROUP_1 ... I3_GO_GROUP_10: + tap_code16(C(KC_I)); + tap_code(KC_G); + if (keycode == I3_GO_GROUP_10) { + tap_code(KC_0); + } else { + tap_code(KC_1 + (keycode - I3_GO_GROUP_1)); + } + return false; + case EMOJI_SHRUG: + send_unicode_string("¯\\_(ツ)_/¯"); + return false; + case EMOJI_YAY: + SEND_STRING("\\o/"); + return false; + case EMOJI_HUG: + send_unicode_string("༼ つ ◕_◕ ༽つ"); + return false; + case EMOJI_SMILE: + send_unicode_string("ʘ‿ʘ"); + return false; + case EMOJI_SMILE2: + send_unicode_string("(ʘ‿ʘ)"); + return false; + case EMOJI_HMM1: + send_unicode_string("ಠ_ಠ"); + return false; + case EMOJI_HMM2: + send_unicode_string("(ಠ_ಠ)"); + return false; + case EMOJI_BEAR1: + send_unicode_string("ʕ•ᴥ•ʔ"); + return false; + case EMOJI_BEAR2: + send_unicode_string("(ᵔᴥᵔ)"); + return false; + case EMOJI_FUU: + send_unicode_string("╭∩╮(-_-)╭∩╮"); + return false; + case EMOJI_EGGY1: + send_unicode_string("(╯°□°)╯"); + return false; + case EMOJI_EGGY2: + send_unicode_string("ノ( ゜-゜ノ)"); + return false; + case EMOJI_FACE1: + SEND_STRING("(-_-)"); + return false; + case EMOJI_FACE2: + send_unicode_string("(•_•)"); + return false; + case EMOJI_UHU: + send_unicode_string("⊙﹏⊙"); + return false; + case EMOJI_SMRK1: + send_unicode_string("^̮^"); + return false; + case EMOJI_SMRK2: + send_unicode_string("(^̮^)"); + return false; + case EMOJI_LOVE: + send_unicode_string("♥‿♥"); + return false; + } } - } + return true; } -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { - if (record->event.pressed) { - switch(id) { - case RUN: - return MACRO( D(LCTL), T(I), U(LCTL), T(R), END ); - break; - } - } - return MACRO_NONE; -}; - // Runs just one time when the keyboard initializes. void matrix_init_user(void) { set_unicode_input_mode(UC_LNX); |