From 1baa99c6473473ba3204c9861951e70c10d037cb Mon Sep 17 00:00:00 2001 From: Reed Date: Mon, 29 Jun 2020 13:23:13 -0400 Subject: [PATCH] [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 --- keyboards/ergodox_ez/keymaps/rmw/config.h | 59 +++ keyboards/ergodox_ez/keymaps/rmw/keymap-mac.c | 188 +++++++++ keyboards/ergodox_ez/keymaps/rmw/keymap-win.c | 159 +++++++ keyboards/ergodox_ez/keymaps/rmw/keymap.c | 13 + keyboards/ergodox_ez/keymaps/rmw/readme.md | 11 + keyboards/ergodox_ez/keymaps/rmw/rules.mk | 1 + keyboards/kyria/keymaps/rmw/config.h | 36 ++ keyboards/kyria/keymaps/rmw/keymap.c | 199 +++++++++ keyboards/kyria/keymaps/rmw/readme.md | 9 + keyboards/kyria/keymaps/rmw/rules.mk | 4 + keyboards/kyria/kyria.h | 22 + users/rmw/encoder_functions.c | 53 +++ users/rmw/encoder_functions.h | 11 + users/rmw/rmw.c | 1 + users/rmw/rmw.h | 87 ++++ users/rmw/rules.mk | 9 + users/rmw/tapdances.c | 389 ++++++++++++++++++ users/rmw/tapdances.h | 46 +++ 18 files changed, 1297 insertions(+) create mode 100644 keyboards/ergodox_ez/keymaps/rmw/config.h create mode 100644 keyboards/ergodox_ez/keymaps/rmw/keymap-mac.c create mode 100644 keyboards/ergodox_ez/keymaps/rmw/keymap-win.c create mode 100644 keyboards/ergodox_ez/keymaps/rmw/keymap.c create mode 100644 keyboards/ergodox_ez/keymaps/rmw/readme.md create mode 100644 keyboards/ergodox_ez/keymaps/rmw/rules.mk create mode 100644 keyboards/kyria/keymaps/rmw/config.h create mode 100644 keyboards/kyria/keymaps/rmw/keymap.c create mode 100644 keyboards/kyria/keymaps/rmw/readme.md create mode 100644 keyboards/kyria/keymaps/rmw/rules.mk create mode 100644 users/rmw/encoder_functions.c create mode 100644 users/rmw/encoder_functions.h create mode 100644 users/rmw/rmw.c create mode 100644 users/rmw/rmw.h create mode 100644 users/rmw/rules.mk create mode 100644 users/rmw/tapdances.c create mode 100644 users/rmw/tapdances.h diff --git a/keyboards/ergodox_ez/keymaps/rmw/config.h b/keyboards/ergodox_ez/keymaps/rmw/config.h new file mode 100644 index 0000000000..7b90c2327a --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/rmw/config.h @@ -0,0 +1,59 @@ +/* +Copyright 2012 Jun Wako +Copyright 2013 Oleg Kostyuk +Edited like hell 2017+ by Reed Williams + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#pragma once + +#define MACOSX + +/* USB Device descriptor parameter */ +#ifndef DESCRIPTION +#define DESCRIPTION QMK keyboard firmware for Ergodox EZ +#endif + +#define USB_MAX_POWER_CONSUMPTION 500 + +#define QMK_KEYS_PER_SCAN 4 +/* Set 0 if debouncing isn't needed */ +#undef DEBOUNCE +#define DEBOUNCE 5 + + +#define ONESHOT_TIMEOUT 900 // how long before oneshot times out +//#define ONESHOT_TAP_TOGGLE 2 // how many taps before oneshot toggle is triggered + +#undef LOCKING_SUPPORT_ENABLE +#undef LOCKING_RESYNC_ENABLE + +#undef MOUSEKEY_DELAY +#define MOUSEKEY_DELAY 20 +#undef MOUSEKEY_MAX_SPEED +#define MOUSEKEY_MAX_SPEED 6 +#undef MOUSEKEY_TIME_TO_MAX +#define MOUSEKEY_TIME_TO_MAX 254 +#undef MOUSEKEY_WHEEL_MAX_SPEED +#define MOUSEKEY_WHEEL_MAX_SPEED 10 +#undef MOUSEKEY_WHEEL_TIME_TO_MAX +#define MOUSEKEY_WHEEL_TIME_TO_MAX 254 + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION +//#define DEBUG_MATRIX_SCAN_RATE diff --git a/keyboards/ergodox_ez/keymaps/rmw/keymap-mac.c b/keyboards/ergodox_ez/keymaps/rmw/keymap-mac.c new file mode 100644 index 0000000000..7a78ce98e7 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/rmw/keymap-mac.c @@ -0,0 +1,188 @@ +#include "rmw.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [QWERTY] = LAYOUT_ergodox( + TD(FRBK2), KC_1, KC_2, KC_3, KC_4, KC_5, KC_F4, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TO(EDIT), + OSL(EDIT), KC_A, LT(NUMPAD,KC_S), KC_D, LT(FSYM,KC_F), KC_G, + LCTL(KC_LEFT), KC_Z, KC_X, KC_C, KC_V, SFT_T(KC_B), KC_TAB, + TD(CTLALL), OSL(ADJUST), TD(GUCTL), TD(SGCA), TD(AGC), + OS_CMD, OS_CTL , + KC_ESCAPE, + KC_BSPACE, TD(SHENT), OSL(EDIT), + + KC_F5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + TO(NUMPAD), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_H, LT(JSYM,KC_J), KC_K, KC_L, LT(EDIT,KC_SCLN), KC_QUOTE, + CTL_T(KC_B), KC_N, KC_M, KC_COMM, KC_DOT, LT(MEDIA,KC_SLSH), LCTL(KC_RIGHT), + TD(GCA), TD(CTLALL), KC_LBRC, KC_RBRC, KC_MS_BTN1, + OS_CALT, KC_TAB, + KC_DEL, + KC_CAPS, SFTENT, KC_SPC), + + + [MINIMAK4] = LAYOUT_ergodox( + TD(FRBK2), KC_1, KC_2, KC_3, KC_4, KC_5, KC_F4, + KC_TAB, KC_Q, KC_W, KC_D, KC_R, KC_K, TO(EDIT), + OSL(EDIT), KC_A, LT(NUMPAD,KC_S), KC_T, LT(FSYM,KC_F), KC_G, + OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_V, SFT_T(KC_B), KC_TAB, + TD(CTLALL), OSL(ADJUST), TD(GUCTL), TD(SGCA), TD(AGC), + OS_CMD, OS_CTL , + KC_ESCAPE, + KC_BSPACE, TD(SHENT), OSL(EDIT), + KC_F5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + TO(NUMPAD), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_H, LT(JSYM,KC_J), KC_E, KC_L, LT(EDIT,KC_SCLN), KC_QUOTE, + CTL_T(KC_B), KC_N, KC_M, KC_COMM, KC_DOT, LT(MEDIA,KC_SLSH), KC_MS_BTN1, + TD(GCA), TD(CTLALL), LGUI(KC_GRV), KC_RBRC, KC_MS_BTN1, + OS_ALT, KC_TAB, + KC_DEL, + KC_CAPS, SFT_T(KC_ENT), KC_SPC), + + [NUMPAD] = LAYOUT_ergodox(VRSN, KC_F11, KC_F12, KC_F1, KC_F2, KC_F3, _______, + _______, _______, KC_PGUP, KC_UP, KC_PGDOWN, _______, TO(QWERTY), + _______, _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, + _______, LGUI(KC_Z), LGUI(KC_X), LGUI(KC_C), LGUI(KC_V), LGUI(KC_Y), _______, + _______, _______, _______, _______, _______, + _______, _______, KC_PSCREEN, _______, _______, TO(QWERTY), + + _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, + TO(EDIT), _______, KC_7, KC_8, KC_9, KC_KP_MINUS, _______, + _______, KC_4, KC_5, KC_6, KC_KP_PLUS, _______, + _______, KC_COMM, KC_1, KC_2, KC_3, KC_KP_SLASH, _______, + KC_0, KC_DOT, KC_EQUAL, KC_KP_ASTERISK, _______, + _______, _______, KC_INSERT, TO(EDIT), _______, _______), + + [EDIT] = LAYOUT_ergodox(_______, _______, KC_MS_WH_UP, KC_MS_BTN1, KC_MS_BTN2, _______, _______, + _______, LGUI(LALT(KC_ESCAPE)), KC_MS_WH_DOWN, LALT(S(KC_LEFT)), LALT(S(KC_RIGHT)), _______, TO(NUMPAD), + _______, _______, LGUI(KC_GRV), LALT(KC_LEFT), LALT(KC_RIGHT), _______, + LCTL(KC_RIGHT), LGUI(KC_Z), LGUI(KC_X), LGUI(KC_C), LGUI(KC_V), LGUI(KC_Y), _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, TO(NUMPAD), + _______, _______, _______, S(KC_UP), _______, _______, KC_DELETE, + TO(QWERTY), LGUI(KC_T), KC_PGUP, KC_UP, KC_PGDOWN, KC_PSCREEN, _______, + LGUI(KC_LEFT), KC_LEFT, KC_DOWN, KC_RIGHT, LGUI(KC_RIGHT), _______, + _______, S(LGUI(KC_LEFT)), S(KC_LEFT), S(KC_DOWN), S(KC_RIGHT), S(LGUI(KC_RIGHT)), LCTL(KC_LEFT), + _______, _______, FORM_GET, FORM_PUT, _______, + _______, _______, _______, S(KC_F10), _______, _______), + + [FSYM] = LAYOUT_ergodox(_______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, KC_TILD, KC_EXLM, _______, _______, + LCTL(KC_RIGHT), _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, DEL_WRD, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, KC_CIRC, KC_AMPR , KC_ASTR, KC_GRV , _______, _______, + KC_EQUAL, KC_MINUS, KC_UNDS, KC_BSLS, KC_COLON, KC_DQT , + _______, _______, KC_PLUS , KC_SLSH, KC_PIPE, _______ , _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______), + + [JSYM] = LAYOUT_ergodox(_______, _______, _______, _______, _______, _______, _______, + _______, KC_GRV, KC_AT , KC_LCBR, KC_RCBR, _______, _______, + _______, KC_HASH, KC_DLR , KC_LPRN, KC_RPRN, KC_LEFT, + _______, KC_PERC, KC_CIRC, KC_LBRACKET, KC_RBRACKET, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, KC_QUES, KC_SLSH, KC_COLON, _______, + _______, _______, _______, _______, _______, _______, LCTL(KC_LEFT), + _______, _______, _______, _______, _______, + _______, _______, _______, _______, LGUI(KC_DOWN), _______), + + [MEDIA] = LAYOUT_ergodox(_______, _______, KC_MS_BTN4, _______, KC_MS_BTN5, _______, _______, + _______, KC_MS_WH_UP, KC_MS_WH_LEFT, KC_MS_UP, KC_MS_WH_RIGHT, _______, _______, + _______, KC_MS_WH_DOWN, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, _______, + _______, _______, KC_MS_ACCEL0, KC_MS_ACCEL1, KC_MS_ACCEL2, _______, _______, + _______, _______, _______, _______, KC_MS_BTN3, + _______, _______, _______, KC_MS_BTN1, KC_MS_BTN2, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, KC_AUDIO_VOL_DOWN, KC_AUDIO_MUTE, KC_AUDIO_VOL_UP, _______, _______, + KC_MEDIA_REWIND, KC_MEDIA_FAST_FORWARD, _______, _______, _______, + _______, _______, _______, _______, KC_MS_BTN1, KC_MEDIA_PLAY_PAUSE), + + [ADJUST] = LAYOUT_ergodox(_______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, TO(EDIT), TO(NUMPAD), TO(FSYM), TO(JSYM), TO(MEDIA), + _______, _______, _______, _______, _______, _______, _______, + _______, TO(QWERTY), DF(MINIMAK4), DF(QWERTY), _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______), + +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case VRSN: + if (record->event.pressed) { + SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + } + return false; + case FORM_GET: + if (record->event.pressed) { + tap_code(KC_BTN1); + tap_code16(G(KC_A)); + tap_code16(G(KC_C)); + } + return false; + case FORM_PUT: + if (record->event.pressed) { + tap_code(KC_BTN1); + tap_code16(G(KC_A)); + tap_code16(G(KC_V)); + } + return false; + } + return true; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + switch (get_highest_layer(state)) { + case QWERTY: + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + break; + case NUMPAD: + ergodox_right_led_1_on(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + break; + case EDIT: + ergodox_right_led_1_off(); + ergodox_right_led_2_on(); + ergodox_right_led_3_off(); + break; + case FSYM: + ergodox_right_led_1_on(); + ergodox_right_led_2_on(); + ergodox_right_led_3_off(); + break; + case JSYM: + ergodox_right_led_1_on(); + ergodox_right_led_2_off(); + ergodox_right_led_3_on(); + break; + case MEDIA: + ergodox_right_led_1_off(); + ergodox_right_led_2_on(); + ergodox_right_led_3_on(); + break; + case ADJUST: + ergodox_right_led_1_on(); + ergodox_right_led_2_on(); + ergodox_right_led_3_on(); + break; + } + return state; +} diff --git a/keyboards/ergodox_ez/keymaps/rmw/keymap-win.c b/keyboards/ergodox_ez/keymaps/rmw/keymap-win.c new file mode 100644 index 0000000000..9f7435c0d7 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/rmw/keymap-win.c @@ -0,0 +1,159 @@ +#include "rmw.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [QWERTY] = LAYOUT_ergodox( // LEFT HAND + TD(FRBK), KC_1, KC_2, KC_3, KC_4, KC_5, KC_F4, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TO(EDIT), + OSL(EDIT), KC_A, LT(NUMPAD,KC_S), KC_D, LT(FSYM,KC_F), KC_G, + OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_V, SFT_T(KC_B), KC_TAB, + TD(CTLAND), OSL(ADJUST), TD(SCAG), TD(TDGUI), TD(ACG), + OS_ALT, OS_CTL , + KC_ESCAPE, + KC_BSPACE, TD(SHENT), OSL(EDIT), + + // RIGHT HAND + KC_F5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + TO(NUMPAD), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_H, LT(JSYM,KC_J), KC_K, KC_L, LT(EDIT,KC_SCLN), KC_QUOTE, + CTL_T(KC_B), KC_N, KC_M, KC_COMM, KC_DOT, LT(MEDIA,KC_SLSH), TD(SHENT), + TD(CAG), TD(TDGUI), KC_LBRC, KC_RBRC, KC_MS_BTN1, + OS_ALT, KC_TAB, + KC_DEL, + KC_CAPS, SFT_T(KC_ENT), KC_SPC), + + + [NUMPAD] = LAYOUT_ergodox(VRSN, KC_F11, KC_F12, KC_F1, KC_F2, KC_F3, _______, + _______, _______, KC_PGUP, KC_UP, KC_PGDOWN, _______, TO(0), + _______, _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, + _______, LCTL(KC_Z), LCTL(KC_X), LCTL(KC_C), LCTL(KC_V), LCTL(KC_Y), _______, + _______, _______, _______, _______, _______, + _______, _______, KC_PSCREEN, _______, _______, TO(0), + + _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, + TO(EDIT), _______, KC_7, KC_8, KC_9, KC_KP_MINUS, _______, + _______, KC_4, KC_5, KC_6, KC_KP_PLUS, _______, + _______, KC_COMM, KC_1, KC_2, KC_3, KC_KP_SLASH, _______, + KC_0, KC_DOT, KC_EQUAL, KC_KP_ASTERISK, _______, + _______, _______, KC_INSERT, TO(EDIT), _______, _______), + + [EDIT] = LAYOUT_ergodox(KC_ESCAPE, LALT(LCTL(KC_DELETE)), KC_MS_WH_UP, KC_MS_BTN1, KC_MS_BTN2, _______, _______, + _______, LCTL(S(KC_ESCAPE)), KC_MS_WH_DOWN, LCTL(S(KC_LEFT)), LCTL(S(KC_RIGHT)), _______, TO(NUMPAD), + _______, _______, KC_LEFT, LCTL(KC_LEFT), LCTL(KC_RIGHT), _______, + _______, LCTL(KC_Z), LCTL(KC_X), LCTL(KC_C), LCTL(KC_V), LCTL(KC_Y), _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, TO(NUMPAD), + _______, _______, _______, S(KC_UP), _______, _______, KC_DELETE, + TO(0), LCTL(KC_T), KC_PGUP, KC_UP, KC_PGDOWN, KC_PSCREEN, _______, + KC_HOME, KC_LEFT, KC_DOWN, KC_RIGHT, KC_END, _______, + _______, S(KC_HOME), S(KC_LEFT), S(KC_DOWN), S(KC_RIGHT), S(KC_END), _______, + _______, _______, _______, _______, _______, + _______, _______, _______, S(KC_F10), _______, _______), + + [FSYM] = LAYOUT_ergodox(_______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, KC_TILD, KC_EXLM, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, KC_CIRC, KC_AMPR , KC_ASTR, KC_GRV , _______, _______, + KC_EQUAL, KC_MINUS, KC_UNDS, KC_BSLS, KC_COLON, KC_DQT , + _______, _______, KC_PLUS , KC_SLSH, KC_PIPE, _______ , _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______), + + [JSYM] = LAYOUT_ergodox(_______, _______, _______, _______, _______, _______, _______, + _______, KC_GRV, KC_AT , KC_LCBR, KC_RCBR, _______, _______, + _______, KC_HASH, KC_DLR , KC_LPRN, KC_RPRN, KC_LEFT, + _______, KC_PERC, KC_CIRC, KC_LBRACKET, KC_RBRACKET, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, KC_QUES, KC_SLSH, KC_COLON, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______), + + [MEDIA] = LAYOUT_ergodox(_______, _______, KC_MS_BTN4, _______, KC_MS_BTN5, _______, _______, + _______, KC_MS_WH_UP, KC_MS_WH_LEFT, KC_MS_UP, KC_MS_WH_RIGHT, _______, _______, + _______, KC_MS_WH_DOWN, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, _______, + _______, _______, KC_MS_ACCEL0, KC_MS_ACCEL1, KC_MS_ACCEL2, _______, _______, + _______, _______, _______, _______, KC_MS_BTN3, + _______, _______, _______, KC_MS_BTN1, KC_MS_BTN2, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, KC_AUDIO_VOL_DOWN, KC_AUDIO_MUTE, KC_AUDIO_VOL_UP, _______, _______, + KC_MEDIA_PREV_TRACK, KC_MEDIA_NEXT_TRACK, _______, _______, _______, + _______, _______, _______, _______, KC_MS_BTN1, KC_MEDIA_PLAY_PAUSE), + + [ADJUST] = LAYOUT_ergodox(_______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, TO(EDIT), TO(NUMPAD), TO(FSYM), TO(JSYM), TO(MEDIA), + _______, _______, _______, _______, _______, _______, _______, + _______, TO(QWERTY), _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______), + +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + // dynamically generate these. + case VRSN: + if (record->event.pressed) { + SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + } + return false; + } + return true; +} + + +layer_state_t layer_state_set_user(layer_state_t state) { + switch (get_highest_layer(state)) { + case QWERTY: + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + break; + case NUMPAD: + ergodox_right_led_1_on(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + break; + case EDIT: + ergodox_right_led_1_off(); + ergodox_right_led_2_on(); + ergodox_right_led_3_off(); + break; + case FSYM: + ergodox_right_led_1_on(); + ergodox_right_led_2_on(); + ergodox_right_led_3_off(); + break; + case JSYM: + ergodox_right_led_1_on(); + ergodox_right_led_2_off(); + ergodox_right_led_3_on(); + break; + case MEDIA: + ergodox_right_led_1_off(); + ergodox_right_led_2_on(); + ergodox_right_led_3_on(); + break; + case ADJUST: + ergodox_right_led_1_on(); + ergodox_right_led_2_on(); + ergodox_right_led_3_on(); + break; + } + return state; +} diff --git a/keyboards/ergodox_ez/keymaps/rmw/keymap.c b/keyboards/ergodox_ez/keymaps/rmw/keymap.c new file mode 100644 index 0000000000..b0b9bf13cd --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/rmw/keymap.c @@ -0,0 +1,13 @@ +#include "ergodox_ez.h" +#include "version.h" + +#define LONGPRESS_DELAY 180 +#define LAYER_TOGGLE_DELAY 350 + +#ifdef MACOSX +#include "keymap-mac.c" +#endif + +#ifdef WINDOWS +#include "keymap-win.c" +#endif diff --git a/keyboards/ergodox_ez/keymaps/rmw/readme.md b/keyboards/ergodox_ez/keymaps/rmw/readme.md new file mode 100644 index 0000000000..36e0d1de00 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/rmw/readme.md @@ -0,0 +1,11 @@ +# RMW Ergodox_EZ Layout + +This is the keymap I use on the Ergodox_EZ I use for work. I write reports and code in a variety of languages on this board and the various layers provide plenty of flexibility for navigating, editing text, and writing code and prose. + +I switched to a Mac in the past year, so my keymap now mostly gets used in the Mac mode; simply edit the keymap.c file to uncomment \#include keymap-win.c and comment out \#include keymap-mac.c to change back to the Windows version, but I haven't been updating that map as I've made changes moving forward on the Mac version. + +## The theory of this keymap + +The base layer is either QWERTY or MINIMAK4, as desired. Overlaid on that base layer are various layers triggered by one-shots, TOs, and LTs. Tapdances are used to cram lots of mods into few keys and provide freedom to hit combinations with either hand. Mods and layer things are one-shot (where reasonable) because I prefer that. + +An EDIT layer provides text navigation, selection, and editing capabilities in home position. The EXCEL layer offers a numpad and various spreadsheet-useful navigations and operations. Holding S will put the numpad under your right hand in home position. Keys F and J offer various useful symbols (mostly) on the opposite hand when held, including \[\]\(\)\{\} under the left pointer and middle fingers on bottom, middle, and top rows respectively. The MEDIA layer provides media controls (obvs) and some mouse movement and nav, in case I don't feel like reaching for the trackball/trackpad/mouse. diff --git a/keyboards/ergodox_ez/keymaps/rmw/rules.mk b/keyboards/ergodox_ez/keymaps/rmw/rules.mk new file mode 100644 index 0000000000..31e0fcf293 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/rmw/rules.mk @@ -0,0 +1 @@ +TAP_DANCE_ENABLE=yes diff --git a/keyboards/kyria/keymaps/rmw/config.h b/keyboards/kyria/keymaps/rmw/config.h new file mode 100644 index 0000000000..02e5087b3e --- /dev/null +++ b/keyboards/kyria/keymaps/rmw/config.h @@ -0,0 +1,36 @@ +/* Copyright 2019 Thomas Baart + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define MACOSX + +#ifdef OLED_DRIVER_ENABLE + #define OLED_DISPLAY_128X64 +#endif + +#ifdef RGBLIGHT_ENABLE + #define RGBLIGHT_ANIMATIONS + #define RGBLIGHT_HUE_STEP 8 + #define RGBLIGHT_SAT_STEP 8 + #define RGBLIGHT_VAL_STEP 8 +#endif + +// If you are using an Elite C rev3 on the follower side, uncomment the lines below: +// #define SPLIT_USB_DETECT +// #define NO_USB_STARTUP_CHECK + + diff --git a/keyboards/kyria/keymaps/rmw/keymap.c b/keyboards/kyria/keymaps/rmw/keymap.c new file mode 100644 index 0000000000..bf04272382 --- /dev/null +++ b/keyboards/kyria/keymaps/rmw/keymap.c @@ -0,0 +1,199 @@ +/* Copyright 2019 Thomas Baart + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include QMK_KEYBOARD_H +#include "rmw.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [QWERTY] = LAYOUT_stack( + KC_TAB , KC_Q, KC_W, KC_E, KC_R, KC_T, + OSL(EDIT), KC_A, LT(NUMPAD,KC_S), KC_D, LT(FSYM,KC_F), KC_G, + TD(FRBK2) , KC_Z, KC_X, KC_C, KC_V, KC_B, TO(EDIT), KC_ESCAPE, + TO(ADJUST), TD(SGCA), TD(AGC), KC_BSPACE, TD(SHNTC), + + KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_H, LT(JSYM,KC_J), KC_K, KC_L, LT(EDIT,KC_SCLN), KC_QUOT, + KC_DEL, TO(NUMPAD), KC_N, KC_M, KC_COMM, KC_DOT, LT(MEDIA,KC_SLSH), KC_MS_BTN1, + SFTENT, KC_SPC, TD(GCA), TD(CTLALL), KC_CAPS + ), + + [MINIMAK4] = LAYOUT_stack( + KC_TAB , KC_Q, KC_W, KC_D, KC_R, KC_K, + OSL(EDIT), KC_A, LT(NUMPAD,KC_S), KC_T, LT(FSYM,KC_F), KC_G, + OSM(MOD_LSFT) , KC_Z, KC_X, KC_C, KC_V, KC_B, TO(EDIT), KC_ESCAPE, + _______, TO(ADJUST), TD(SGCA), KC_BSPACE, TD(SHNTC), + + KC_Y, KC_U, KC_I, KC_O, KC_P, KC_PIPE, + KC_H, LT(JSYM,KC_J), KC_E, KC_L, LT(EDIT,KC_SCLN), KC_QUOT, + KC_DEL, TO(NUMPAD), KC_N, KC_M, KC_COMM, KC_DOT, LT(MEDIA,KC_SLSH), KC_MINS, + SFTENT, KC_SPC, TD(GCA), TD(CTLALL), _______ + ), + + [NUMPAD] = LAYOUT_stack( + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, TO(QWERTY), _______, + _______, _______, _______, _______ , _______, + + _______, KC_7, KC_8, KC_9, KC_KP_MINUS, _______, + _______, KC_4, KC_5, KC_6, KC_KP_PLUS , _______, + _______, TO(EDIT), _______, KC_1, KC_2, KC_3, KC_KP_SLASH, LCTL(KC_RIGHT), + _______, _______, KC_0, KC_DOT, _______ + ), + + [EDIT] = LAYOUT_stack( + _______, TASK_MAN, _______, SELW_LEFT, SELW_RIGHT, _______, + _______, _______ , LGUI(KC_GRV), MVW_LEFT, MVW_RIGHT , _______, + LCTL(KC_LEFT), R_UNDO, R_CUT , R_COPY , R_PASTE, R_REDO , TO(NUMPAD), FORM_GET, + _______, _______, _______, DEL_WRD, _______, + + NEW_TAB , KC_PGUP, KC_UP, KC_PGDOWN, KC_PSCREEN, _______, + R_HOME , KC_LEFT, KC_DOWN, KC_RIGHT, R_END, _______, + FORM_PUT, TO(QWERTY), SEL_HOME, S(KC_LEFT), S(KC_DOWN), S(KC_RIGHT), SEL_END, _______, + _______, _______, _______, _______, _______ + ), + + [ADJUST] = LAYOUT_stack( + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, + TO(QWERTY), TO(EDIT), TO(NUMPAD), TO(JSYM), TO(FSYM), TO(MEDIA), + DF(MINIMAK4), DF(QWERTY), RGB_SAD, RGB_HUD, RGB_VAD, RGB_RMOD,_______, _______, + _______, _______, _______, _______, _______, + + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______ + ), + + [FSYM] = LAYOUT_stack( + _______, _______, _______, _______, _______, _______, + _______, _______, KC_TILD, KC_EXLM, _______, _______, + LCTL(KC_RIGHT), _______, TO(QWERTY), _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + + KC_CIRC, KC_AMPR , KC_ASTR, KC_GRV , _______, _______, + KC_EQUAL, KC_MINUS, KC_UNDS, KC_PIPE, KC_COLON, KC_DQT, + _______, _______, _______, KC_PLUS, KC_BSLS, KC_SLSH, _______, _______, + _______, _______, _______, _______, _______ + ), + + [JSYM] = LAYOUT_stack( + _______, KC_GRV, KC_AT , KC_LCBR, KC_RCBR, _______, + _______, KC_HASH, KC_DLR , KC_LPRN, KC_RPRN, KC_LEFT, + _______, KC_PERC, KC_CIRC, KC_LBRACKET, KC_RBRACKET, _______, _______, _______, + _______, _______, _______, _______, _______, + + _______, _______, _______, _______, _______, _______, + _______, _______, KC_QUES, KC_SLSH, KC_COLON, _______, + _______, _______, _______, _______, _______, TO(QWERTY), _______, LCTL(KC_LEFT), + _______, _______, _______, _______, _______ + ), + + [MEDIA] = LAYOUT_stack( + _______, KC_WH_U, KC_WH_L, KC_MS_UP, KC_WH_R, _______, + _______, KC_WH_D, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, _______, + _______, _______, KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, _______, + _______, _______, _______, _______, _______, + + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, KC_VOLD, KC_MUTE, KC_VOLU, _______, + KC_MS_BTN1, KC_MEDIA_PLAY_PAUSE, KC_MRWD, KC_MFFD, _______ + ) +}; + +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case FORM_GET: + if (record->event.pressed) { + tap_code(KC_BTN1); + tap_code16(G(KC_A)); + tap_code16(G(KC_C)); + } + return false; + case FORM_PUT: + if (record->event.pressed) { + tap_code16(KC_MS_BTN1); + tap_code16(G(KC_A)); + tap_code16(G(KC_V)); + } + return false; + } + return true; +} + +#ifdef ENCODER_ENABLE +void encoder_update_keymap(uint8_t index, bool clockwise) { + if (index == 0) { + switch (get_highest_layer(layer_state)) { + case EDIT: + enc_move_words(clockwise); + break; + case QWERTY: + enc_move_desktop(clockwise); + default: + enc_history_scrubbing(clockwise); + break; + } + } else if (index == 1) { + switch (get_highest_layer(layer_state)) { + case QWERTY: + enc_scrolling(clockwise); + break; + case FSYM: + enc_zoom(clockwise); + break; + default: + enc_volume_knob(clockwise); + break; + } + } +} +#endif + +#ifdef RGBLIGHT_ENABLE // include mods, as well as layers +layer_state_t layer_state_set_user(layer_state_t state) { + switch (get_highest_layer(state)) { + case QWERTY: + rgblight_setrgb (0x00, 0x00, 0x00); + break; + case MINIMAK4: + rgblight_setrgb (0x20, 0x20, 0x20); + break; + case NUMPAD: + rgblight_setrgb (0xFF, 0x00, 0x00); + break; + case EDIT: + rgblight_setrgb (0x00, 0xFF, 0x00); + break; + case FSYM: + rgblight_setrgb (0x7A, 0x7A, 0x00); + break; + case JSYM: + rgblight_setrgb (0x7A, 0x00, 0x7A); + break; + case MEDIA: + rgblight_setrgb (0x00, 0x7A, 0x7A); + break; + case ADJUST: + rgblight_setrgb (0x7A, 0x7A, 0x7A); + break; + default: + rgblight_setrgb (0x00, 0x00, 0x00); + } + return state; +} +#endif diff --git a/keyboards/kyria/keymaps/rmw/readme.md b/keyboards/kyria/keymaps/rmw/readme.md new file mode 100644 index 0000000000..c05ca494b7 --- /dev/null +++ b/keyboards/kyria/keymaps/rmw/readme.md @@ -0,0 +1,9 @@ +# RMW Kyria Layout + +This is a Kyria edition of the keymap I use on the Ergodox_EZ I use for work. I write reports and code in a variety of languages on that board and the various layers provide plenty of flexibility for navigating, editing text, and writing code and prose. This keymap is mostly Mac-focused in its shortcuts and tapdances. + +## The theory of this keymap + +The base layer is either QWERTY or MINIMAK4, as desired. Overlaid on that base layer are various layers triggered by one-shots, TOs, and LTs. Tapdances are used to cram lots of mods into few keys and provide freedom to hit combinations with either hand. Mods and layer things are one-shot (where reasonable) because I prefer that. + +An EDIT layer provides text navigation, selection, and editing capabilities in home position. The NUMPAD layer offers a numpad and various spreadsheet-useful navigations and operations. Holding S will put the numpad under your right hand in home position. Keys F and J offer various useful symbols (mostly) on the opposite hand when held, including \[\]\(\)\{\} under the left pointer and middle fingers on bottom, middle, and top rows respectively. The MEDIA layer provides media controls (obvs) and some mouse movement and nav, in case I don't feel like reaching for the trackball/trackpad/mouse. diff --git a/keyboards/kyria/keymaps/rmw/rules.mk b/keyboards/kyria/keymaps/rmw/rules.mk new file mode 100644 index 0000000000..d41ffaef6d --- /dev/null +++ b/keyboards/kyria/keymaps/rmw/rules.mk @@ -0,0 +1,4 @@ +OLED_DRIVER_ENABLE = no # Enables the use of OLED displays +ENCODER_ENABLE = yes # Enables the use of one or more encoders +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +TAP_DANCE_ENABLE=yes # Enables Tap Dance diff --git a/keyboards/kyria/kyria.h b/keyboards/kyria/kyria.h index a2a675e0db..13375ae882 100644 --- a/keyboards/kyria/kyria.h +++ b/keyboards/kyria/kyria.h @@ -41,3 +41,25 @@ { R32, R33, R34, R35, R36, R37, R38, R39 }, \ { R45, R46, R47, R48, R49, KC_NO, KC_NO, KC_NO }, \ } + +#define LAYOUT_stack( \ + L00, L01, L02, L03, L04, L05, \ + L12, L13, L14, L15, L16, L17, \ + L24, L25, L26, L27, L28, L29, L30, L31, \ + L40, L41, L42, L43, L44, \ + \ + R06, R07, R08, R09, R10, R11, \ + R18, R19, R20, R21, R22, R23, \ + R32, R33, R34, R35, R36, R37, R38, R39, \ + R45, R46, R47, R48, R49 \ +) \ +{ \ + { KC_NO, KC_NO, L05, L04, L03, L02, L01, L00 }, \ + { KC_NO, KC_NO, L17, L16, L15, L14, L13, L12 }, \ + { L31, L30, L29, L28, L27, L26, L25, L24 }, \ + { L44, L43, L42, L41, L40, KC_NO, KC_NO, KC_NO }, \ + { KC_NO, KC_NO, R06, R07, R08, R09, R10, R11 }, \ + { KC_NO, KC_NO, R18, R19, R20, R21, R22, R23 }, \ + { R32, R33, R34, R35, R36, R37, R38, R39 }, \ + { R45, R46, R47, R48, R49, KC_NO, KC_NO, KC_NO }, \ +} 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 +};