Fix shift tap-dance (can't use one-shot layer)

master
Stephen Tudor 2017-03-20 07:26:28 -04:00
parent b19e34c81e
commit 3399e39297
2 changed files with 12 additions and 34 deletions

View File

@ -8,13 +8,14 @@ EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
TAP_DANCE_ENABLE = yes # Enable tap dance
ifndef QUANTUM_DIR
include ../../../../Makefile

View File

@ -20,6 +20,10 @@ enum planck_keycodes {
DVORAK
};
enum {
TD_SHIFT_RAISE = 0
};
#define _______ KC_TRNS
#define XXXXXXX KC_NO
@ -28,7 +32,7 @@ enum planck_keycodes {
#define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl
#define HPR_TAB ALL_T(KC_TAB) // Tap for Tab, hold for Hyper (Super+Ctrl+Shift+Alt)
#define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift
#define SFT_RSE TD(KC_LSFT, OS(_RAISE)) // Double-tap for RAISE one-shot, otherwise Left Shift
#define SFT_RSE TD(TD_SHIFT_RAISE) // Double-tap for RAISE one-shot, otherwise Left Shift
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap _QWERTY: (Base Layer) Default Layer
@ -170,36 +174,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
enum function_id {
SHIFT_ESC,
// Tap Dance Definitions
qk_tap_dance_action_t tap_dance_actions[] = {
// Tap/hold once for Shift, tap twice for raise layer
[TD_SHIFT_RAISE] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, _RAISE)
// Other declarations would go here, separated by commas, if you have them
};
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_FUNCTION(SHIFT_ESC),
};
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
static uint8_t shift_esc_shift_mask;
switch (id) {
case SHIFT_ESC:
shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
if (record->event.pressed) {
if (shift_esc_shift_mask) {
add_key(KC_GRV);
send_keyboard_report();
} else {
add_key(KC_ESC);
send_keyboard_report();
}
} else {
if (shift_esc_shift_mask) {
del_key(KC_GRV);
send_keyboard_report();
} else {
del_key(KC_ESC);
send_keyboard_report();
}
}
break;
}
}