* Minor Tweak * Refactor spacebar defines. * Add TMO50 layout * Rename Atreus keymap. * Refactor Atreus for readability. * Eliminate tapdance quote and tweak maltroff. * Factor out tapdance. * Add some fancy combos and keys. * Remove combos for now because they cause pain. * WIP visualizer * Alternate method for reset * WIP2 visualizer * Layer text tweak. * Add made-up layout Nortron as a combination of Norman and Maltron. * Add backspace. * Add Talljoe keymap to Prime E. * Fix double-colon so it doesn't press enter if shift is released early. * Use new make command. * Bring some modern standards into code and add licenses. * Remove QMK_KEYBOARD_CONFIG_H and fixup QMK_KEYBOARD_H. * Move from `biton32` to `get_highest_layer`. * Remove PREVENT_STUCK_MODIFIERS * Update keyboards/thevankeyboards/minivan/keymaps/talljoe-minivan/config.hpull/10874/head
@ -1,42 +0,0 @@ | |||
#ifndef CONFIG_USER_H | |||
#define CONFIG_USER_H | |||
#include QMK_KEYBOARD_CONFIG_H | |||
#define PREVENT_STUCK_MODIFIERS | |||
#define SPACE_COUNT 2 | |||
#define TEMPLATE( \ | |||
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \ | |||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ | |||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ | |||
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ | |||
K40, K41, K42, K44, K45, K46, K48, K49, K4B, K4C \ | |||
) LAYOUT( \ | |||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \ | |||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, \ | |||
K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, \ | |||
K10, K41, K42, K30, K44, K1D, K20, K45, K3C, K0D, K2B, K3D \ | |||
) | |||
#define TEMPLATE_NUM( \ | |||
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \ | |||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ | |||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ | |||
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ | |||
K40, K41, K42, K44, K45, K46, K48, K49, K4B, K4C \ | |||
) LAYOUT( \ | |||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \ | |||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, \ | |||
K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, \ | |||
K10, K41, K42, K30, K44, K1D, K20, K45, K48, K49, K2B, K3D \ | |||
) | |||
#define TEMPLATE_RESET LAYOUT( \ | |||
RESET , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ | |||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ | |||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ | |||
RESET , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX \ | |||
) | |||
#endif |
@ -0,0 +1,53 @@ | |||
/* Copyright 2020 Joseph Wasson | |||
* | |||
* 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 <http://www.gnu.org/licenses/>. | |||
*/ | |||
#pragma once | |||
#define SPACE_COUNT 3 | |||
#define TEMPLATE_TKL( \ | |||
KESC, KF01, KF02, KF03, KF04, KF05, KF06, KF07, KF08, KF09, KF10, KF11, KF12, KSCL, KPRS, KADJ, \ | |||
KGRV, K_1 , K_2 , K_3 , K_4 , K_5 , K_6 , K_7 , K_8 , K_9 , K_0 , KMIN, KEQL, KBSP, KINS, KHOM, KPUP, \ | |||
KTAB, K_Q , K_W , K_E , K_R , K_T , K_Y , K_U , K_I , K_O , K_P , KLBR, KRBR, KBLS, KDEL, KEND, LPDN, \ | |||
KCAP, K_A , K_S , K_D , K_F , K_G , K_H , K_J , K_K , K_L , KSMI, KQUO, KENT, \ | |||
KLSH, K_Z , K_X , K_C , K_V , K_B , K_N , K_M , KCMA, KDOT, KSLS, KRSH, K_UP, \ | |||
KLCT, KLOS, KLAL, KSP3, KSP2, KSP1, KRAL, KROS, KRCT, KPTT, K_LT, K_DN, K_RT \ | |||
) LAYOUT( \ | |||
K_Q , K_W , K_E , K_R , K_T , K_Y , K_U , K_I , K_O , K_P , \ | |||
K_A , K_S , K_D , K_F , K_G , K_H , K_J , K_K , K_L , KSMI, \ | |||
K_Z , K_X , K_C , K_V , K_B , K_N , K_M , KCMA, KDOT, KSLS, \ | |||
KTAB, KLOS, KLAL, KLSH, KSP3, KSP2, KCAP, KSP1, KRSH, KBLS, KQUO, KADJ \ | |||
) | |||
#define TEMPLATE_NUM( \ | |||
KGRV, K_1 , K_2 , K_3 , K_4 , K_5 , K_6 , K_7 , K_8 , K_9 , K_0 , KMIN, KEQL, KBSL, KESC, \ | |||
KTAB, K_Q , K_W , K_E , K_R , K_T , K_Y , K_U , K_I , K_O , K_P , KLBR, KRBR, KBSP, \ | |||
KCAP, K_A , K_S , K_D , K_F , K_G , K_H , K_J , K_K , K_L , KSMI, KQUO, KENT, \ | |||
KLSH, K_Z , K_X , K_C , K_V , K_B , K_N , K_M , KCMA, KDOT, KSLS, KRSH, KADJ, \ | |||
KLCT, KLOS, KLAL, KSP3, KSP2, KSP1, KRAL, KROS, KRCT, KPTT \ | |||
) LAYOUT( \ | |||
K_Q , K_W , K_E , K_R , K_T , K_Y , K_U , K_I , K_O , K_P , \ | |||
K_A , K_S , K_D , K_F , K_G , K_H , K_J , K_K , K_L , KSMI, \ | |||
K_Z , K_X , K_C , K_V , K_B , K_N , K_M , KCMA, KDOT, KSLS, \ | |||
KTAB, KLOS, KLAL, KLSH, KSP3, KSP2, KCAP, KSP1, KRAL, KROS, KQUO, KADJ \ | |||
) | |||
#define TEMPLATE_RESET LAYOUT( \ | |||
RESET , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ | |||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ | |||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ | |||
RESET , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX \ | |||
) |
@ -0,0 +1,33 @@ | |||
/* Copyright 2020 Joseph Wasson | |||
* | |||
* 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 <http://www.gnu.org/licenses/>. | |||
*/ | |||
#pragma once | |||
#define SPACE_COUNT 2 | |||
#define TEMPLATE( \ | |||
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \ | |||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ | |||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ | |||
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ | |||
K40, K41, K42, K44, K45, K46, K48, K49, K4B, K4C \ | |||
) \ | |||
LAYOUT( \ | |||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1D, K2D, \ | |||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2C, \ | |||
K30, K32, K33, K34, K35, K36, K2B, K37, K38, K39, K3A, K3B, K3C, \ | |||
K40, K41, K42, K44, K46, K48, K49, K3D \ | |||
) |
@ -0,0 +1 @@ | |||
// This space intentionally left blank |
@ -0,0 +1,33 @@ | |||
/* Copyright 2020 Joseph Wasson | |||
* | |||
* 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 <http://www.gnu.org/licenses/>. | |||
*/ | |||
#pragma once | |||
#define SPACE_COUNT 2 | |||
#define TEMPLATE_TKL(\ | |||
KESC, KF01, KF02, KF03, KF04, KF05, KF06, KF07, KF08, KF09, KF10, KF11, KF12, KSCL, KPRS, KADJ, \ | |||
KGRV, K_1 , K_2 , K_3 , K_4 , K_5 , K_6 , K_7 , K_8 , K_9 , K_0 , KMIN, KEQL, KBLS, KINS, KHOM, KPUP, \ | |||
KTAB, K_Q , K_W , K_E , K_R , K_T , K_Y , K_U , K_I , K_O , K_P , KLBR, KRBR, KBSP, KDEL, KEND, LPDN, \ | |||
KCAP, K_A , K_S , K_D , K_F , K_G , K_H , K_J , K_K , K_L , KSMI, KQUO, KENT, \ | |||
KLSH, K_Z , K_X , K_C , K_V , K_B , K_N , K_M , KCMA, KDOT, KSLS, KRSH, K_UP, \ | |||
KLCT, KLOS, KLAL, KSP2, KSP3, KSP1, KRAL, KROS, KRCT, KPTT, K_LT, K_DN, K_RT \ | |||
) LAYOUT_all( \ | |||
KF01, KTAB, K_Q , K_W , K_E , K_R , K_T , K_Y , K_U , K_I , K_O , K_P , KLBR, KRBR, KBSP, \ | |||
KF02, KCAP, K_A , K_S , K_D , K_F , K_G , K_H , K_J , K_K , K_L , KSMI, KQUO, KENT, \ | |||
KF03, KLSH, K_Z , K_X , K_C , K_V , K_B , K_N , K_M , KCMA, KDOT, KSLS, KRSH, KADJ, \ | |||
KF04, KLOS, KLAL, KSP2, KSP1, KRAL, KESC \ | |||
) |
@ -0,0 +1,44 @@ | |||
#include "quantum.h" | |||
#include "talljoe.h" | |||
bool process_indicator_led_user(uint32_t state){ | |||
return false; | |||
} | |||
#define LED_MASK (_BV(PB0) | _BV(PB1) | _BV(PB2) | _BV(PB3)) | |||
#define WHITE (_BV(PB0)) | |||
#define YELLOW (_BV(PB1)) | |||
#define MAGENTA (_BV(PB2)) | |||
#define RED (_BV(PB3)) | |||
void matrix_scan_keymap(void) { | |||
uint32_t lights = WHITE; | |||
switch(get_highest_layer(layer_state)) | |||
{ | |||
case _NAV: | |||
lights |= YELLOW; | |||
break; | |||
case _NUM: | |||
lights |= MAGENTA; | |||
break; | |||
case _ADJUST: | |||
lights |= RED; | |||
break; | |||
default: { | |||
uint8_t default_layer = get_highest_layer(default_layer_state); | |||
lights = 0; // no white LED by default. | |||
if(default_layer & 1) | |||
lights |= YELLOW; | |||
if(default_layer & 2) | |||
lights |= MAGENTA; | |||
if(default_layer & 4) | |||
lights |= RED; | |||
} | |||
} | |||
uint32_t port = PORTB; | |||
port |= LED_MASK; | |||
port &= ~lights; | |||
PORTB = port; | |||
} |
@ -0,0 +1,40 @@ | |||
/* Copyright 2020 Joseph Wasson | |||
* | |||
* 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 <http://www.gnu.org/licenses/>. | |||
*/ | |||
#include "talljoe.h" | |||
extern keymap_config_t keymap_config; | |||
ostype_t get_os() { | |||
if(keymap_config.swap_lalt_lgui) { | |||
return MACOSX; | |||
} | |||
return WINDOWS; | |||
} | |||
#define IS_OSX() (get_os() == MACOSX) | |||
#define MOD_SEND(KEY) (IS_OSX() ? SEND_STRING(SS_LCMD(KEY)) : SEND_STRING(SS_LCTRL(KEY))) | |||
void macro_copy() { MOD_SEND("c"); } | |||
void macro_paste() { MOD_SEND("v"); } | |||
void macro_lock() { | |||
if (IS_OSX()) { | |||
SEND_STRING(SS_LCTRL(SS_LCMD("q"))); | |||
} else { | |||
SEND_STRING(SS_LGUI("l")); | |||
} | |||
} |
@ -0,0 +1,27 @@ | |||
/* Copyright 2020 Joseph Wasson | |||
* | |||
* 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 <http://www.gnu.org/licenses/>. | |||
*/ | |||
typedef enum OSTYPE { | |||
WINDOWS, | |||
MACOSX, | |||
LINUX | |||
} ostype_t; | |||
ostype_t get_os(void); | |||
void macro_copy(void); | |||
void macro_paste(void); | |||
void macro_lock(void); |
@ -1,146 +0,0 @@ | |||
//Tap Dance | |||
#include "talljoe.h" | |||
enum { | |||
SINGLE_TAP = 1, | |||
SINGLE_HOLD = 2, | |||
DOUBLE_TAP = 3, | |||
DOUBLE_HOLD = 4, | |||
DOUBLE_SINGLE_TAP = 5, //send two single taps | |||
TRIPLE_TAP = 6, | |||
TRIPLE_HOLD = 7, | |||
SPECIAL = 8 | |||
}; | |||
static struct { | |||
int quote; | |||
int semicolon; | |||
} tap_state = {0}; | |||
int cur_dance (qk_tap_dance_state_t *state) { | |||
if (state->count == 1) { | |||
//If count = 1, and it has been interrupted - it doesn't matter if it is pressed or not: Send SINGLE_TAP | |||
if (state->interrupted) { | |||
// if (!state->pressed) return SINGLE_TAP; | |||
//need "permissive hold" here. | |||
// else return SINGLE_HOLD; | |||
//If the interrupting key is released before the tap-dance key, then it is a single HOLD | |||
//However, if the tap-dance key is released first, then it is a single TAP | |||
//But how to get access to the state of the interrupting key???? | |||
return SINGLE_TAP; | |||
} | |||
else { | |||
if (!state->pressed) return SINGLE_TAP; | |||
else return SINGLE_HOLD; | |||
} | |||
} | |||
//If count = 2, and it has been interrupted - assume that user is trying to type the letter associated | |||
//with single tap. | |||
else if (state->count == 2) { | |||
if (state->interrupted) return DOUBLE_SINGLE_TAP; | |||
else if (state->pressed) return DOUBLE_HOLD; | |||
else return DOUBLE_TAP; | |||
} | |||
else if ((state->count == 3) && ((state->interrupted) || (!state->pressed))) return TRIPLE_TAP; | |||
else if (state->count == 3) return TRIPLE_HOLD; | |||
else return SPECIAL; | |||
} | |||
int hold_cur_dance (qk_tap_dance_state_t *state) { | |||
if (state->count == 1) { | |||
if (state->interrupted) { | |||
if (!state->pressed) return SINGLE_TAP; | |||
else return SINGLE_HOLD; | |||
} | |||
else { | |||
if (!state->pressed) return SINGLE_TAP; | |||
else return SINGLE_HOLD; | |||
} | |||
} | |||
//If count = 2, and it has been interrupted - assume that user is trying to type the letter associated | |||
//with single tap. | |||
else if (state->count == 2) { | |||
if (state->pressed) return DOUBLE_HOLD; | |||
else return DOUBLE_TAP; | |||
} | |||
else if (state->count == 3) { | |||
if (!state->pressed) return TRIPLE_TAP; | |||
else return TRIPLE_HOLD; | |||
} | |||
else return SPECIAL; | |||
} | |||
// Send semi-colon + enter on two taps | |||
void tap_dance_semicolon_finished(qk_tap_dance_state_t *state, void *user_data) { | |||
tap_state.semicolon = hold_cur_dance(state); | |||
switch (tap_state.semicolon) { | |||
case SINGLE_TAP: case DOUBLE_HOLD: register_code(KC_SCLN); break; | |||
case SINGLE_HOLD: layer_on(_NUM); break; | |||
} | |||
} | |||
void tap_dance_semicolon_reset(qk_tap_dance_state_t *state, void *user_data) { | |||
switch (tap_state.semicolon) { | |||
case SINGLE_TAP: case DOUBLE_HOLD: unregister_code(KC_SCLN); break; | |||
case DOUBLE_TAP: { | |||
if (get_mods()) { | |||
SEND_STRING(";;"); // send normal when mods are pressed | |||
} | |||
else { | |||
SEND_STRING(";\n"); | |||
} | |||
break; | |||
} | |||
case TRIPLE_TAP: { | |||
SEND_STRING(";\n\n"); | |||
} | |||
case SPECIAL: layer_invert(_NUM); break; | |||
case SINGLE_HOLD: layer_off(_NUM); break; | |||
} | |||
tap_state.semicolon = 0; | |||
} | |||
// Send `. ~. ``` | |||
void tap_dance_grave_finished(qk_tap_dance_state_t *state, void *user_data) { | |||
switch(state->count) { | |||
case 1: | |||
SEND_STRING("`"); | |||
break; | |||
case 2: | |||
SEND_STRING("~"); | |||
break; | |||
} | |||
} | |||
void tap_dance_grave_each(qk_tap_dance_state_t *state, void *user_data) { | |||
if(state->count == 3) { | |||
SEND_STRING("```"); | |||
} else if (state->count > 3) { | |||
SEND_STRING("`"); | |||
} | |||
} | |||
void tap_dance_quote_finished(qk_tap_dance_state_t *state, void *user_data) { | |||
tap_state.quote = hold_cur_dance(state); | |||
switch (tap_state.quote) { | |||
case SINGLE_TAP: case DOUBLE_HOLD: register_code(KC_QUOT); break; | |||
case SINGLE_HOLD: layer_on(_NAV); break; | |||
} | |||
} | |||
void tap_dance_quote_reset(qk_tap_dance_state_t *state, void *user_data) { | |||
switch (tap_state.quote) { | |||
case SINGLE_TAP: case DOUBLE_HOLD: unregister_code(KC_QUOTE); break; | |||
case DOUBLE_TAP: SEND_STRING("\""); break; | |||
case TRIPLE_TAP: layer_invert(_NAV); break; | |||
case SINGLE_HOLD: layer_off(_NAV); break; | |||
} | |||
tap_state.quote = 0; | |||
} | |||
qk_tap_dance_action_t tap_dance_actions[] = { | |||
[TD_SEMICOLON] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tap_dance_semicolon_finished, tap_dance_semicolon_reset), | |||
[TD_GRAVE] = ACTION_TAP_DANCE_FN_ADVANCED(tap_dance_grave_each, tap_dance_grave_finished, NULL), | |||
[TD_QUOTE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tap_dance_quote_finished, tap_dance_quote_reset), | |||
}; |
@ -0,0 +1,35 @@ | |||
/* Copyright 2020 Joseph Wasson | |||
* | |||
* 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 <http://www.gnu.org/licenses/>. | |||
*/ | |||
static struct { | |||
int state; | |||
} function_state = {0}; | |||
// Send semi-colon + enter on two taps | |||
void tap_dance_function_finished(qk_tap_dance_state_t *state, void *user_data) { | |||
function_state.state = hold_cur_dance(state); | |||
switch (function_state.state) { | |||
case SINGLE_HOLD: layer_on(_ADJUST); break; | |||
} | |||
} | |||
void tap_dance_function_reset(qk_tap_dance_state_t *state, void *user_data) { | |||
switch (function_state.state) { | |||
case SPECIAL: reset_keyboard(); break; | |||
case SINGLE_HOLD: layer_off(_ADJUST); break; | |||
} | |||
function_state.state = 0; | |||
} |
@ -0,0 +1,36 @@ | |||
/* Copyright 2020 Joseph Wasson | |||
* | |||
* 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 <http://www.gnu.org/licenses/>. | |||
*/ | |||
// Send `. ~. ``` | |||
void tap_dance_grave_finished(qk_tap_dance_state_t *state, void *user_data) { | |||
switch(state->count) { | |||
case 1: | |||
SEND_STRING("`"); | |||
break; | |||
case 2: | |||
SEND_STRING("~"); | |||
break; | |||
} | |||
} | |||
void tap_dance_grave_each(qk_tap_dance_state_t *state, void *user_data) { | |||
if(state->count == 3) { | |||
SEND_STRING("```"); | |||
} else if (state->count > 3) { | |||
SEND_STRING("`"); | |||
} | |||
} | |||
@ -0,0 +1,35 @@ | |||
/* Copyright 2020 Joseph Wasson | |||
* | |||
* 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 <http://www.gnu.org/licenses/>. | |||
*/ | |||
static struct { | |||
int state; | |||
} lock_state = {0}; | |||
// Send semi-colon + enter on two taps | |||
void tap_dance_lock_finished(qk_tap_dance_state_t *state, void *user_data) { | |||
lock_state.state = cur_dance(state); | |||
switch (lock_state.state) { | |||
case SINGLE_TAP: register_code(KC_ESC); break; | |||
case SINGLE_HOLD: macro_lock(); break; | |||
} | |||
} | |||
void tap_dance_lock_reset(qk_tap_dance_state_t *state, void *user_data) { | |||
switch (lock_state.state) { | |||
case SINGLE_TAP: unregister_code(KC_ESC); break; | |||
} | |||
lock_state.state = 0; | |||
} |
@ -0,0 +1,54 @@ | |||
/* Copyright 2020 Joseph Wasson | |||
* | |||
* 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 <http://www.gnu.org/licenses/>. | |||
*/ | |||
static struct { | |||
int semicolon; | |||
bool mods; | |||
} tap_state = {0}; | |||
void tap_dance_semicolon_each(qk_tap_dance_state_t *state, void *user_data) { | |||
tap_state.mods |= get_mods(); | |||
} | |||
// Send semi-colon + enter on two taps | |||
void tap_dance_semicolon_finished(qk_tap_dance_state_t *state, void *user_data) { | |||
tap_state.semicolon = hold_cur_dance(state); | |||
switch (tap_state.semicolon) { | |||
case SINGLE_TAP: case DOUBLE_HOLD: register_code(KC_SCLN); break; | |||
case SINGLE_HOLD: layer_on(_NUM); break; | |||
} | |||
} | |||
void tap_dance_semicolon_reset(qk_tap_dance_state_t *state, void *user_data) { | |||
switch (tap_state.semicolon) { | |||
case SINGLE_TAP: case DOUBLE_HOLD: unregister_code(KC_SCLN); break; | |||
case DOUBLE_TAP: { | |||
if (tap_state.mods) { | |||
SEND_STRING(";;"); // send normal when mods are pressed | |||
} | |||
else { | |||
SEND_STRING(";\n"); | |||
} | |||
break; | |||
} | |||
case TRIPLE_TAP: { | |||
SEND_STRING(";\n\n"); | |||
} | |||
case SPECIAL: layer_invert(_NUM); break; | |||
case SINGLE_HOLD: layer_off(_NUM); break; | |||
} | |||
tap_state.semicolon = 0; | |||
} |
@ -0,0 +1,26 @@ | |||
/* Copyright 2020 Joseph Wasson | |||
* | |||
* 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 <http://www.gnu.org/licenses/>. | |||
*/ | |||
#include "quantum.h" | |||
#include "td_setup.h" | |||
enum tap_dancers { | |||
TD_SEMICOLON, | |||
TD_GRAVE, | |||
TD_LOCK, | |||
TD_FUNCTION, | |||
}; | |||
@ -0,0 +1,28 @@ | |||
/* Copyright 2020 Joseph Wasson | |||
* | |||
* 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 <http://www.gnu.org/licenses/>. | |||
*/ | |||
#include "../talljoe.h" | |||
#include "actions/td.grave.c" | |||
#include "actions/td.lock.c" | |||
#include "actions/td.semicolon.c" | |||
#include "actions/td.function.c" | |||
qk_tap_dance_action_t tap_dance_actions[] = { | |||
[TD_SEMICOLON] = ACTION_TAP_DANCE_FN_ADVANCED(tap_dance_semicolon_each, tap_dance_semicolon_finished, tap_dance_semicolon_reset), | |||
[TD_LOCK] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tap_dance_lock_finished, tap_dance_lock_reset), | |||
[TD_GRAVE] = ACTION_TAP_DANCE_FN_ADVANCED(tap_dance_grave_each, tap_dance_grave_finished, NULL), | |||
[TD_FUNCTION] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tap_dance_function_finished, tap_dance_function_reset), | |||
}; |
@ -0,0 +1,70 @@ | |||
/* Copyright 2020 Joseph Wasson | |||
* | |||
* 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 <http://www.gnu.org/licenses/>. | |||
*/ | |||
#include "tapdance.h" | |||
int cur_dance (qk_tap_dance_state_t *state) { | |||
if (state->count == 1) { | |||
//If count = 1, and it has been interrupted - it doesn't matter if it is pressed or not: Send SINGLE_TAP | |||
if (state->interrupted) { | |||
// if (!state->pressed) return SINGLE_TAP; | |||
//need "permissive hold" here. | |||
// else return SINGLE_HOLD; | |||
//If the interrupting key is released before the tap-dance key, then it is a single HOLD | |||
//However, if the tap-dance key is released first, then it is a single TAP | |||
//But how to get access to the state of the interrupting key???? | |||
return SINGLE_TAP; | |||
} | |||
else { | |||
if (!state->pressed) return SINGLE_TAP; | |||
else return SINGLE_HOLD; | |||
} | |||
} | |||
//If count = 2, and it has been interrupted - assume that user is trying to type the letter associated | |||
//with single tap. | |||
else if (state->count == 2) { | |||
if (state->interrupted) return DOUBLE_SINGLE_TAP; | |||
else if (state->pressed) return DOUBLE_HOLD; | |||
else return DOUBLE_TAP; | |||
} | |||
else if ((state->count == 3) && ((state->interrupted) || (!state->pressed))) return TRIPLE_TAP; | |||
else if (state->count == 3) return TRIPLE_HOLD; | |||
else return SPECIAL; | |||
} | |||
int hold_cur_dance (qk_tap_dance_state_t *state) { | |||
if (state->count == 1) { | |||
if (state->interrupted) { | |||
if (!state->pressed) return SINGLE_TAP; | |||
else return SINGLE_HOLD; | |||
} | |||
else { | |||
if (!state->pressed) return SINGLE_TAP; | |||
else return SINGLE_HOLD; | |||
} | |||
} | |||
//If count = 2, and it has been interrupted - assume that user is trying to type the letter associated | |||
//with single tap. | |||
else if (state->count == 2) { | |||
if (state->pressed) return DOUBLE_HOLD; | |||
else return DOUBLE_TAP; | |||
} | |||
else if (state->count == 3) { | |||
if (!state->pressed) return TRIPLE_TAP; | |||
else return TRIPLE_HOLD; | |||
} | |||
else return SPECIAL; | |||
} |
@ -0,0 +1,29 @@ | |||
/* Copyright 2020 Joseph Wasson | |||
* | |||
* 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 <http://www.gnu.org/licenses/>. | |||
*/ | |||
enum { | |||
SINGLE_TAP = 1, | |||
SINGLE_HOLD = 2, | |||
DOUBLE_TAP = 3, | |||
DOUBLE_HOLD = 4, | |||
DOUBLE_SINGLE_TAP = 5, //send two single taps | |||
TRIPLE_TAP = 6, | |||
TRIPLE_HOLD = 7, | |||
SPECIAL = 8 | |||
}; | |||
int cur_dance (qk_tap_dance_state_t *state); | |||
int hold_cur_dance (qk_tap_dance_state_t *state); |
@ -0,0 +1,21 @@ | |||
/* Copyright 2020 Joseph Wasson | |||
* | |||
* 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 <http://www.gnu.org/licenses/>. | |||
*/ | |||
#include "talljoe.h" | |||
static void get_visualizer_layer_and_color(visualizer_state_t* state) { | |||
state->status_text = layer_names[biton32(state->status.layer)]; | |||
} |