Change how desktop commands work

This commit is contained in:
Konstantin Đorđević 2019-01-28 09:04:47 +01:00
parent 6e48ea082d
commit 6f386ca6ae
6 changed files with 28 additions and 11 deletions

View File

@ -58,7 +58,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* *
* MutVoDVoUPlyPrvNxtMWMWM4 M5 * MutVoDVoUPlyPrvNxtMWMWM4 M5
* *
* MW MAcl2 * DPRDstNA MW MAcl2
* *
*/ */
[L_FN] = LAYOUT( [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_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_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, _______, _______, _______, 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 /* RCtrl layer
@ -79,7 +79,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* *
* *
* *
* DstDstp Dstp * DtRDstA
* *
*/ */
[L_RCTRL] = LAYOUT( [L_RCTRL] = LAYOUT(
@ -87,6 +87,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, TOP, MV_UP, BOTTOM, PRV_TAB, _______, _______, _______, _______, _______, _______, _______, _______, CLEAR, _______, TOP, MV_UP, BOTTOM, PRV_TAB, _______, _______, _______, _______, _______, _______, _______, _______, CLEAR,
_______, MV_LEFT, MV_DOWN, MV_RGHT, NXT_TAB, _______, _______, _______, _______, _______, _______, _______, _______, _______, MV_LEFT, MV_DOWN, MV_RGHT, NXT_TAB, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
XXXXXXX, DESKTOP, DSKTP_L, _______, DSKTP_R, _______, XXXXXXX XXXXXXX, DST_RMV, DST_ADD, _______, _______, _______, XXXXXXX
), ),
}; };

View File

@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* *
* MA0MA2MWMW VoDVoUMut App PgUBtm * MA0MA2MWMW VoDVoUMut App PgUBtm
* *
* DstpDst MW Dst HomPgDEnd * DtPRDtNA MW HomPgDEnd
* *
*/ */
[L_FN] = LAYOUT_truefox( \ [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_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_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, \ _______, 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 /* Numpad layer

View File

@ -28,6 +28,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} }
return false; 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 #ifdef LAYER_FN
static bool fn_lock; static bool fn_lock;

View File

@ -23,6 +23,11 @@
#define PRV_TAB LCTL(KC_PGUP) #define PRV_TAB LCTL(KC_PGUP)
#define NXT_TAB LCTL(KC_PGDN) #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) #define LCT_CPS LCTL_T(KC_CAPS)
#ifdef SEND_STRING_CLEAN #ifdef SEND_STRING_CLEAN
@ -37,6 +42,8 @@
enum keycodes_user { enum keycodes_user {
CLEAR = SAFE_RANGE, CLEAR = SAFE_RANGE,
DST_P_R,
DST_N_A,
#ifdef LAYER_NUMPAD #ifdef LAYER_NUMPAD
NUMPAD, NUMPAD,
#endif #endif

View File

@ -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[] = { 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_LAL] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_LALT),
[TD_RAL_RGU] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_RGUI), [TD_RAL_RGU] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_RGUI),

View File

@ -2,9 +2,7 @@
#include "quantum.h" #include "quantum.h"
#define DESKTOP TD(TD_DESKTOP) #define DST_A_R TD(TD_DST_A_R)
#define DSKTP_L LCTL(LGUI(KC_LEFT))
#define DSKTP_R LCTL(LGUI(KC_RGHT))
#define RAL_LAL TD(TD_RAL_LAL) #define RAL_LAL TD(TD_RAL_LAL)
#define RAL_RGU TD(TD_RAL_RGU) #define RAL_RGU TD(TD_RAL_RGU)
@ -14,7 +12,7 @@
#define LSFT_FN TD(TD_LSFT_FN) #define LSFT_FN TD(TD_LSFT_FN)
enum tap_dance { enum tap_dance {
TD_DESKTOP, TD_DST_A_R,
TD_RAL_LAL, TD_RAL_LAL,
TD_RAL_RGU, TD_RAL_RGU,