diff options
author | Reed <rmwphd@gmail.com> | 2020-06-29 13:23:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-29 10:23:13 -0700 |
commit | 1baa99c6473473ba3204c9861951e70c10d037cb (patch) | |
tree | 2f53db277340f411a690bef3127768007720062e /users/rmw | |
parent | e9e6054ee7eaca4cbd8d1c7566f394559ea8770a (diff) | |
download | qmk_firmware-1baa99c6473473ba3204c9861951e70c10d037cb.tar.gz qmk_firmware-1baa99c6473473ba3204c9861951e70c10d037cb.zip |
[Keymap] Adding my keymaps for ergodox_ez and kyria (#9365)
* Trying to fix problems in my kyria steez
* repeating last commit.....
* repeating last commit on EDIT layer but swapping direction
exit
* moving the reversed desktop moves to the symbol layers on the same hand, for easier activation
* adding mac desktop movement keys to Kyria layout
* Adding readmes to my keymaps
* Removing a png...
* Update keyboards/ergodox_ez/keymaps/rmw/keymap-mac.c removing EPRM case
* Apply suggestions from code review
Great updates to various old-school or outdated ways I was doing things, removing some commented out code, etc.
* Apply suggestions from code review
Additional improvements
* Moving tapdances.cpp to userspace as tapdances.c
* reindenting the Kyria keymap to follow four-spaces convention, turning off oled on my kyria, improving the led handling on the Ergodox.
* updating led stuff on the other two versions of the keymap, removing EPRM key from main keymap
* Apply suggestions from code review
I'm adding these various removals to the config file because it seems that at this time those settings are in harmony with the ergodox_ez defaults.
* Moving encoder functions into their own userspace file
* Apply suggestions from code review
Removing settings that are now defaults, clearing out placeholder custom keycodes (smh)
* updating encoder functions.
* Moving to LAYOUT_stack for all layers, adding end of file newlines, switching to some shorter keycode aliases
* Okay, refactor is well underway.
* refactored! Also improved led handling for ergodox and rgb handling for kyria
* removing mac/windows swappable version because I don't feel like dealing with it when reflashing is so easy.
* moving LAYOUT_stack into kyria.h
* moving the alternate default layer down next to QWERTY
Diffstat (limited to 'users/rmw')
-rw-r--r-- | users/rmw/encoder_functions.c | 53 | ||||
-rw-r--r-- | users/rmw/encoder_functions.h | 11 | ||||
-rw-r--r-- | users/rmw/rmw.c | 1 | ||||
-rw-r--r-- | users/rmw/rmw.h | 87 | ||||
-rw-r--r-- | users/rmw/rules.mk | 9 | ||||
-rw-r--r-- | users/rmw/tapdances.c | 389 | ||||
-rw-r--r-- | users/rmw/tapdances.h | 46 |
7 files changed, 596 insertions, 0 deletions
diff --git a/users/rmw/encoder_functions.c b/users/rmw/encoder_functions.c new file mode 100644 index 0000000000..39032d0eba --- /dev/null +++ b/users/rmw/encoder_functions.c @@ -0,0 +1,53 @@ +// Encoder functions to mix and match! + +#include "encoder_functions.h" + +void enc_move_words(bool cw){ // Move whole words. Hold shift to select while moving. + if (cw) { + tap_code16(A(KC_RGHT)); + } else { + tap_code16(A(KC_LEFT)); + } +} +void enc_history_scrubbing(bool cw){ // Undo/Redo. + if (cw) { + tap_code16(G(S(KC_Z))); + } else { + tap_code16(G(KC_Z)); + } +} +void enc_scrolling(bool cw){ // Scrolling. + if (cw) { + tap_code(KC_MS_WH_DOWN); + } else { + tap_code(KC_MS_WH_UP); + } +} +void enc_scrolling_h(bool cw){ // Scrolling. + if (cw) { + tap_code(KC_MS_WH_RIGHT); + } else { + tap_code(KC_MS_WH_LEFT); + } +} +void enc_volume_knob(bool cw){ // Volume control. + if (cw) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } +} +void enc_move_desktop(bool cw){ // Switch Desktops (Mac). + if (cw) { + tap_code16(C(KC_RIGHT)); + } else { + tap_code16(C(KC_LEFT)); + } +} +void enc_zoom(bool cw){ // Zoom in/zoom out. + if (cw) { + tap_code16(G(KC_PLUS)); + } else { + tap_code16(G(KC_MINUS)); + } +} diff --git a/users/rmw/encoder_functions.h b/users/rmw/encoder_functions.h new file mode 100644 index 0000000000..d80a78668a --- /dev/null +++ b/users/rmw/encoder_functions.h @@ -0,0 +1,11 @@ +#pragma once +#include QMK_KEYBOARD_H +#include "rmw.h" + +void enc_move_words(bool cw); +void enc_history_scrubbing(bool cw); +void enc_scrolling(bool cw); +void enc_scrolling_h(bool cw); +void enc_volume_knob(bool cw); +void enc_move_desktop(bool cw); +void enc_zoom(bool cw); diff --git a/users/rmw/rmw.c b/users/rmw/rmw.c new file mode 100644 index 0000000000..bb1c1984f5 --- /dev/null +++ b/users/rmw/rmw.c @@ -0,0 +1 @@ +#include "rmw.h" diff --git a/users/rmw/rmw.h b/users/rmw/rmw.h new file mode 100644 index 0000000000..272a400c75 --- /dev/null +++ b/users/rmw/rmw.h @@ -0,0 +1,87 @@ +#pragma once +#include QMK_KEYBOARD_H + +#include "quantum.h" +#include "action.h" +#include "version.h" + +#ifdef TAP_DANCE_ENABLE +#include "tapdances.h" +#endif + +#ifdef ENCODER_ENABLE +#include "encoder_functions.h" +#endif + +enum user_layers { + QWERTY = 0 + ,MINIMAK4 + ,NUMPAD + ,EDIT + ,FSYM + ,JSYM + ,MEDIA + ,ADJUST +}; + + +// Custom keycodes +#define SFTENT SFT_T(KC_ENT) + +enum user_custom_keycodes_universal { + VRSN = SAFE_RANGE + ,OS_CSFT = OSM(MOD_LSFT | MOD_LCTL) + ,OS_GSFT = OSM(MOD_LSFT | MOD_LGUI) + ,OS_CALT = OSM(MOD_LCTL | MOD_LALT) + ,OS_ALT = OSM(MOD_LALT) + ,OS_CTL = OSM(MOD_LCTL) + ,NEW_SAFE_RANGE +}; + +#ifdef MACOSX + enum user_custom_keycodes { + FORM_GET = NEW_SAFE_RANGE + ,FORM_PUT + ,OS_CMD = OSM(MOD_LGUI) + ,R_UNDO = LGUI(KC_Z) + ,R_REDO = LGUI(KC_Y) + ,R_CUT = LGUI(KC_X) + ,R_COPY = LGUI(KC_C) + ,R_PASTE = LGUI(KC_V) + ,DEL_WRD = LALT(KC_BSPACE) + ,MVW_LEFT = LALT(KC_LEFT) + ,MVW_RIGHT = LALT(KC_RIGHT) + ,SELW_LEFT = LALT(S(KC_LEFT)) + ,SELW_RIGHT = LALT(S(KC_RIGHT)) + ,NEW_TAB = LGUI(KC_T) + ,TASK_MAN = LGUI(LALT(KC_ESCAPE)) + ,SEL_HOME = S(LGUI(KC_LEFT)) + ,SEL_END = S(LGUI(KC_RIGHT)) + ,R_HOME = LGUI(KC_LEFT) + ,R_END = LGUI(KC_RIGHT) + }; +#endif + +#ifdef WINDOWS + enum user_custom_keycodes { + FORM_GET = NEW_SAFE_RANGE + ,FORM_PUT + ,OS_WIN = OSM(MOD_LGUI) + ,R_UNDO = LCTL(KC_Z) + ,R_REDO = LCTL(KC_Y) + ,R_CUT = LCTL(KC_X) + ,R_COPY = LCTL(KC_C) + ,R_PASTE = LCTL(KC_V) + ,DEL_WRD = LALT(KC_BSPACE) + ,MVW_LEFT = LCTL(KC_LEFT) + ,MVW_RIGHT = LCTL(KC_RIGHT) + ,SELW_LEFT = LCTL(S(KC_LEFT)) + ,SELW_RIGHT = LCTL(S(KC_RIGHT)) + ,NEW_TAB = LCTL(KC_T) + ,TASK_MAN = LCTL(LALT(KC_ESCAPE)) + ,SEL_HOME = S(KC_HOME) + ,SEL_END = S(KC_END) + ,R_HOME = KC_HOME + ,R_END = KC_END +}; +#endif diff --git a/users/rmw/rules.mk b/users/rmw/rules.mk new file mode 100644 index 0000000000..468745dbc2 --- /dev/null +++ b/users/rmw/rules.mk @@ -0,0 +1,9 @@ +SRC += rmw.c + +ifdef TAP_DANCE_ENABLE +SRC += tapdances.c +endif + +ifdef ENCODER_ENABLE +SRC += encoder_functions.c +endif diff --git a/users/rmw/tapdances.c b/users/rmw/tapdances.c new file mode 100644 index 0000000000..1b44a87253 --- /dev/null +++ b/users/rmw/tapdances.c @@ -0,0 +1,389 @@ +// Useful tapdance functions! + +#include "tapdances.h" + +qk_tap_dance_action_t tap_dance_actions[] = { + [SHCAP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, caps, shift_reset) + ,[TDGUI] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, shiftgui, gui_reset) + ,[TDGUI2] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, guictl, ubermod_reset) + ,[SHENT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, shiftenter, shift_reset) + ,[SHNTC] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, shiftentercaps, shift_reset) + ,[GCA] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ubermod_mac, ubermod_reset) // GUI->CTL->ALT + ,[AGC] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ubermod2_mac, ubermod_reset) // ALT->GUI->CTL + ,[SGCA] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, shift_and_mac, CASG_reset) // SG->SC->SA + ,[GUCTL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, guictl, ubermod_reset) + ,[CAG] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ubermod, ubermod_reset) // CTL->ALT->GUI + ,[ACG] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ubermod2, ubermod_reset) // ALT->GUI->CTL + ,[SCAG] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, shift_and, CASG_reset) // SG->SC->SA + ,[DLTR] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, deleter, ubermod_reset) // backspace, backspace, alt backspace, gui backspace + ,[FRBK2] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, forward_back_mac, ubermod_reset) + ,[CTLALL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctrl_all_mac, ubermod_reset) // C->CG->CA->CAG + ,[CTLAND] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctrl_all, ubermod_reset) // C->CA->CG->CAG + ,[FRBK] = ACTION_TAP_DANCE_DOUBLE(KC_WWW_BACK,KC_WWW_FORWARD) +}; + +void caps(qk_tap_dance_state_t *state, void *user_data) // Shift, Caps +{ if (state->count >= 2) {register_code(KC_CAPS); unregister_code(KC_CAPS);} + else if (state->pressed) {register_mods(MOD_LSFT);} else {set_oneshot_mods(MOD_LSFT);} + reset_tap_dance(state); +} + +void forward_back_mac(qk_tap_dance_state_t *state, void *user_data) // G<-, then G-> +{ + if (state->count > 1) { + tap_code16(G(KC_RGHT)); + } + else { + tap_code16(G(KC_LEFT)); + } + reset_tap_dance(state); +} + +void shiftgui(qk_tap_dance_state_t *state, void *user_data) // G->SG +{ + if (state->count > 1) { + if (state->pressed) { + register_mods(MOD_LSFT | MOD_LGUI); + } + else { + set_oneshot_mods(MOD_LSFT | MOD_LGUI); + } + } + else if (state->pressed) { + register_mods(MOD_LGUI); + } + else { + set_oneshot_mods(MOD_LGUI); + } + reset_tap_dance(state); +} + +void guictl(qk_tap_dance_state_t *state, void *user_data) // G->GC +{ + if (state->count > 1) { + if (state->pressed) { + register_mods(MOD_LCTL | MOD_LGUI); + } + else { + set_oneshot_mods(MOD_LCTL | MOD_LGUI); + } + } + else if (state->pressed) { + register_mods(MOD_LGUI); + } + else { + set_oneshot_mods(MOD_LGUI); + } + reset_tap_dance(state); +} + +void deleter(qk_tap_dance_state_t *state, void *user_data) // bkspc -> delwrd -> delline +{ + if (state->count > 3) { + tap_code16(G(KC_BSPC)); + } + else if (state->count > 2) { + tap_code16(A(KC_BSPC)); + } + else { + tap_code(KC_BSPC); + } + reset_tap_dance(state); +} + +void ubermod(qk_tap_dance_state_t *state, void *user_data) // CTL->ALT->GUI +{ + if (state->count > 2) { + if (state->pressed) { + register_mods(MOD_LGUI); + } + else { + set_oneshot_mods(MOD_LGUI); + } + } + else if (state->count > 1) { + if (state->pressed) { + register_mods(MOD_LALT); + } + else { + set_oneshot_mods(MOD_LALT); + } + } + else if (state->pressed) { + register_mods(MOD_LCTL); + } + else { + set_oneshot_mods(MOD_LCTL); + } + reset_tap_dance(state); +} + +void ubermod_mac(qk_tap_dance_state_t *state, void *user_data) // GUI->CTL->ALT +{ + if (state->count > 2) { + if (state->pressed) { + register_mods(MOD_LALT); + } + else { + set_oneshot_mods(MOD_LALT); + } + } + else if (state->count > 1) { + if (state->pressed) { + register_mods(MOD_LCTL); + } + else { + set_oneshot_mods(MOD_LCTL); + } + } + else if (state->pressed) { + register_mods(MOD_LGUI); + } + else { + set_oneshot_mods(MOD_LGUI); + } + reset_tap_dance(state); +} + +void ubermod2(qk_tap_dance_state_t *state, void *user_data) // ALT->CTL->GUI +{ + if (state->count > 2) { + if (state->pressed) { + register_mods(MOD_LGUI); + } + else { + set_oneshot_mods(MOD_LGUI); + } + } + else if (state->count > 1) { + if (state->pressed) { + register_mods(MOD_LCTL); + } + else { + set_oneshot_mods(MOD_LCTL); + } + } + else if (state->pressed) { + register_mods(MOD_LALT); + } + else { + set_oneshot_mods(MOD_LALT); + } + reset_tap_dance(state); +} + +void ubermod2_mac(qk_tap_dance_state_t *state, void *user_data) // ALT->GUI->CTL +{ + if (state->count > 2) { + if (state->pressed) { + register_mods(MOD_LCTL); + } + else { + set_oneshot_mods(MOD_LCTL); + } + } + else if (state->count > 1) { + if (state->pressed) { + register_mods(MOD_LGUI); + } + else { + set_oneshot_mods(MOD_LGUI); + } + } + else if (state->pressed) { + register_mods(MOD_LALT); + } + else { + set_oneshot_mods(MOD_LALT); + } + reset_tap_dance(state); +} + +void shift_reset(qk_tap_dance_state_t *state, void *user_data) +{ + unregister_mods(MOD_LSFT); + // clear_oneshot_mods(); +} +void gui_reset(qk_tap_dance_state_t *state, void *user_data) +{ + unregister_mods(MOD_LSFT | MOD_LGUI); +} +void CAS_reset(qk_tap_dance_state_t *state, void *user_data) +{ + unregister_mods(MOD_LCTL | MOD_LSFT | MOD_LALT); +} +void CASG_reset(qk_tap_dance_state_t *state, void *user_data) +{ + unregister_mods(MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI); + // clear_oneshot_mods(); +} +void ubermod_reset(qk_tap_dance_state_t *state, void *user_data) // AKA CAG_reset +{ + unregister_mods(MOD_LCTL | MOD_LALT | MOD_LGUI); +} + +void shiftenter(qk_tap_dance_state_t *state, void *user_data) +{ + if (state->count > 1) { + tap_code(KC_ENT); + } + else if (state->pressed) { + register_mods(MOD_LSFT); + } + else { + set_oneshot_mods(MOD_LSFT); + } + reset_tap_dance(state); +} + +void shiftentercaps(qk_tap_dance_state_t *state, void *user_data) +{ + if (state->count > 2) { + tap_code(KC_CAPS); + } + else if (state->count > 1) { + tap_code(KC_ENT); + } + else if (state->pressed) { + register_mods(MOD_LSFT); + } + else { + set_oneshot_mods(MOD_LSFT); + } + reset_tap_dance(state); +} + +void ctrl_all_mac(qk_tap_dance_state_t *state, void *user_data) // C->CG->CAG +{ + if (state->count > 2) { + if (state->pressed) { + register_mods(MOD_LCTL | MOD_LALT | MOD_LGUI); + } + else { + set_oneshot_mods(MOD_LCTL | MOD_LGUI | MOD_LALT); + } + } + else if (state->count > 1) { + if (state->pressed) { + register_mods(MOD_LCTL | MOD_LGUI); + } + else { + set_oneshot_mods(MOD_LCTL | MOD_LGUI); + } + } + else if (state->pressed) { + register_mods(MOD_LCTL); + } + else { + set_oneshot_mods(MOD_LCTL); + } + reset_tap_dance(state); +} + +void ctrl_all(qk_tap_dance_state_t *state, void *user_data) // C->CA->SC +{ + if (state->count > 2) { + if (state->pressed) { + register_mods(MOD_LCTL | MOD_LSFT); + } + else { + set_oneshot_mods(MOD_LCTL | MOD_LSFT); + } + } + else if (state->count > 1) { + if (state->pressed) { + register_mods(MOD_LCTL | MOD_LALT); + } + else { + set_oneshot_mods(MOD_LCTL | MOD_LALT); + } + } + else if (state->pressed) { + register_mods(MOD_LCTL); + } + else { + set_oneshot_mods(MOD_LCTL); + } + reset_tap_dance(state); +} + +void alt_all(qk_tap_dance_state_t *state, void *user_data) // A->SA->AC +{ + if (state->count > 2) { + if (state->pressed) { + register_mods(MOD_LCTL | MOD_LALT); + } + else { + set_oneshot_mods(MOD_LALT | MOD_LCTL); + } + } + else if (state->count > 1) { + if (state->pressed) { + register_mods(MOD_LSFT | MOD_LALT); + } + else { + set_oneshot_mods(MOD_LALT | MOD_LSFT); + } + } + else if (state->pressed) { + register_mods(MOD_LALT); + } + else { + set_oneshot_mods(MOD_LALT); + } + reset_tap_dance(state); +} + +void shift_and(qk_tap_dance_state_t *state, void *user_data) // SC->SA->SG +{ + if (state->count > 2) { + if (state->pressed) { + register_mods(MOD_LSFT | MOD_LGUI); + } + else { + set_oneshot_mods(MOD_LGUI | MOD_LSFT); + } + } + else if (state->count > 1) { + if (state->pressed) { + register_mods(MOD_LSFT | MOD_LALT); + } + else { + set_oneshot_mods(MOD_LALT | MOD_LSFT); + } + } + else if (state->pressed) { + register_mods(MOD_LCTL | MOD_LSFT); + } + else { + set_oneshot_mods(MOD_LSFT | MOD_LCTL); + } + reset_tap_dance(state); +} + +void shift_and_mac(qk_tap_dance_state_t *state, void *user_data) // SG->SC->SA +{ + if (state->count > 1) { + if (state->pressed) { + register_mods(MOD_LSFT | MOD_LALT); + } + else { + set_oneshot_mods(MOD_LALT | MOD_LSFT); + } + } + else if (state->count > 2) { + if (state->pressed) { + register_mods(MOD_LCTL | MOD_LSFT); + } + else { + set_oneshot_mods(MOD_LSFT | MOD_LCTL); + } + } + else if (state->pressed) { + register_mods(MOD_LSFT | MOD_LGUI); + } + else { + set_oneshot_mods(MOD_LGUI | MOD_LSFT); + } + reset_tap_dance(state); +} diff --git a/users/rmw/tapdances.h b/users/rmw/tapdances.h new file mode 100644 index 0000000000..11425011c5 --- /dev/null +++ b/users/rmw/tapdances.h @@ -0,0 +1,46 @@ +#pragma once +#include "rmw.h" +#include "process_tap_dance.h" +#include "action.h" + +void caps(qk_tap_dance_state_t *state, void *user_data); // Shift, Caps +void forward_back_mac(qk_tap_dance_state_t *state, void *user_data); // G<-, then G-> +void shiftgui(qk_tap_dance_state_t *state, void *user_data); // G->SG +void guictl(qk_tap_dance_state_t *state, void *user_data); // G->GC +void deleter(qk_tap_dance_state_t *state, void *user_data); // bkspc -> delwrd -> delline +void ubermod(qk_tap_dance_state_t *state, void *user_data); // CTL->ALT->GUI +void ubermod_mac(qk_tap_dance_state_t *state, void *user_data); // GUI->CTL->ALT +void ubermod2(qk_tap_dance_state_t *state, void *user_data); // ALT->CTL->GUI +void ubermod2_mac(qk_tap_dance_state_t *state, void *user_data); // ALT->GUI->CTL +void shift_reset(qk_tap_dance_state_t *state, void *user_data); +void gui_reset(qk_tap_dance_state_t *state, void *user_data); +void CAS_reset(qk_tap_dance_state_t *state, void *user_data); +void CASG_reset(qk_tap_dance_state_t *state, void *user_data); +void ubermod_reset(qk_tap_dance_state_t *state, void *user_data); // AKA CAG_reset +void shiftenter(qk_tap_dance_state_t *state, void *user_data); +void shiftentercaps(qk_tap_dance_state_t *state, void *user_data); +void ctrl_all_mac(qk_tap_dance_state_t *state, void *user_data); // C->CG->CAG +void ctrl_all(qk_tap_dance_state_t *state, void *user_data); // C->CA->SC +void alt_all(qk_tap_dance_state_t *state, void *user_data); // A->SA->AC +void shift_and(qk_tap_dance_state_t *state, void *user_data); // SC->SA->SG +void shift_and_mac(qk_tap_dance_state_t *state, void *user_data); // SG->SC->SA + +enum { + SHCAP = 0 + ,TDGUI + ,TDGUI2 + ,SHENT + ,SHNTC + ,GUCTL + ,FRBK + ,FRBK2 + ,GCA + ,AGC + ,SGCA + ,SCAG + ,CAG + ,ACG + ,CTLALL + ,CTLAND + ,DLTR +}; |