From 6f386ca6ae82be9212700dbfeb73517d077bef5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Mon, 28 Jan 2019 09:04:47 +0100 Subject: [PATCH] Change how desktop commands work --- keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c | 8 ++++---- keyboards/whitefox/keymaps/konstantin/keymap.c | 4 ++-- users/konstantin/konstantin.c | 12 ++++++++++++ users/konstantin/konstantin.h | 7 +++++++ users/konstantin/tap_dance.c | 2 +- users/konstantin/tap_dance.h | 6 ++---- 6 files changed, 28 insertions(+), 11 deletions(-) diff --git a/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c b/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c index fa324be9a11..707515abb47 100644 --- a/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c +++ b/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c @@ -58,7 +58,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┤ * │ │Mut│VoD│VoU│Ply│Prv│Nxt│MW←│MW→│M4 │M5 │ │ │ * └─────┬──┴┬──┴──┬┴───┴───┴───┴───┴───┴───┴──┬┴───┴┬───┬─┴───┘ - * │ │ │ MW↓ │MAcl2│ │ + * │DPR│DstNA│ MW↓ │MAcl2│ │ * └───┴─────┴───────────────────────────┴─────┴───┘ */ [L_FN] = LAYOUT( @@ -66,7 +66,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, KC_HOME, KC_UP, KC_END, KC_PGUP, _______, _______, _______, _______, KC_BTN1, KC_MS_U, KC_BTN2, KC_BTN3, KC_DEL, _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, _______, _______, _______, KC_WH_U, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, KC_MPLY, KC_MPRV, KC_MNXT, KC_WH_L, KC_WH_R, KC_BTN4, KC_BTN5, _______, _______, - XXXXXXX, _______, _______, KC_WH_D, KC_ACL2, _______, XXXXXXX + XXXXXXX, DST_P_R, DST_N_A, KC_WH_D, KC_ACL2, _______, XXXXXXX ), /* RCtrl layer @@ -79,7 +79,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┤ * │ │ │ │ │ │ │ │ │ │ │ │ │ │ * └─────┬──┴┬──┴──┬┴───┴───┴───┴───┴───┴───┴──┬┴───┴┬───┬─┴───┘ - * │Dst│Dstp←│ │Dstp→│ │ + * │DtR│DstA │ │ │ │ * └───┴─────┴───────────────────────────┴─────┴───┘ */ [L_RCTRL] = LAYOUT( @@ -87,6 +87,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, TOP, MV_UP, BOTTOM, PRV_TAB, _______, _______, _______, _______, _______, _______, _______, _______, CLEAR, _______, MV_LEFT, MV_DOWN, MV_RGHT, NXT_TAB, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - XXXXXXX, DESKTOP, DSKTP_L, _______, DSKTP_R, _______, XXXXXXX + XXXXXXX, DST_RMV, DST_ADD, _______, _______, _______, XXXXXXX ), }; diff --git a/keyboards/whitefox/keymaps/konstantin/keymap.c b/keyboards/whitefox/keymaps/konstantin/keymap.c index e37097361a2..a56d0a43e4f 100644 --- a/keyboards/whitefox/keymaps/konstantin/keymap.c +++ b/keyboards/whitefox/keymaps/konstantin/keymap.c @@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤ * │ │MA0│MA2│MW←│MW→│ │ │ │VoD│VoU│Mut│ App │PgU│Btm│ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬─┬───┼───┼───┤ - * │ │Dstp│Dst←│ MW↓ │Dst→│ │ │Hom│PgD│End│ + * │ │DtPR│DtNA│ MW↓ │ │ │ │Hom│PgD│End│ * └────┴────┴────┴────────────────────────┴────┴────┘ └───┴───┴───┘ */ [L_FN] = LAYOUT_truefox( \ @@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_BTN4, KC_BTN2, KC_MS_U, KC_BTN1, KC_BTN3, KC_BTN5, _______, UC_MOD, _______, KC_MSTP, KC_MPLY, KC_MPRV, KC_MNXT, CLEAR, KC_INS, \ _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_U, _______, _______, _______, _______, _______, _______, _______, _______, TOP, \ _______, KC_ACL0, KC_ACL2, KC_WH_L, KC_WH_R, _______, _______, _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_APP, KC_PGUP, BOTTOM, \ - _______, DESKTOP, DSKTP_L, KC_WH_D, DSKTP_R, _______, KC_HOME, KC_PGDN, KC_END \ + _______, DST_P_R, DST_N_A, KC_WH_D, _______, _______, KC_HOME, KC_PGDN, KC_END \ ), /* Numpad layer diff --git a/users/konstantin/konstantin.c b/users/konstantin/konstantin.c index 47596279c36..bf92a503e6e 100644 --- a/users/konstantin/konstantin.c +++ b/users/konstantin/konstantin.c @@ -28,6 +28,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; + case DST_P_R: + (record->event.pressed ? register_code16 : unregister_code16)( + (get_mods() & MOD_MASK_CTRL) ? DST_RMV : DST_PRV + ); + return false; + + case DST_N_A: + (record->event.pressed ? register_code16 : unregister_code16)( + (get_mods() & MOD_MASK_CTRL) ? DST_ADD : DST_NXT + ); + return false; + #ifdef LAYER_FN static bool fn_lock; diff --git a/users/konstantin/konstantin.h b/users/konstantin/konstantin.h index f67f9f1b7ef..3ca4f401e01 100644 --- a/users/konstantin/konstantin.h +++ b/users/konstantin/konstantin.h @@ -23,6 +23,11 @@ #define PRV_TAB LCTL(KC_PGUP) #define NXT_TAB LCTL(KC_PGDN) +#define DST_ADD LCTL(LGUI(KC_D)) +#define DST_RMV LCTL(LGUI(KC_F4)) +#define DST_PRV LCTL(LGUI(KC_LEFT)) +#define DST_NXT LCTL(LGUI(KC_RGHT)) + #define LCT_CPS LCTL_T(KC_CAPS) #ifdef SEND_STRING_CLEAN @@ -37,6 +42,8 @@ enum keycodes_user { CLEAR = SAFE_RANGE, + DST_P_R, + DST_N_A, #ifdef LAYER_NUMPAD NUMPAD, #endif diff --git a/users/konstantin/tap_dance.c b/users/konstantin/tap_dance.c index b13f33c024f..e3f1729467f 100644 --- a/users/konstantin/tap_dance.c +++ b/users/konstantin/tap_dance.c @@ -82,7 +82,7 @@ void td_lsft_fn_reset(qk_tap_dance_state_t *state, void *user_data) { } qk_tap_dance_action_t tap_dance_actions[] = { - [TD_DESKTOP] = ACTION_TAP_DANCE_DOUBLE(LCTL(LGUI(KC_D)), LCTL(LGUI(KC_F4))), // Add/close virtual desktop + [TD_DST_A_R] = ACTION_TAP_DANCE_DOUBLE(DST_ADD, DST_RMV), [TD_RAL_LAL] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_LALT), [TD_RAL_RGU] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_RGUI), diff --git a/users/konstantin/tap_dance.h b/users/konstantin/tap_dance.h index 922a6351416..1757e9b1135 100644 --- a/users/konstantin/tap_dance.h +++ b/users/konstantin/tap_dance.h @@ -2,9 +2,7 @@ #include "quantum.h" -#define DESKTOP TD(TD_DESKTOP) -#define DSKTP_L LCTL(LGUI(KC_LEFT)) -#define DSKTP_R LCTL(LGUI(KC_RGHT)) +#define DST_A_R TD(TD_DST_A_R) #define RAL_LAL TD(TD_RAL_LAL) #define RAL_RGU TD(TD_RAL_RGU) @@ -14,7 +12,7 @@ #define LSFT_FN TD(TD_LSFT_FN) enum tap_dance { - TD_DESKTOP, + TD_DST_A_R, TD_RAL_LAL, TD_RAL_RGU,