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 | |
parent | e69c325a9ce84bc144dbc89978f800fc7560757d (diff) |
Migrate more `fn_actions` stuff (#13502)
Diffstat (limited to 'layouts/community/ergodox')
8 files changed, 291 insertions, 439 deletions
diff --git a/layouts/community/ergodox/coderkun_neo2/keymap.c b/layouts/community/ergodox/coderkun_neo2/keymap.c index b38c99f2ea..b731ab4950 100644 --- a/layouts/community/ergodox/coderkun_neo2/keymap.c +++ b/layouts/community/ergodox/coderkun_neo2/keymap.c @@ -215,12 +215,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; -const uint16_t PROGMEM fn_actions[] = { - [BASE] = ACTION_FUNCTION(BASE), - [PMQ] = ACTION_FUNCTION(PMQ), - [PMN] = ACTION_FUNCTION(PMN), -}; - // Runs just one time when the keyboard initializes. void matrix_init_user(void) { set_unicode_input_mode(UC_LNX); diff --git a/layouts/community/ergodox/colemak_osx_pc_no/keymap.c b/layouts/community/ergodox/colemak_osx_pc_no/keymap.c index e94e6f219c..b9986e0e9d 100644 --- a/layouts/community/ergodox/colemak_osx_pc_no/keymap.c +++ b/layouts/community/ergodox/colemak_osx_pc_no/keymap.c @@ -9,6 +9,18 @@ #define NUMB_SYMB_MAC 3 // numbers and symbols mac #define FUNCTION 4 // function keys +enum custom_keycodes { + TILDE_NO = SAFE_RANGE, + LESS_NO, + GRTR_NO, + CIRC_NO, + ACUT_NO, + GRV_NO, + LESS_NO_MAC, + GRTR_NO_MAC, + ACUT_NO_MAC +}; + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap 0: Basic layer PC @@ -43,11 +55,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { NO_PLUS, OSM(MOD_LSFT),CTL_T(KC_DOT),ALT_T(NO_MINS), // right hand - KC_FN5, NO_DLR, NO_LPRN, NO_RPRN ,KC_FN3, KC_FN4,NO_AT, + CIRC_NO, NO_DLR, NO_LPRN, NO_RPRN ,LESS_NO, GRTR_NO,NO_AT, NO_QUOT, KC_J, KC_L, KC_U, KC_Y, NO_ARNG, NO_AE , KC_H, KC_N, KC_E, KC_I, KC_O, NO_OSTR, NO_EQL, KC_K, KC_M, KC_RIGHT, KC_DOWN, KC_UP, NO_UNDS, - KC_LEFT, KC_ESC, KC_FN7, KC_HASH, MO(2), + KC_LEFT, KC_ESC, GRV_NO, KC_HASH, MO(2), KC_INSERT, NO_SLSH, KC_DEL, KC_BSPC,KC_ENT,KC_SPC @@ -83,7 +95,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS,GUI_T(KC_DOT) , KC_TRNS, // right hand - KC_TRNS, S(NO_4), KC_TRNS,KC_TRNS,KC_FN8, KC_FN9,NO_QUOT, + KC_TRNS, S(NO_4), KC_TRNS,KC_TRNS,LESS_NO_MAC, GRTR_NO_MAC,NO_QUOT, NO_LABK, 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, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, @@ -125,7 +137,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, // right hand KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_FN2, KC_FN6 , KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, TILDE_NO, ACUT_NO , KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_5, KC_6, KC_7, KC_8, KC_TRNS, KC_TRNS, KC_HOME, KC_9, KC_END, KC_PGDN, KC_PGUP, KC_TRNS, KC_HOME, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, @@ -166,7 +178,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, // right hand KC_TRNS, KC_TRNS, KC_TRNS , KC_TRNS, KC_TRNS , KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_FN2, KC_FN10, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, TILDE_NO, ACUT_NO_MAC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_5, KC_6, KC_7, KC_8, KC_TRNS, KC_TRNS, KC_HOME, KC_9, KC_END, KC_PGDN, KC_PGUP, KC_TRNS, KC_HOME, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, @@ -217,47 +229,57 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) }; -enum macro_id { - TILDE_NO, LESS_NO, GRTR_NO, CIRC_NO, ACUT_NO, GRV_NO, LESS_NO_MAC, GRTR_NO_MAC, ACUT_NO_MAC -}; - -const uint16_t PROGMEM fn_actions[] = { - [2] = ACTION_MACRO(TILDE_NO), // Completed ~ character(pc and mac), no space needed. - [3] = ACTION_MACRO(LESS_NO), // < completed on keypress down, to avoid shifting the next character if it is not released first. - [4] = ACTION_MACRO(GRTR_NO), // > completed on keypress down, to avoid shifting the next character if it is not released first. - [5] = ACTION_MACRO(CIRC_NO), // Completed ^ character, no space needed. - [6] = ACTION_MACRO(ACUT_NO), // Completed ´ character, no space needed. - [7] = ACTION_MACRO(GRV_NO), // Completed ` character, no space needed. - [8] = ACTION_MACRO(LESS_NO_MAC), // < completed on keypress down, to avoid same button problem when typing <> quickly - [9] = ACTION_MACRO(GRTR_NO_MAC), // > completed on keypress down, to avoid same button problem when typing <> quickly - [10] = ACTION_MACRO(ACUT_NO_MAC), // Completed ´ character, no space needed -}; - - - -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - keyevent_t event = record->event; - - switch (id) { +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { case TILDE_NO: - return (event.pressed ? MACRO( D(RALT), T(RBRC), U(RALT), T(SPC), END ) : MACRO_NONE); + if (record->event.pressed) { + tap_code16(ALGR(KC_RBRC)); + tap_code(KC_SPC); + } + return false; case LESS_NO: - return (event.pressed ? MACRO( T(NUBS), END ) : MACRO_NONE); + if (record->event.pressed) { + tap_code(KC_NUBS); + } + return false; case GRTR_NO: - return (event.pressed ? MACRO( D(LSFT), T(NUBS), U(LSFT), END ) : MACRO_NONE); + if (record->event.pressed) { + tap_code16(S(KC_NUBS)); + } + return false; case CIRC_NO: - return (event.pressed ? MACRO( D(LSFT), T(RBRC), U(LSFT), T(SPC), END ) : MACRO_NONE); + if (record->event.pressed) { + tap_code16(S(KC_RBRC)); + tap_code(KC_SPC); + } + return false; case ACUT_NO: - return (event.pressed ? MACRO( D(RALT), T(EQL), U(RALT), T(SPC), END ) : MACRO_NONE); + if (record->event.pressed) { + tap_code16(ALGR(KC_EQL)); + tap_code(KC_SPC); + } + return false; case GRV_NO: - return (event.pressed ? MACRO( D(LSFT), T(EQL), T(SPC), U(LSFT), END ) : MACRO_NONE); + if (record->event.pressed) { + SEND_STRING(SS_LSFT("= ")); + } + return false; case LESS_NO_MAC: - return (event.pressed ? MACRO( T(GRV), END ) : MACRO_NONE); + if (record->event.pressed) { + tap_code(KC_GRV); + } + return false; case GRTR_NO_MAC: - return (event.pressed ? MACRO( D(LSFT), T(GRV), U(LSFT), END ) : MACRO_NONE); + if (record->event.pressed) { + tap_code16(S(KC_GRV)); + } + return false; case ACUT_NO_MAC: - return (event.pressed ? MACRO( T(EQL), T(SPC), END ) : MACRO_NONE); + if (record->event.pressed) { + tap_code(KC_EQL); + tap_code(KC_SPC); + } + return false; } - return MACRO_NONE; -}; + return true; +} 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); diff --git a/layouts/community/ergodox/guni/keymap.c b/layouts/community/ergodox/guni/keymap.c index 0707bcf774..cc67fbdeaa 100644 --- a/layouts/community/ergodox/guni/keymap.c +++ b/layouts/community/ergodox/guni/keymap.c @@ -1,7 +1,4 @@ #include QMK_KEYBOARD_H -#include "debug.h" -#include "action_layer.h" -#include "bootloader.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LAYOUT_ergodox( // layer 0 : default @@ -13,7 +10,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LGUI , KC_GRV,KC_LEFT,KC_RGHT,KC_LALT, KC_NO , KC_NO , KC_NO , - KC_BSPC,KC_DEL ,KC_FN23, + KC_BSPC,KC_DEL ,TO(3), // right hand KC_RBRC , KC_6, KC_7 , KC_8, KC_9, KC_0, KC_MINS, KC_END , KC_Y, KC_U , KC_I, KC_O, KC_P, MT(MOD_RCTL, KC_BSLS), @@ -34,7 +31,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS, - KC_TRNS,KC_TRNS,KC_FN1, + KC_TRNS,KC_TRNS,TO(0), // right hand KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS, KC_TRNS,KC_EXLM,LSFT(KC_COMM),LSFT(KC_DOT),KC_EQL,KC_AMPR, KC_TRNS, @@ -55,7 +52,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS, - KC_TRNS,KC_TRNS,KC_FN1 , + KC_TRNS,KC_TRNS,TO(0) , // right hand KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS ,KC_TRNS, KC_HOME, KC_TRNS, KC_TRNS, KC_END ,KC_TRNS, @@ -68,14 +65,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), LAYOUT_ergodox( // layer 3 : teensy bootloader functions // left hand - KC_FN0, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + RESET, 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, 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, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS, - KC_TRNS,KC_TRNS,KC_FN1 , + KC_TRNS,KC_TRNS,TO(0) , // right hand 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,KC_TRNS, @@ -110,31 +107,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; - -/* id for user defined functions */ -enum function_id { - TEENSY_KEY, -}; - -/* - * Fn action definition - */ -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(TEENSY_KEY), // FN0 - Teensy key - [1] = ACTION_LAYER_SET(0, ON_PRESS), - [23] = ACTION_LAYER_SET(3, ON_PRESS), - [24] = ACTION_LAYER_SET(2, ON_PRESS), - [26] = ACTION_LAYER_SET(1, ON_PRESS), -}; - -void action_function(keyrecord_t *event, uint8_t id, uint8_t opt) -{ - - if (id == TEENSY_KEY) { - clear_keyboard(); - print("\n\nJump to bootloader... "); - wait_ms(250); - bootloader_jump(); // should not return - print("not supported.\n"); - } -} diff --git a/layouts/community/ergodox/norwegian_programmer_osx_pc/keymap.c b/layouts/community/ergodox/norwegian_programmer_osx_pc/keymap.c index 2315284492..2ddd7ab209 100644 --- a/layouts/community/ergodox/norwegian_programmer_osx_pc/keymap.c +++ b/layouts/community/ergodox/norwegian_programmer_osx_pc/keymap.c @@ -7,6 +7,18 @@ #define BASE_MAC 1 // default layer mac #define NUMB_FUNC 2 // numbers and function keys +enum custom_keycodes { + TILDE_NO = SAFE_RANGE, + LESS_NO, + GRTR_NO, + CIRC_NO, + ACUT_NO, + GRV_NO, + LESS_NO_MAC, + GRTR_NO_MAC, + ACUT_NO_MAC +}; + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap 0: Basic layer PC @@ -32,16 +44,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [BASE] = LAYOUT_ergodox( // left hand - KC_PAST, NO_LBRC, NO_RBRC, NO_LCBR, NO_RCBR, KC_FN2, TG(1), + KC_PAST, NO_LBRC, NO_RBRC, NO_LCBR, NO_RCBR, TILDE_NO, TG(1), KC_PPLS, KC_Q, KC_W, KC_E, KC_R, KC_T, NO_DQUO, KC_PSLS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_PMNS, KC_Z, KC_X, KC_C, KC_V, KC_B, NO_SCLN, ALT_T(KC_ESC), KC_EXLM , NO_QUES, NO_COLN, KC_TAB, - KC_HASH, KC_FN7, - KC_FN6, + KC_HASH, GRV_NO, + ACUT_NO, OSM(MOD_LSFT),CTL_T(KC_DOT),GUI_T(KC_COMMA), // right hand - KC_FN5, NO_DLR, NO_LPRN, NO_RPRN ,KC_FN3, KC_FN4,NO_AT, + CIRC_NO, NO_DLR, NO_LPRN, NO_RPRN ,LESS_NO, GRTR_NO,NO_AT, NO_QUOT, KC_Y, KC_U, KC_I, KC_O, KC_P, NO_ARNG, KC_H, KC_J, KC_K, KC_L, NO_OSTR, NO_AE, NO_EQL, KC_N, KC_M, KC_RIGHT, KC_DOWN, KC_UP, NO_BSLS, @@ -78,10 +90,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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, ALGR(NO_BSLS), - KC_FN10, + ACUT_NO_MAC, KC_TRNS,GUI_T(KC_DOT) , CTL_T(KC_COMMA), // right hand - KC_TRNS, S(NO_4), KC_TRNS,KC_TRNS,KC_FN8, KC_FN9,NO_QUOT, + KC_TRNS, S(NO_4), KC_TRNS,KC_TRNS,LESS_NO_MAC, GRTR_NO_MAC,NO_QUOT, NO_LABK, 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, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, S(ALGR(NO_7)), @@ -133,47 +145,57 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) }; -enum macro_id { - TILDE_NO, LESS_NO, GRTR_NO, CIRC_NO, ACUT_NO, GRV_NO, LESS_NO_MAC, GRTR_NO_MAC, ACUT_NO_MAC -}; - -const uint16_t PROGMEM fn_actions[] = { - [2] = ACTION_MACRO(TILDE_NO), // Completed ~ character(pc and mac), no space needed. - [3] = ACTION_MACRO(LESS_NO), // < completed on keypress down, to avoid shifting the next character if it is not released first. - [4] = ACTION_MACRO(GRTR_NO), // > completed on keypress down, to avoid shifting the next character if it is not released first. - [5] = ACTION_MACRO(CIRC_NO), // Completed ^ character, no space needed. - [6] = ACTION_MACRO(ACUT_NO), // Completed ´ character, no space needed. - [7] = ACTION_MACRO(GRV_NO), // Completed ` character, no space needed. - [8] = ACTION_MACRO(LESS_NO_MAC), // < completed on keypress down, to avoid same button problem when typing <> quickly - [9] = ACTION_MACRO(GRTR_NO_MAC), // > completed on keypress down, to avoid same button problem when typing <> quickly - [10] = ACTION_MACRO(ACUT_NO_MAC), // Completed ´ character, no space needed -}; - - - -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - keyevent_t event = record->event; - - switch (id) { +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { case TILDE_NO: - return (event.pressed ? MACRO( D(RALT), T(RBRC), U(RALT), T(SPC), END ) : MACRO_NONE); + if (record->event.pressed) { + tap_code16(ALGR(KC_RBRC)); + tap_code(KC_SPC); + } + return false; case LESS_NO: - return (event.pressed ? MACRO( T(NUBS), END ) : MACRO_NONE); + if (record->event.pressed) { + tap_code(KC_NUBS); + } + return false; case GRTR_NO: - return (event.pressed ? MACRO( D(LSFT), T(NUBS), U(LSFT), END ) : MACRO_NONE); + if (record->event.pressed) { + tap_code16(S(KC_NUBS)); + } + return false; case CIRC_NO: - return (event.pressed ? MACRO( D(LSFT), T(RBRC), U(LSFT), T(SPC), END ) : MACRO_NONE); + if (record->event.pressed) { + tap_code16(S(KC_RBRC)); + tap_code(KC_SPC); + } + return false; case ACUT_NO: - return (event.pressed ? MACRO( D(RALT), T(EQL), U(RALT), T(SPC), END ) : MACRO_NONE); + if (record->event.pressed) { + tap_code16(ALGR(KC_EQL)); + tap_code(KC_SPC); + } + return false; case GRV_NO: - return (event.pressed ? MACRO( D(LSFT), T(EQL), T(SPC), U(LSFT), END ) : MACRO_NONE); + if (record->event.pressed) { + SEND_STRING(SS_LSFT("= ")); + } + return false; case LESS_NO_MAC: - return (event.pressed ? MACRO( T(GRV), END ) : MACRO_NONE); + if (record->event.pressed) { + tap_code(KC_GRV); + } + return false; case GRTR_NO_MAC: - return (event.pressed ? MACRO( D(LSFT), T(GRV), U(LSFT), END ) : MACRO_NONE); + if (record->event.pressed) { + tap_code16(S(KC_GRV)); + } + return false; case ACUT_NO_MAC: - return (event.pressed ? MACRO( T(EQL), T(SPC), END ) : MACRO_NONE); + if (record->event.pressed) { + tap_code(KC_EQL); + tap_code(KC_SPC); |