diff options
-rw-r--r-- | keyboards/ergodox_ez/keymaps/danielo515/config.h | 4 | ||||
-rw-r--r-- | keyboards/ergodox_ez/keymaps/danielo515/keymap.c | 16 | ||||
-rw-r--r-- | keyboards/redox_w/keymaps/danielo515/config.h | 6 | ||||
-rw-r--r-- | keyboards/redox_w/keymaps/danielo515/keymap.c | 159 | ||||
-rw-r--r-- | keyboards/redox_w/keymaps/danielo515/readme.md | 2 | ||||
-rw-r--r-- | keyboards/redox_w/keymaps/danielo515/rules.mk | 6 | ||||
-rw-r--r-- | users/danielo515/alt_tab.c | 38 | ||||
-rw-r--r-- | users/danielo515/alt_tab.h | 4 | ||||
-rw-r--r-- | users/danielo515/combo.c | 35 | ||||
-rw-r--r-- | users/danielo515/config.h | 8 | ||||
-rw-r--r-- | users/danielo515/danielo515.c | 436 | ||||
-rw-r--r-- | users/danielo515/danielo515.h | 100 | ||||
-rw-r--r-- | users/danielo515/process_records.c | 167 | ||||
-rw-r--r-- | users/danielo515/process_records.h | 104 | ||||
-rw-r--r-- | users/danielo515/rules.mk | 4 | ||||
-rw-r--r-- | users/danielo515/tap_dance.h | 1 |
16 files changed, 609 insertions, 481 deletions
diff --git a/keyboards/ergodox_ez/keymaps/danielo515/config.h b/keyboards/ergodox_ez/keymaps/danielo515/config.h index 6a3d37f1c6..8982e76536 100644 --- a/keyboards/ergodox_ez/keymaps/danielo515/config.h +++ b/keyboards/ergodox_ez/keymaps/danielo515/config.h @@ -16,10 +16,6 @@ #undef MOUSEKEY_WHEEL_TIME_TO_MAX #define MOUSEKEY_WHEEL_TIME_TO_MAX 60 -// Timeout settings for leader key -#undef LEADER_TIMEOUT -#define LEADER_TIMEOUT 350 -#define LEADER_PER_KEY_TIMING #undef DEBOUNCE #define DEBOUNCE 45 diff --git a/keyboards/ergodox_ez/keymaps/danielo515/keymap.c b/keyboards/ergodox_ez/keymaps/danielo515/keymap.c index 538eab0163..ee8c321352 100644 --- a/keyboards/ergodox_ez/keymaps/danielo515/keymap.c +++ b/keyboards/ergodox_ez/keymaps/danielo515/keymap.c @@ -36,9 +36,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { OSM(MOD_LSFT) ,LT(2,KC_BSPACE) ,OSM(MOD_LGUI) , - TO(1) ,KC_6 ,KC_7 ,KC_8 ,TD_F9 ,LT(3,KC_0) ,KC_DQUO , + TO(1) ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,LT(3,KC_0) ,KC_DQUO , KC_UNDS ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,RSFT_T(KC_MINUS) , - HYPR_T(KC_H) ,ALT_T(KC_J) ,RCTL_T(KC_K) ,LT(6,KC_L) ,TD_CLN ,GUI_T(KC_QUOTE) , + HYPR_H ,ALT_J ,CTL_K ,LT(6,KC_L) ,TD_CLN ,CMD_QUOT , ALT_TAB ,KC_N ,MEH_T(KC_M) ,KC_COMMA ,KC_DOT ,KC_SLASH ,LT(4,KC_KP_ASTERISK), LT(4,KC_ENTER) ,KC_DOWN ,KC_LBRACKET ,KC_RBRACKET ,OSL(2) , KC_AUDIO_MUTE ,KC_ESCAPE , @@ -88,14 +88,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRANSPARENT ,KC_TRANSPARENT ,KC_TRANSPARENT ,KC_LABK ,KC_RABK ,KC_TRANSPARENT ,KC_TRANSPARENT , KC_TRANSPARENT ,KC_AT ,KC_TRANSPARENT ,KC_EQL ,F_ARROW ,KC_GRAVE , KC_TRANSPARENT ,KC_TRANSPARENT ,KC_TRANSPARENT ,KC_LBRACKET ,KC_RBRACKET ,KC_TRANSPARENT ,KC_TRANSPARENT , - KC_TRANSPARENT ,KC_TRANSPARENT ,KC_TRANSPARENT ,KC_TRANSPARENT ,KC_TRANSPARENT , + KC_TRANSPARENT ,KC_TRANSPARENT ,KC_TRANSPARENT ,IARROW ,ARROW , KC_TRANSPARENT ,KC_TRANSPARENT , KC_TRANSPARENT , // Right hand KC_TRANSPARENT ,KC_TRANSPARENT ,KC_TRANSPARENT , KC_TRANSPARENT ,KC_TRANSPARENT ,KC_TRANSPARENT ,KC_TRANSPARENT ,KC_TRANSPARENT ,KC_TRANSPARENT ,KC_TRANSPARENT , LALT(LSFT(KC_UP)) ,KC_HASH ,KC_LCBR ,KC_RCBR ,KC_KP_ASTERISK ,KC_PERC ,KC_DLR , - KC_AMPR ,KC_LPRN ,KC_RPRN ,KC_CIRC ,KC_KP_PLUS ,KC_PIPE , + KC_AMPR ,KC_LPRN ,KC_RPRN ,CLN_EQ ,KC_KP_PLUS ,KC_PIPE , LALT(LSFT(KC_DOWN)),KC_EXLM ,KC_TILD ,KC_CIRC ,ARROW ,KC_BSLASH ,KC_BSLASH , KC_TRANSPARENT ,KC_TRANSPARENT ,KC_TRANSPARENT ,KC_TRANSPARENT ,KC_TRANSPARENT , RESET ,KC_TRANSPARENT , @@ -316,3 +316,11 @@ void oneshot_mods_changed_user(uint8_t mods) { void oneshot_locked_mods_changed_user(uint8_t mods) { oneshot_mods_changed_user(mods); } + +//=============== alt_tab callbacks +void alt_tab_activated(void){ + layer_on(7); // activate motion layer +} +void alt_tab_deactivated(void){ + layer_off(7); // activate motion layer +} diff --git a/keyboards/redox_w/keymaps/danielo515/config.h b/keyboards/redox_w/keymaps/danielo515/config.h new file mode 100644 index 0000000000..43d4ff9cb2 --- /dev/null +++ b/keyboards/redox_w/keymaps/danielo515/config.h @@ -0,0 +1,6 @@ +#pragma once + +#define IGNORE_MOD_TAP_INTERRUPT +#define TAPPING_TERM 200 +#undef ONESHOT_TIMEOUT +#define ONESHOT_TIMEOUT 1500 diff --git a/keyboards/redox_w/keymaps/danielo515/keymap.c b/keyboards/redox_w/keymaps/danielo515/keymap.c new file mode 100644 index 0000000000..2b37a4be33 --- /dev/null +++ b/keyboards/redox_w/keymaps/danielo515/keymap.c @@ -0,0 +1,159 @@ +#include QMK_KEYBOARD_H +#include "danielo515.h" + +// Shortcut to make keymap more readable +# define SYM_L OSL(_SYMB) + +# define KC_ALAS LALT_T(KC_PAST) // alt or keypad * +# define KC_CTPL LCTL_T(KC_BSLS) // <C-\> + +# define KC_NAGR LT(_NAV, KC_GRV) +# define KC_NAMI LT(_NAV, KC_MINS) +# define AD_ESC LT(_ADJUST, KC_ESC) +# define NAV_SPC LT(_NAV, KC_SPACE) + +# define KC_ADPU LT(_ADJUST, KC_PGUP) +# define WIN_LEFT WIN_TO_LEFT +# define WIN_RIGHT WIN_TO_RIGHT +# define COPY_CUT TD(COPY_CUT) +# define TD_PASTE TD(PASTE_DANCE) +# define CTL OSM(MOD_LCTL) +# define ALT OSM(MOD_LALT) +# define GUI OSM(MOD_LGUI) +# define ENT_SYM LT(_SYMB, KC_ENT) +# define __S LT(_S,KC_S) + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = LAYOUT( + //┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ + KC_NAGR ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 , KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_DQUO , + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + KC_TAB ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,TD_PASTE, ALT_TAB ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,SFT_MINS, + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + SHIFT ,KC_A ,__S ,FN_D ,FN_F ,KC_G ,COPY_CUT, KC_UNDS ,HYPR_H ,ALT_J ,CTL_K ,KC_L ,TD_CLN ,CMD_QUOT, + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + KC_BSLS ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,KC_DEL ,KC_PGDN , ALT_TAB ,AD_ESC ,KC_N ,KC_M ,KC_COMM ,KC_DOT ,KC_SLSH ,KC_ASTR , + //├────────┼────────┼────────┼────────┼────┬───┴────┬───┼────────┼────────┤ ├────────┼────────┼───┬────┴───┬────┼────────┼────────┼────────┼────────┤ + CTL ,ALT ,KC_LEFT ,KC_RIGHT, GUI , SHIFT ,KC_BSPC , KC_LEAD ,NAV_SPC , ENT_SYM, KC_LBRC ,KC_RBRC ,KC_DOWN ,KC_UP + //└────────┴────────┴────────┴────────┘ └────────┘ └────────┴────────┘ └────────┴────────┘ └────────┘ └────────┴────────┴────────┴────────┘ + ), + + [_SYMB] = LAYOUT( + //┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ + _______ ,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 , KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_F11 , + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + _______ ,KC_EXLM ,KC_DLR ,KC_LCBR ,KC_RCBR ,KC_PIPE ,_______ , _______ ,KC_PSLS ,KC_P7 ,KC_P8 ,KC_P9 ,KC_PERC ,KC_PMNS , + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + _______ ,KC_AT ,KC_DLR , KC_LPRN, KC_RPRN,KC_GRV ,_______ , _______ ,KC_PAST ,KC_P4 ,KC_P5 ,KC_P6 ,KC_PPLS ,KC_BSPC , + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + _______ ,KC_PERC ,KC_CIRC ,KC_LBRC ,KC_RBRC ,KC_TILD ,_______ ,_______ , _______ ,_______ ,KC_COLN ,KC_P1 ,KC_P2 ,KC_P3 ,KC_PENT ,XXXXXXX , + //├────────┼────────┼────────┼────────┼────┬───┴────┬───┼────────┼────────┤ ├────────┼────────┼───┬────┴───┬────┼────────┼────────┼────────┼────────┤ + _______ ,_______ ,_______ ,_______ , _______ , _______ ,_______ , _______ ,_______ , KC_P0 , KC_P0 ,KC_PDOT ,KC_PENT ,XXXXXXX + //└────────┴────────┴────────┴────────┘ └────────┘ └────────┴────────┘ └────────┴────────┘ └────────┘ └────────┴────────┴────────┴────────┘ + ), + + [_NAV] = LAYOUT( + //┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ + _______ ,_______ ,_______ ,_______ ,_______ ,_______ , _______ ,_______ ,_______ ,_______ ,_______ ,_______ , + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + XXXXXXX ,XXXXXXX ,KC_MS_U ,XXXXXXX ,KC_WH_U ,XXXXXXX ,_______ , _______ ,XXXXXXX,SFT_LEFT,SFT_RIGHT,XXXXXXX ,XXXXXXX ,XXXXXXX , + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + XXXXXXX ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_WH_D ,XXXXXXX ,_______ , _______ ,KC_LEFT ,KC_DOWN ,KC_UP ,KC_RIGHT,XXXXXXX ,XXXXXXX , + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,_______ ,_______ , _______ ,XXXXXXX ,KC_HOME ,CTL_LEFT,CTL_RIGHT,XXXXXXX,XXXXXXX ,XXXXXXX , + //├────────┼────────┼────────┼────────┼────┬───┴────┬───┼────────┼────────┤ ├────────┼────────┼───┬────┴───┬────┼────────┼────────┼────────┼────────┤ + XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , KC_BTN1 , KC_BTN2 ,_______ , _______ ,_______ , XXXXXXX , XXXXXXX ,XXXXXXX ,WIN_LEFT,WIN_RIGHT + //└────────┴────────┴────────┴────────┘ └────────┘ └────────┴────────┘ └────────┴────────┘ └────────┘ └────────┴────────┴────────┴────────┘ + ), + [_ADJUST] = LAYOUT( + //┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ + 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 ,KC_F12 , + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , KC_MUTE ,_______ ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , + //├────────┼────────┼────────┼────────┼────┬───┴────┬───┼────────┼────────┤ ├────────┼────────┼───┬────┴───┬────┼────────┼────────┼────────┼────────┤ + XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , XXXXXXX , XXXXXXX ,XXXXXXX , XXXXXXX ,XXXXXXX , XXXXXXX , XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX + //└────────┴────────┴────────┴────────┘ └────────┘ └────────┴────────┘ └────────┴────────┘ └────────┘ └────────┴────────┴────────┴────────┘ + ), +[_F] = LAYOUT( + //┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ + XXXXXXX ,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 , KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_F11 , + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + XXXXXXX ,XXXXXXX ,ALL_WIN ,EXPOSE ,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 ,XXXXXXX ,XXXXXXX , XXXXXXX , XXXXXXX ,XXXXXXX , XXXXXXX ,_______ , XXXXXXX , XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX + //└────────┴────────┴────────┴────────┘ └────────┘ └────────┴────────┘ └────────┴────────┘ └────────┘ └────────┴────────┴────────┴────────┘ + ), + [_D] = LAYOUT( + //┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ + XXXXXXX ,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 , KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_F12 , + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , _______ ,KC_PSLS ,KC_P7 ,KC_P8 ,KC_P9 ,KC_PERC ,KC_PMNS , + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + XXXXXXX ,XXXXXXX ,XXXXXXX ,_______ ,XXXXXXX ,XXXXXXX ,XXXXXXX , _______ ,KC_PAST ,KC_P4 ,KC_P5 ,KC_P6 ,KC_PPLS ,KC_BSPC , + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , _______ ,_______ ,KC_COLN ,KC_P1 ,KC_P2 ,KC_P3 ,KC_PENT ,XXXXXXX , + //├────────┼────────┼────────┼────────┼────┬───┴────┬───┼────────┼────────┤ ├────────┼────────┼───┬────┴───┬────┼────────┼────────┼────────┼────────┤ + XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , XXXXXXX , XXXXXXX ,_______ , _______ ,_______ , KC_P0 , KC_P0 ,KC_PDOT ,KC_PENT ,XXXXXXX + //└────────┴────────┴────────┴────────┘ └────────┘ └────────┴────────┘ └────────┴────────┘ └────────┘ └────────┴────────┴────────┴────────┘ + ), + [_S] = LAYOUT( + //┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐ + XXXXXXX ,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 , KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,XXXXXXX , + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + XXXXXXX ,XXXXXXX ,XXXXXXX ,KC_LT ,KC_GT ,XXXXXXX ,XXXXXXX , XXXXXXX ,KC_HASH ,KC_LCBR ,KC_RCBR ,KC_ASTR ,KC_PERC ,KC_DLR , + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + XXXXXXX ,XXXXXXX ,_______ ,KC_EQL ,F_ARROW ,KC_GRAVE,XXXXXXX , XXXXXXX ,KC_AMPR ,KC_LPRN ,KC_RPRN ,CLN_EQ ,KC_PLUS ,KC_PIPE , + //├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤ + XXXXXXX ,XXXXXXX ,XXXXXXX ,KC_CIRC ,KC_DLR ,XXXXXXX ,XXXXXXX ,XXXXXXX , XXXXXXX ,XXXXXXX ,KC_EXLM ,KC_TILD ,KC_CIRC ,ARROW ,KC_BSLASH,IARROW , + //├────────┼────────┼────────┼────────┼────┬───┴────┬───┼────────┼────────┤ ├────────┼────────┼───┬────┴───┬────┼────────┼────────┼────────┼────────┤ + XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , XXXXXXX , XXXXXXX ,_______ , XXXXXXX ,_______ , XXXXXXX , XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX + //└────────┴────────┴────────┴────────┘ └────────┘ └────────┴────────┘ └────────┴────────┘ └────────┘ └────────┴────────┴────────┴────────┘ + ) + +}; + +void alt_tab_activated(void){ + layer_on(_NAV); +}; +void alt_tab_deactivated(void){ + layer_off(_NAV); +}; + +layer_state_t layer_state_set_user(layer_state_t state) { + switch (get_highest_layer(state)) { + case _QWERTY: + set_led_off; + break; + case _SYMB: + case _D: + set_led_green; + break; + case _NAV: + set_led_blue; + break; + case _ADJUST: + set_led_red; + break; + case _S: + set_led_magenta; + break; + case _F: + set_led_white; + break; + default: + break; + } + return state; +} + + diff --git a/keyboards/redox_w/keymaps/danielo515/readme.md b/keyboards/redox_w/keymaps/danielo515/readme.md new file mode 100644 index 0000000000..0db7072b80 --- /dev/null +++ b/keyboards/redox_w/keymaps/danielo515/readme.md @@ -0,0 +1,2 @@ +# Danielo keymap for Redox Wireless +Most of the custom functionality is on my user-space `users/danielo515` diff --git a/keyboards/redox_w/keymaps/danielo515/rules.mk b/keyboards/redox_w/keymaps/danielo515/rules.mk new file mode 100644 index 0000000000..18f126693e --- /dev/null +++ b/keyboards/redox_w/keymaps/danielo515/rules.mk @@ -0,0 +1,6 @@ + +TAP_DANCE_ENABLE = yes # Enable the tap dance feature. +COMBO_ENABLE = yes +LEADER_ENABLE = yes +CONSOLE_ENABLE = no +LTO_ENABLE = yes # link time optimizations diff --git a/users/danielo515/alt_tab.c b/users/danielo515/alt_tab.c new file mode 100644 index 0000000000..1602ee6fb2 --- /dev/null +++ b/users/danielo515/alt_tab.c @@ -0,0 +1,38 @@ +#include "danielo515.h" +#include "alt_tab.h" + +bool altPressed = false; +__attribute__((weak)) void alt_tab_activated(void){}; +__attribute__((weak)) void alt_tab_deactivated(void){}; +extern bool onMac; + +// =============== ALT_TAB single key handling +bool process_alt_tab(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case ALT_TAB: + if (!record->event.pressed) { + return false; + } + if (altPressed) { + tap_code(KC_TAB); + } else { + altPressed = true; + onMac ? register_code(KC_LGUI) : register_code(KC_LALT); + tap_code(KC_TAB); + alt_tab_activated(); + } + // avoid alt releasing if the key is of movement + case KC_RIGHT ... KC_UP: + if (altPressed) { + return true; // yes QMK, do your stuff + } + } + // Reset sticky alt tab when any other key is pressed + if (altPressed) { + onMac ? unregister_code(KC_LGUI) : unregister_code(KC_LALT); + altPressed = false; + alt_tab_deactivated(); + return false; + } + return true; +}; diff --git a/users/danielo515/alt_tab.h b/users/danielo515/alt_tab.h new file mode 100644 index 0000000000..f84350c298 --- /dev/null +++ b/users/danielo515/alt_tab.h @@ -0,0 +1,4 @@ +#pragma once +#include "quantum.h" + +bool process_alt_tab(uint16_t keycode, keyrecord_t *record); diff --git a/users/danielo515/combo.c b/users/danielo515/combo.c index bf7d5f9a8a..1c84143772 100644 --- a/users/danielo515/combo.c +++ b/users/danielo515/combo.c @@ -1,21 +1,36 @@ #include "combo.h" + enum combos { - JK_ESC, - YU_COM, - UI_COM, - IO_COM, - OP_COM, - QW_COM + JK_ESC, + YU_COM, + UI_COM, + IO_COM, + QW_COM, + COM_SLS, + COM_DOT, + M_COMM, + N_M, + OP_COM, }; const uint16_t PROGMEM ui_combo[] = {KC_U, KC_I, COMBO_END}; const uint16_t PROGMEM jk_combo[] = {KC_J, KC_K, COMBO_END}; const uint16_t PROGMEM yu_combo[] = {KC_Y, KC_U, COMBO_END}; const uint16_t PROGMEM io_combo[] = {KC_I, KC_O, COMBO_END}; +const uint16_t PROGMEM qw_combo[] = {KC_Q, KC_W, COMBO_END}; +const uint16_t PROGMEM com_sls[] = {KC_COMMA, KC_SLSH, COMBO_END}; +const uint16_t PROGMEM com_dot[] = {KC_COMMA, KC_DOT, COMBO_END}; +const uint16_t PROGMEM m_comm[] = {KC_M,KC_COMMA, COMBO_END}; +const uint16_t PROGMEM n_m[] = {KC_N, KC_M,COMBO_END}; combo_t key_combos[COMBO_COUNT] = { - [JK_ESC] = COMBO(jk_combo, KC_ESC), - [YU_COM] = COMBO(yu_combo, KC_CIRC), - [UI_COM] = COMBO(ui_combo, KC_ESC), - [IO_COM] = COMBO(io_combo, KC_TILD) + [JK_ESC] = COMBO(jk_combo, KC_ESC), + [YU_COM] = COMBO(yu_combo, KC_CIRC), + [UI_COM] = COMBO(ui_combo, KC_DLR), + [IO_COM] = COMBO(io_combo, KC_TILD), + [QW_COM] = COMBO(qw_combo, KC_AT), + [COM_SLS] = COMBO(com_sls, KC_QUES), + [COM_DOT] = COMBO(com_dot, KC_QUES), + [M_COMM] = COMBO(m_comm, KC_ESC), + [N_M] = COMBO(n_m, KC_DLR), }; diff --git a/users/danielo515/config.h b/users/danielo515/config.h index 65654388d2..fb2472645c 100644 --- a/users/danielo515/config.h +++ b/users/danielo515/config.h @@ -1,6 +1,10 @@ #pragma once #if defined(COMBO_ENABLE) - #define COMBO_COUNT 4 - #define COMBO_TERM 50 + #define COMBO_COUNT 9 + #define COMBO_TERM 40 #endif // !COMBO_ENABLE +// Timeout settings for leader key +#undef LEADER_TIMEOUT +#define LEADER_TIMEOUT 350 +#define LEADER_PER_KEY_TIMING diff --git a/users/danielo515/danielo515.c b/users/danielo515/danielo515.c index f37eebb375..f083650279 100644 --- a/users/danielo515/danielo515.c +++ b/users/danielo515/danielo515.c @@ -1,373 +1,87 @@ #include "danielo515.h" bool onMac = true; -// Send control or GUI depending if we are on windows or mac -bool CMD(uint16_t kc) { - if(onMac){ tap_code16(LGUI(kc)); } else { tap_code16(LCTL(kc)); } - return false; -} - -//**************** Handle keys function *********************// -bool altPressed = false; - -bool process_record_user(uint16_t keycode, keyrecord_t *record) -{ - bool pressed = record->event.pressed; - if(pressed){ - refresh_incremental_macros(keycode); - if(process_incremental_macro(keycode)){ - return false; - } - if(is_macro(keycode)){ - return handle_macro(keycode); - } - switch (keycode) { - case MAC_TGL: - onMac = !onMac; - onMac ? SEND_STRING("On mac") : SEND_STRING("Not on MAC"); - return false; - } - } - switch (keycode) - { - case QWERTY: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(tone_qwerty); - #endif - layer_on(_QWERTY); +//**************** LEADER *********************// +#ifdef LEADER_ENABLE +LEADER_EXTERNS(); +# ifdef RGBLIGHT_ENABLE + +void leader_start() { rgblight_setrgb_range(5, 100, 199, 10, 15); }; + +void leader_end() { rgblight_setrgb_range(200, 200, 255, 10, 15); }; +# endif + +void matrix_scan_user(void) { + if (leading && leader_sequence_size > 0 && timer_elapsed(leader_time) > LEADER_TIMEOUT) { + leading = false; + SEQ_ONE_KEY(KC_T) { SEND_STRING("``" SS_TAP(X_LEFT)); } + // Triple ticks + SEQ_TWO_KEYS(KC_T, KC_T) { SEND_STRING("```" SS_TAP(X_ENTER) SS_TAP(X_ENTER) "```" SS_TAP(X_UP)); } + // ==== International spanish accent vowels ==== + SEQ_ONE_KEY(KC_A) { SEND_STRING(SS_LALT("e") "a"); } + SEQ_ONE_KEY(KC_E) { SEND_STRING(SS_LALT("e") "e"); } + SEQ_ONE_KEY(KC_I) { SEND_STRING(SS_LALT("e") "i"); } + SEQ_ONE_KEY(KC_O) { SEND_STRING(SS_LALT("e") "o"); } + SEQ_ONE_KEY(KC_U) { SEND_STRING(SS_LALT("e") "u"); } + SEQ_ONE_KEY(KC_N) { SEND_STRING(SS_LALT("n") "n"); } + // ==== MACROS === + SEQ_ONE_KEY(KC_G) { SEND_STRING(" | grep "); } + SEQ_ONE_KEY(KC_K) { onMac ? SEND_STRING(SS_LCTRL(" ")) : SEND_STRING(SS_LCTRL("f")); } + // vim delete all + SEQ_TWO_KEYS(KC_D, KC_G) { + if (onMac) { + SEND_STRING(SS_LGUI("a") SS_TAP(X_D)); + } else { + SEND_STRING(SS_LCTRL("a") SS_TAP(X_D)); + } } - return false; - case LOWER: - if (record->event.pressed) { - layer_on(_LOWER); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } else { - layer_off(_LOWER); - update_tri_layer(_LOWER, _RAISE, _ADJUST); + // tripe delete! + SEQ_ONE_KEY(KC_BSPACE) { SEND_STRING(SS_TAP(X_BSPACE) SS_TAP(X_BSPACE) SS_TAP(X_BSPACE)); } + SEQ_TWO_KEYS(KC_P, KC_G) { SEND_STRING("ps -ef | grep "); } + SEQ_TWO_KEYS(KC_J, KC_A) { SEND_STRING("() => {}" SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT) SS_TAP(X_LEFT)); } + // this is a pain to type + SEQ_TWO_KEYS(KC_S, KC_S) { SEND_STRING("~/.ssh/ "); } + SEQ_TWO_KEYS(KC_F, KC_T) { SEND_STRING("feat():" SS_TAP(X_LEFT) SS_TAP(X_LEFT)); } + // ### LAYER CHANGE + SEQ_ONE_KEY(KC_1) { layer_on(1); } + // control enter, because yes + SEQ_ONE_KEY(KC_H) { SEND_STRING(SS_DOWN(X_LCTRL) SS_TAP(X_ENTER) SS_UP(X_LCTRL)); } + // paste all + SEQ_ONE_KEY(KC_P) { + if (onMac) { + SEND_STRING(SS_LGUI("a") SS_LGUI("v")); + } else { + SEND_STRING(SS_LCTRL("a") SS_LCTRL("v")); + } } - return false; - case RAISE: - if (record->event.pressed) { - layer_on(_RAISE); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } else { - layer_off(_RAISE); - update_tri_layer(_LOWER, _RAISE, _ADJUST); + SEQ_THREE_KEYS(KC_M, KC_A, KC_C) { + onMac = true; +# ifdef RGBLIGHT_ENABLE + rgblight_setrgb(255, 255, 255); +# endif } - return false; - case ADJUST: - if (record->event.pressed) { - layer_on(_ADJUST); - } else { - layer_off(_ADJUST); + SEQ_THREE_KEYS(KC_W, KC_I, KC_N) { + onMac = false; +# ifdef RGBLIGHT_ENABLE + rgblight_setrgb(255, 255, 0); +# endif } - return false; - // == Macros START === - case ARROW: - if (record->event.pressed) SEND_STRING("->"); - return false; - case F_ARROW: - if (record->event.pressed) SEND_STRING("=>"); - return false; - case GREP: - if (record->event.pressed) SEND_STRING(" | grep "); return false; - // == Macros END === - // == Multi Os START === - case KC_HOME:// make the home behave the same on OSX - if (record->event.pressed && onMac) { - SEND_STRING(SS_LCTRL("a")); - return false; - } - case KC_END:// make the end behave the same on OSX - if (record->event.pressed && onMac) { - tap_code16(C(KC_E)); - return false; - } - case AC_A:// Accent á - if (record->event.pressed) SEND_STRING(SS_LALT("e") "a"); return false; - case AC_E:// Accent é - if (record->event.pressed) SEND_STRING(SS_LALT("e") "e"); return false; - case AC_I:// Accent í - if (record->event.pressed) SEND_STRING(SS_LALT("e") "i"); return false; - case AC_O:// Accent ó - if (record->event.pressed) SEND_STRING(SS_LALT("e") "o"); return false; - case CUT: if (record->event.pressed) return CMD(KC_X); - case COPY: - if (record->event.pressed) { - onMac ? SEND_STRING(SS_LGUI("c")) : SEND_STRING(SS_LCTRL("c")); - } - return false; - case PASTE: - if (record->event.pressed) { - onMac ? SEND_STRING(SS_LGUI("v")) : SEND_STRING(SS_LCTRL("v")); - } - return false; - case SAVE: - if (record->event.pressed) { - onMac ? SEND_STRING(SS_LGUI("s")) : SEND_STRING(SS_LCTRL("s")); - } - return false; - case UNDO: - if (record->event.pressed) { - onMac ? SEND_STRING(SS_LGUI("z")) : SEND_STRING(SS_LCTRL("z")); - } - return false; - case FIND: - if (record->event.pressed) { - onMac ? SEND_STRING(SS_LGUI("f")) : SEND_STRING(SS_LCTRL("f")); - } - return false; - case CHG_LAYOUT: - if (record->event.pressed) { - onMac ? SEND_STRING(SS_LCTRL(" ")) : SEND_STRING(SS_LCTRL("f")); - } - return false; - // == Multi Os END === -#ifdef RGBLIGHT_ENABLE - case RGB_SLD: - if (record->event.pressed) { rgblight_mode(1); } - return false; - break; - //First time alt + tab, and alt stays sticky. Next press we just send tab. Any other key releases the alt -#endif - case ALT_TAB: - if (record->event.pressed) - { - if (altPressed) - { - tap_code(KC_TAB); - } - else - { - altPressed = true; - layer_on(7); // go to movement layer - onMac ? register_code(KC_LGUI) : register_code(KC_LALT); - tap_code(KC_TAB); - } - } - return false; - // avoid alt releasing if the key is of movement - case KC_RIGHT ... KC_UP: - if (altPressed) - { - return true; // yes QMK, do your stuff - } - } - // Reset sticky alt tab - if (altPressed) - { - onMac ? unregister_code(KC_LGUI) : unregister_code(KC_LALT); - altPressed = false; - layer_off(7); - return false; - } - return true; -}; - -//**************** LEADER *********************// -#ifdef LEADER_ENABLE -LEADER_EXTERNS(); -#ifdef RGBLIGHT_ENABLE - -void leader_start() { - rgblight_setrgb_range(5, 100, 199, 10,15); -}; - -void leader_end(){ - rgblight_setrgb_range(200, 200, 255, 10,15); -}; -#endif - -void matrix_scan_user(void) -{ - if (leading && leader_sequence_size > 0 && timer_elapsed(leader_time) > LEADER_TIMEOUT) - { - leading = false; - SEQ_ONE_KEY(KC_T) { - SEND_STRING("``" SS_TAP(X_LEFT)); - } - // Triple ticks - SEQ_TWO_KEYS(KC_T, KC_T) { - SEND_STRING("```" SS_TAP(X_ENTER) SS_TAP(X_ENTER) "```" SS_TAP(X_UP)); - } - // ==== International spanish accent vowels ==== - SEQ_ONE_KEY(KC_A) { - SEND_STRING(SS_LALT("e") "a"); - } - SEQ_ONE_KEY(KC_E) { - SEND_STRING(SS_LALT("e") "e"); - } - SEQ_ONE_KEY(KC_I) { - SEND_STRING(SS_LALT("e") "i"); - } - SEQ_ONE_KEY(KC_O) { - SEND_STRING(SS_LALT("e") "o"); - } - SEQ_ONE_KEY(KC_U) { - SEND_STRING(SS_LALT("e") "u"); - } - SEQ_ONE_KEY(KC_N) { // ñ - SEND_STRING(SS_LALT("n") "n"); - } - // ==== MACROS === - SEQ_ONE_KEY(KC_G) { // grep - SEND_STRING(" | grep "); - } - SEQ_ONE_KEY(KC_K) { - onMac ? SEND_STRING(SS_LCTRL(" ")) : SEND_STRING(SS_LCTRL("f")); - } - SEQ_TWO_KEYS(KC_D, KC_G) { // vim delete all - if(onMac){ - SEND_STRING(SS_LGUI("a") SS_TAP(X_D)); - } else { - SEND_STRING(SS_LCTRL("a") SS_TAP(X_D)); - } - } - SEQ_ONE_KEY(KC_BSPACE) { // tripe delete! - SEND_STRING(SS_TAP(X_BSPACE) SS_TAP(X_BSPACE) SS_TAP(X_BSPACE)); - } - SEQ_TWO_KEYS(KC_P, KC_G) { - SEND_STRING("ps -ef | grep "); - } - SEQ_TWO_KEYS(KC_J, KC_A) { - SEND_STRING("() => {}"SS_TAP(X_LEFT) SS_TAP(X_LEFT)SS_TAP(X_LEFT) SS_TAP(X_LEFT)SS_TAP(X_LEFT) SS_TAP(X_LEFT)SS_TAP(X_LEFT)); - } - SEQ_TWO_KEYS(KC_S, KC_S) { - SEND_STRING("~/.ssh/ "); // this is a pain to type - } - SEQ_TWO_KEYS(KC_F, KC_T) { - SEND_STRING("feat():" SS_TAP(X_LEFT) SS_TAP(X_LEFT)); - } - // ### LAYER CHANGE - SEQ_ONE_KEY(KC_1) { - layer_on(1); - } - SEQ_ONE_KEY(KC_H) { // control enter, because yes - SEND_STRING(SS_DOWN(X_LCTRL) SS_TAP(X_ENTER) SS_UP(X_LCTRL)); - } - // paste all - SEQ_ONE_KEY(KC_P) { - if(onMac){ - SEND_STRING(SS_LGUI("a") SS_LGUI("v")); - } else { - SEND_STRING(SS_LCTRL("a") SS_LCTRL("v")); - } - } - SEQ_THREE_KEYS(KC_M, KC_A, KC_C) { - onMac = true; - #ifdef RGBLIGHT_ENABLE - rgblight_setrgb(255, 255, 255); - #endif - } - SEQ_THREE_KEYS(KC_W, KC_I, KC_N) { - onMac = false; - #ifdef RGBLIGHT_ENABLE - rgblight_setrgb(255, 255, 0); - #endif - } - /* Copy all */ - SEQ_ONE_KEY(KC_Y) { - if(onMac){ - SEND_STRING(SS_LGUI("a") SS_LGUI("c")); - } else { - SEND_STRING(SS_LCTRL("a") SS_LCTRL("c")); - } - } - //emoji bar - SEQ_TWO_KEYS(KC_E, KC_E) { - SEND_STRING(SS_DOWN(X_LGUI) SS_LCTRL(" ") SS_UP(X_LGUI)); - } - - SEQ_TWO_KEYS(KC_F, KC_F) { - SEND_STRING("ps -ef | grep "); - } - SEQ_TWO_KEYS(KC_H, KC_T) { - SEND_STRING("https://"); - } - - leader_end(); - } -} -#endif // LEADER - -// ======== INCREMENTAL MACROS STUFF ============= - -#define MAX_INCREMENTAL_MACRO 20 -#define TAP_ROTATION_TIMEOUT 400 - -uint16_t latest_kc = 0; -uint16_t latest_rotation = 0; -int key_count = 0; - -const char incremental_macros[][MAX_INCREMENTAL_MACRO] = { "String1"SS_TAP(X_HOME)"X-", "String2"SS_TAP(X_HOME) }; - -bool process_incremental_macro (uint16_t kc) { - - if( kc < INC_MACROS_START || kc > INC_MACROS_END ){ - return false; - } - int macro_idx = (int) (kc - INC_MACROS_START) - 1; - char tempstring[3] = {0}; - tempstring[0] = incremental_macros[macro_idx][key_count]; - // Special cases of SS_TAP SS_UP and SS_DOWN, they require two characters so get both once and skip on next iteration - if( tempstring[0] == '\1' || tempstring[0] == '\2' || tempstring[0] == '\3'){ - tempstring[1] = incremental_macros[macro_idx][++key_count]; - } - if( tempstring[0] == '\0'){ - key_count = 0; - } - send_string(tempstring); + /* Copy all */ + SEQ_ONE_KEY(KC_Y) { + if (onMac) { + SEND_STRING(SS_LGUI("a") SS_LGUI("c")); + } else { + SEND_STRING(SS_LCTRL("a") SS_LCTRL("c")); + } + } + // emoji bar + SEQ_TWO_KEYS(KC_E, KC_E) { SEND_STRING(SS_DOWN(X_LGUI) SS_LCTRL(" ") SS_UP(X_LGUI)); } - return true; -}; + SEQ_TWO_KEYS(KC_F, KC_F) { SEND_STRING("ps -ef | grep "); } + SEQ_TWO_KEYS(KC_H, KC_T) { SEND_STRING("https://"); } -void refresh_incremental_macros (uint16_t kc) { - if (kc == latest_kc) - { - if ( (timer_elapsed(latest_rotation) > TAP_ROTATION_TIMEOUT) || (key_count >= MAX_INCREMENTAL_MACRO) ) key_count = 0; - else key_count++; - } else { - key_count = 0; - latest_kc = kc; + leader_end(); } - - latest_rotation = timer_read(); } - - -// ======== VISUAL STUDIO CODE SHORTCUTS STUFF - -bool is_macro (uint16_t kc){ - return kc > MACRO_START && kc < MACRO_END; -}; - -bool command_shift_p (bool isMac) { - isMac - ? SEND_STRING(SS_DOWN(X_LSHIFT)SS_LGUI("p")SS_UP(X_LSHIFT)) - : SEND_STRING(SS_DOWN(X_LSHIFT)SS_LCTRL("p")SS_UP(X_LSHIFT)); - return false; -}; - -bool VSCommand(bool isMac, char *cmd) -{ - command_shift_p (isMac); - send_string(cmd); - SEND_STRING(SS_TAP(X_ENTER)); - return false; -}; - -bool handle_macro(uint16_t kc) -{ - switch (kc) - { - case T_TERM: return VSCommand(onMac, "toit"); - case FIX_ALL: return VSCommand(onMac, "faap"); - case BLK_CMNT: return VSCommand(onMac, "tbc"); - case LN_CMNT: return VSCommand(onMac, "tlic"); - case CMD_S_P: return command_shift_p(onMac); - case TRI_TICKS: SEND_STRING("[[[ "); break; - } - return false; -}; +#endif // LEADER diff --git a/users/danielo515/danielo515.h b/users/danielo515/danielo515.h index 95c01b6e8a..715e8132fe 100644 --- a/users/danielo515/danielo515.h +++ b/users/danielo515/danielo515.h @@ -1,104 +1,6 @@ #pragma once - #include "quantum.h" - - -bool handle_macro(uint16_t kc); -bool is_macro (uint16_t kc); -bool process_incremental_macro (uint16_t); -void refresh_incremental_macros (uint16_t); -//**************** KEYCODES *********************// - -enum custom_keycodes -{ - PLACEHOLDER = SAFE_RANGE, // can always be here - EPRM, - RGB_SLD, - ALT_TAB, - // Macros - ARROW, - F_ARROW, - QWERTY, - GREP, - // Accented characters - AC_A, - AC_E, - AC_I, - AC_O, - // Custom multi-os key-codes - CUT, - COPY, - PASTE, - SAVE, - UNDO, - CHG_LAYOUT, - FIND, - // OTHER OLD STUFF - LOWER, - RAISE, - ADJUST, - MAC_TGL, - MACRO_START, // START OF VSC DECLARATIONS - T_TERM, - FIX_ALL, - BLK_CMNT, - LN_CMNT, - CMD_S_P, - TRI_TICKS, - MACRO_END, // END OF VSC DECLARATIONS - INC_MACROS_START, - INC_MACROS_END, -}; - - -enum layers { - _QWERTY, - _LOWER, - _RAISE, - _F, - _D, - _A, - _S, - _J, - _K, - _MACROS, - _ADJUST, - _SAFE_LAYER -}; - -// Function letters -#define FN_F LT(_F,KC_F) -#define FN_D LT(_D,KC_D) -#define FN_S LT(_S,KC_S) -#define FN_A LT(_A,KC_A) -#define FN_K LT(_K,KC_K) -#define FN_J LT(_J,KC_J) -#define KC_FN_D FN_D -#define KC_FN_S FN_S -#define KC_FN_F FN_F - -#define KC_MACROS OSL(_MACROS) - - -#define KC_E_COLN LSFT(KC_DOT) -#define KC_E_EQL ES_EQL -#define KC_GUI OSM(MOD_RGUI) -#define KC_R_NUB S(KC_NUBS) -#define KC_E_LT KC_NUBS -#define KC_E_GT S(KC_NUBS) -#define KC_E_TILD ES_TILD -#define KC_E_MINS ES_MINS -#define KC_S_SPC SFT_T(KC_SPC) // Tap for Space, hold for Shift -#define KC_E_OVRR ES_OVRR -#define KC_E_APOS ES_APOS -#define KC_E_IEXL ES_IEXL -// Short hand for complex key combinations -# define WIN_LEFT_HALF LALT(LGUI(KC_LEFT)) -# define WIN_RIGHT_HALF LALT(LGUI(KC_RIGHT)) -# define WIN_TO_LEFT LALT(LSFT( LGUI(KC_LEFT) )) -# define WIN_TO_RIGHT LALT(LSFT( LGUI(KC_RIGHT) )) - -// Ready to use Tap dance definitions, just put them on your layout +#include "process_records.h" #ifdef TAP_DANCE_ENABLE #include "tap_dance.h" diff --git a/users/danielo515/process_records.c b/users/danielo515/process_records.c new file mode 100644 index 0000000000..b1a8b92552 --- /dev/null +++ b/users/danielo515/process_records.c @@ -0,0 +1,167 @@ +#include "process_records.h" +#include "alt_tab.h" +extern bool onMac; +// ======== INCREMENTAL MACROS STUFF ============= +#define MAX_INCREMENTAL_MACRO 20 +#define TAP_ROTATION_TIMEOUT 400 +uint16_t latest_kc = 0; +uint16_t latest_rotation = 0; +int key_count = 0; + +const char incremental_macros[][MAX_INCREMENTAL_MACRO] = { "String1"SS_TAP(X_HOME)"X-", "String2"SS_TAP(X_HOME) }; + +bool process_incremental_macro(uint16_t kc) { + if (kc < INC_MACROS_START || kc > INC_MACROS_END) { + return false; + } + int macro_idx = (int)(kc - INC_MACROS_START) - 1; + char tempstring[3] = {0}; + tempstring[0] = incremental_macros[macro_idx][key_count]; + // Special cases of SS_TAP SS_UP and SS_DOWN, they require two characters so get both once and skip on next iteration + if (tempstring[0] == '\1' || tempstring[0] == '\2' || tempstring[0] == '\3') { + tempstring[1] = incremental_macros[macro_idx][++key_count]; + } + if (tempstring[0] == '\0') { + key_count = 0; + } + send_string(tempstring); + + return true; +}; + +void refresh_incremental_macros(uint16_t kc) { + if (kc == latest_kc) { + if ((timer_elapsed(latest_rotation) > TAP_ROTATION_TIMEOUT) || (key_count >= MAX_INCREMENTAL_MACRO)) + key_count = 0; + else + key_count++; + } else { + key_count = 0; + latest_kc = kc; + } + + latest_rotation = timer_read(); +} +// Send control or GUI depending if we are on windows or mac +bool CMD(uint16_t kc) { + if(onMac){ tap_code16(LGUI(kc)); } else { tap_code16(LCTL(kc)); } + return false; +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + bool pressed = record->event.pressed; + if(pressed){ + refresh_incremental_macros(keycode); + if(process_incremental_macro(keycode)){ + return false; + } + switch (keycode) { + case MAC_TGL: + onMac = !onMac; + onMac ? SEND_STRING("On mac") : SEND_STRING("Not on MAC"); + return false; + } + } + + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_qwerty); + #endif + layer_on(_QWERTY); + } + return false; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + } else { + layer_off(_LOWER); + } + return false; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + } else { + layer_off(_RAISE); + } + return false; + case ADJUST: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + // == Macros START === + case IARROW: if (record->event.pressed) SEND_STRING("<-"); return false; + case ARROW: if (record->event.pressed) SEND_STRING("->"); return false; + case F_ARROW: if (record->event.pressed) SEND_STRING("=>"); return false; + case GREP: if (record->event.pressed) SEND_STRING(" | grep "); return false; + case CLN_EQ: if (record->event.pressed) SEND_STRING(":="); return false; + // == Macros END === + // == Multi Os START === + case KC_HOME:// make the home behave the same on OSX + if (record->event.pressed && onMac) { + SEND_STRING(SS_LCTRL("a")); + return false; + } + case KC_END:// make the end behave the same on OSX + if (record->event.pressed && onMac) { + tap_code16(C(KC_E)); + return false; + } + case AC_A:// Accent á + if (record->event.pressed) SEND_STRING(SS_LALT("e") "a"); return false; + case AC_E:// Accent é + if (record->event.pressed) SEND_STRING(SS_LALT("e") "e"); return false; + case AC_I:// Accent í + if (record->event.pressed) SEND_STRING(SS_LALT("e") "i"); return false; + case AC_O:// Accent ó + if (record->event.pressed) SEND_STRING(SS_LALT("e") "o"); return false; + case CUT: if (record->event.pressed) return CMD(KC_X); + case COPY: + if (record->event.pressed) { + onMac ? SEND_STRING(SS_LGUI("c")) : SEND_STRING(SS_LCTRL("c")); + } + return false; + case PASTE: + if (record->event.pressed) { + onMac ? SEND_STRING(SS_LGUI("v")) : SEND_STRING(SS_LCTRL("v")); + } + return false; + case SAVE: + if (record->event.pressed) { + onMac ? SEND_STRING(SS_LGUI("s")) : SEND_STRING(SS_LCTRL("s")); + } + return false; + case UNDO: + if (record->event.pressed) { + onMac ? SEND_STRING(SS_LGUI("z")) : SEND_STRING(SS_LCTRL("z")); + } + return false; + case FIND: + if (record->event.pressed) { + onMac ? SEND_STRING(SS_LGUI("f")) : SEND_STRING(SS_LCTRL("f")); + } + return false; + case CHG_LAYOUT: + if (record->event.pressed) { + onMac ? SEND_STRING(SS_LCTRL(" ")) : SEND_STRING(SS_LCTRL("f")); + } + return false; + // == Multi Os END === +#ifdef RGBLIGHT_ENABLE + case RGB_SLD: + if (record->event.pressed) { rgblight_mode(1); } + return false; + break; + //First time alt + tab, and alt stays sticky. Next press we just send tab. Any other key releases the alt +#endif + } +// =============== ALT_TAB single key handling + return process_alt_tab(keycode, record); +}; + + + diff --git a/users/danielo515/process_records.h b/users/danielo515/process_records.h new file mode 100644 index 0000000000..c994511a5f --- /dev/null +++ b/users/danielo515/process_records.h @@ -0,0 +1,104 @@ +#pragma once +#include "quantum.h" + +enum custom_keycodes +{ + EPRM = SAFE_RANGE, + RGB_SLD, + ALT_TAB, + QWERTY, + SYM, + NAV, + ADJUST, +// Macros + ARROW, + IARROW, + CLN_EQ, + F_ARROW, + GREP, +// Accented characters + AC_A, + AC_E, + AC_I, + AC_O, +// Custom multi-os key-codes + CUT, + COPY, + PASTE, + SAVE, + UNDO, + CHG_LAYOUT, + FIND, +// OTHER OLD STUFF + LOWER, + RAISE, + MAC_TGL, + INC_MACROS_START, + INC_MACROS_END, +}; + +//**************** KEYCODES *********************// +enum layers { + _QWERTY, + _SYMB, + _NAV, + _ADJUST, + _F, + _D, + _S, + _A, + _J, + _K, + // iris specific - TBD + _LOWER, + _RAISE, + _MACROS, + _SAFE_LAYER +}; + +//===== Function letters +# define FN_F LT(_F,KC_F) +# define FN_D LT(_D,KC_D) +# define FN_S LT(_S,KC_S) +# define FN_A LT(_A,KC_A) +# define FN_K LT(_K,KC_K) +# define FN_J LT(_J,KC_J) +# define KC_FN_D FN_D +# define KC_FN_S FN_S +# define KC_FN_F FN_F + +# define KC_MACROS OSL(_MACROS) + + +# define KC_E_COLN LSFT(KC_DOT) +# define KC_E_EQL ES_EQL +# define KC_GUI OSM(MOD_RGUI) +# define KC_R_NUB S(KC_NUBS) +# define KC_E_LT KC_NUBS +# define KC_E_GT S(KC_NUBS) +# define KC_E_TILD ES_TILD +# define KC_E_MINS ES_MINS +# define KC_E_OVRR ES_OVRR +# define KC_E_APOS ES_APOS +# define KC_E_IEXL ES_IEXL +//========== Short hand for complex key combinations +# define WIN_LEFT_HALF LALT(LGUI(KC_LEFT)) +# define WIN_RIGHT_HALF LALT(LGUI(KC_RIGHT)) +# define WIN_TO_LEFT LALT(LSFT( LGUI(KC_LEFT) )) +# define WIN_TO_RIGHT LALT(LSFT( LGUI(KC_RIGHT) )) +# define ALL_WIN LCTL(KC_DOWN) +# define EXPOSE LGUI(KC_DOWN) +// ========== Modifiers!! +# define SHIFT OSM(MOD_LSFT) +//=============== tap for key hold for mod +# define HYPR_H HYPR_T(KC_H) +# define CTL_K RCTL_T(KC_K) +# define ALT_J ALT_T(KC_J) +# define SFT_MINS LSFT_T(KC_MINS) // tap - hold shift +# define CMD_QUOT GUI_T(KC_QUOTE) // tap ' hold cmd +//=============== Movement modified +# define CTL_LEFT LCTL(KC_LEFT) +# define CTL_RIGHT LCTL(KC_RIGHT) + +# define SFT_LEFT LSFT(KC_LEFT) +# define SFT_RIGHT LSFT(KC_RIGHT) diff --git a/users/danielo515/rules.mk b/users/danielo515/rules.mk index 091baf20c9..c77e2f0155 100644 --- a/users/danielo515/rules.mk +++ b/users/danielo515/rules.mk @@ -1,4 +1,6 @@ -SRC += danielo515.c +SRC += danielo515.c \ + alt_tab.c \ + process_records.c ifeq ($(strip $(COMBO_ENABLE)), yes) SRC += combo.c diff --git a/users/danielo515/tap_dance.h b/users/danielo515/tap_dance.h index 6ec4fe13cf..880ad525ee 100644 --- a/users/danielo515/tap_dance.h +++ b/users/danielo515/tap_dance.h @@ -57,6 +57,7 @@ void dance_cut (qk_tap_dance_state_t *state, void *user_data); void dance_copy (qk_tap_dance_state_t *state, void *user_data); void dance_paste (qk_tap_dance_state_t *state, void *user_data); +// Ready to use Tap dance definitions, just put them on your layout #define TD_COPY TD(_TD_COPY) #define TD_CUT TD(_TD_CUT) #define KC_TD_COPY TD(_TD_COPY) // Declarations for macros that add KC_ |