Keymap: Keymap update (#4579)

* Add YREG keycode

* Add GM layer

* Set tapping term to 105

* update tapping term
This commit is contained in:
zer09 2018-12-10 00:28:46 +08:00 committed by Drashna Jaelre
parent 11eaccdbce
commit 614b3a0f7c
4 changed files with 57 additions and 8 deletions

View File

@ -9,8 +9,15 @@ extern keymap_config_t keymap_config;
TD(DA_UPLY), MO(_VL), KC_TAB, KC_BSPACE, KC_ESC, /**/KC_INS, KC_HOME, KC_PGUP, MO(_VL), TD(DA_UPLY), \
TD(DA_DWLY), TD(DA_LCTL), KC_SPC, TD(DA_LSPR), LSFT_T(KC_CAPS),/**/SFT_T(KC_CAPS), TD(DA_RALT), KC_ENT, TD(DA_RCTL), TD(DA_DWLY))
#define _GMLayer LAYOUT( \
KC_QUOTE, KC_COMMA, KC_DOT, KC_P, KC_Y, /**/KC_F, KC_G, KC_C, KC_R, KC_L, \
KC_A, KC_O, KC_E, KC_U, KC_I, /**/KC_D, KC_H, ALT_T(KC_T), SFT_T(KC_N), CTL_T(KC_S), \
KC_SCOLON, KC_Q, KC_J, KC_K, KC_X, /**/KC_B, KC_M, KC_W, KC_V, KC_Z, \
TD(DA_UPLY), MO(_VL), KC_TAB, KC_BSPACE, KC_ESC, /**/KC_INS, KC_HOME, KC_PGUP, MO(_VL), TD(DA_UPLY), \
TD(DA_DWLY), TD(DA_LCTL), KC_SPC, TD(DA_LSPR), LSFT_T(KC_CAPS),/**/SFT_T(KC_CAPS), TD(DA_RALT), KC_ENT, TD(DA_RCTL), TD(DA_DWLY))
#define _upLayer LAYOUT( \
KC_4, KC_5, KC_6, _______, _______,/**/ _______, KC_RBRC, _______, _______, _______, \
KC_4, KC_5, KC_6, KC_YREG, _______,/**/ _______, KC_RBRC, _______, _______, _______, \
LCTL_T(KC_1), LSFT_T(KC_2), LALT_T(KC_3), _______, _______,/**/ KC_LBRC, KC_BSLS, _______, _______, _______, \
KC_7, KC_8, KC_9, KC_0, KC_GRV, /**/ KC_SLSH, _______, _______, _______, _______, \
_______, _______, _______, _______, _______,/**/ KC_DEL, KC_END, KC_PGDN, _______, _______, \
@ -35,4 +42,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_UL] = _upLayer,
[_DL] = _downLayer,
[_VL] = _upLayer,
[_AL] = _astdLayer};
[_AL] = _astdLayer,
[_GM] = _GMLayer};
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
switch (keycode) {
case YREG:
SEND_STRING("\"0p");
return false;
}
}
return true;
}

View File

@ -22,7 +22,7 @@
#ifdef TAPPING_TERM
#undef TAPPING_TERM
#endif
#define TAPPING_TERM 120
#define TAPPING_TERM 95
// Disable action_get_macro and fn_actions, since we don't use these
// and it saves on space in the firmware.

View File

@ -17,15 +17,27 @@ qk_tap_dance_action_t tap_dance_actions[] = {
};
volatile uint8_t active_layer = _BL;
volatile uint8_t gm_layer_act = false;
static tap upltap_state = {.state = 0};
static tap dwltap_state = {.state = 0};
static tap lsprtap_state = {.state = 0};
static tap ralttap_state = {.state = 0};
void layer_switcher_tap(uint8_t new_layer) {
if (gm_layer_act == true) {
layer_off(active_layer);
if (new_layer == _BL) {
layer_on(_GM);
active_layer = _GM;
} else {
layer_on(new_layer);
active_layer = new_layer;
}
} else {
layer_off(active_layer);
layer_on(new_layer);
active_layer = new_layer;
}
}
int cur_dance(qk_tap_dance_state_t *state) {
@ -162,6 +174,14 @@ void dance_dwly_finished(qk_tap_dance_state_t *state, void *user_data) {
case DOUBLE_HOLD:
layer_switcher_tap(_AL);
break;
case TRIPLE_TAP:
if (gm_layer_act == true) {
gm_layer_act = false;
layer_switcher_tap(_BL);
} else {
gm_layer_act = true;
layer_switcher_tap(_GM);
}
default:
layer_switcher_tap(_BL);
break;
@ -174,6 +194,7 @@ void dance_dwly_reset(qk_tap_dance_state_t *state, void *user_data) {
break;
case SINGLE_HOLD:
case DOUBLE_HOLD:
case TRIPLE_TAP:
default:
layer_switcher_tap(_BL);
break;

View File

@ -3,16 +3,24 @@
#include "quantum.h"
enum custom_keycodes { CK_SAFE = SAFE_RANGE, RGUP, RGDWN, NEWPLACEHOLDER };
enum custom_keycodes {
CK_SAFE = SAFE_RANGE,
RGUP,
RGDWN,
YREG,
NEW_SAFE_RANGE
};
#define _______ KC_TRNS
#define KC_RGUP RGUP
#define KC_RGDWN RGDWN
#define KC_YREG YREG
#define _BL 0 // The base layer
#define _UL 1 // The up layer
#define _DL 2 // The down layer
#define _VL 3 // The shifted up layer
#define _AL 4 // The assorted layer
#define _GM 5
#endif