summaryrefslogtreecommitdiff
path: root/users
diff options
context:
space:
mode:
authorDaniel Rodríguez Rivero <rdanielo@gmail.com>2020-01-27 23:42:38 +0100
committerDrashna Jaelre <drashna@live.com>2020-01-27 14:42:38 -0800
commit1b7a003d842c76cd141af726c13e2af1a4458bac (patch)
tree678d8482537b4b444810fa0d520dbff9eb0c4ff4 /users
parent0804f0a5dd08ed0807a67793ef329fa49ed5b16f (diff)
[Keymap] update to Danielo515 keymaps (#8004)
* feat(build): added script for compiling with docker easily * chore: bring my own build with docker to master * feat: merge ergodox ez into latest maste * chore: remove my build with docker file * chore: remove my changes to process_leader * feat: more modular user danielo515 * Apply suggestions from @ridingqwerty Co-Authored-By: ridingqwerty <george.g.koenig@gmail.com> * chore: more suggestions implemented * chore: add my basic details * Apply suggestions from @drashna Co-Authored-By: Drashna Jaelre <drashna@live.com> * fix: more @drashna fixes * feat: @fauxpark optimization * fix: some more @drashna improvements Co-Authored-By: Drashna Jaelre <drashna@live.com> * chore: small improvement on layout * fix: some more @drashna improvements * chore: remove some F dance Co-authored-by: ridingqwerty <george.g.koenig@gmail.com> Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'users')
-rw-r--r--users/danielo515/combo.c21
-rw-r--r--users/danielo515/combo.h2
-rw-r--r--users/danielo515/config.h6
-rw-r--r--users/danielo515/danielo515.c373
-rw-r--r--users/danielo515/danielo515.h105
-rw-r--r--users/danielo515/readme.md14
-rw-r--r--users/danielo515/rules.mk9
-rw-r--r--users/danielo515/tap_dance.c139
-rw-r--r--users/danielo515/tap_dance.h80
9 files changed, 749 insertions, 0 deletions
diff --git a/users/danielo515/combo.c b/users/danielo515/combo.c
new file mode 100644
index 0000000000..bf7d5f9a8a
--- /dev/null
+++ b/users/danielo515/combo.c
@@ -0,0 +1,21 @@
+#include "combo.h"
+enum combos {
+ JK_ESC,
+ YU_COM,
+ UI_COM,
+ IO_COM,
+ OP_COM,
+ QW_COM
+};
+
+const uint16_t PROGMEM ui_combo[] = {KC_U, KC_I, COMBO_END};
+const uint16_t PROGMEM jk_combo[] = {KC_J, KC_K, COMBO_END};
+const uint16_t PROGMEM yu_combo[] = {KC_Y, KC_U, COMBO_END};
+const uint16_t PROGMEM io_combo[] = {KC_I, KC_O, COMBO_END};
+
+combo_t key_combos[COMBO_COUNT] = {
+ [JK_ESC] = COMBO(jk_combo, KC_ESC),
+ [YU_COM] = COMBO(yu_combo, KC_CIRC),
+ [UI_COM] = COMBO(ui_combo, KC_ESC),
+ [IO_COM] = COMBO(io_combo, KC_TILD)
+};
diff --git a/users/danielo515/combo.h b/users/danielo515/combo.h
new file mode 100644
index 0000000000..010d4b1383
--- /dev/null
+++ b/users/danielo515/combo.h
@@ -0,0 +1,2 @@
+#pragma once
+#include "quantum.h"
diff --git a/users/danielo515/config.h b/users/danielo515/config.h
new file mode 100644
index 0000000000..65654388d2
--- /dev/null
+++ b/users/danielo515/config.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#if defined(COMBO_ENABLE)
+ #define COMBO_COUNT 4
+ #define COMBO_TERM 50
+#endif // !COMBO_ENABLE
diff --git a/users/danielo515/danielo515.c b/users/danielo515/danielo515.c
new file mode 100644
index 0000000000..f37eebb375
--- /dev/null
+++ b/users/danielo515/danielo515.c
@@ -0,0 +1,373 @@
+#include "danielo515.h"
+
+bool onMac = true;
+// Send control or GUI depending if we are on windows or mac
+bool CMD(uint16_t kc) {
+ if(onMac){ tap_code16(LGUI(kc)); } else { tap_code16(LCTL(kc)); }
+ return false;
+}
+
+//**************** Handle keys function *********************//
+bool altPressed = false;
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record)
+{
+ bool pressed = record->event.pressed;
+ if(pressed){
+ refresh_incremental_macros(keycode);
+ if(process_incremental_macro(keycode)){
+ return false;
+ }
+ if(is_macro(keycode)){
+ return handle_macro(keycode);
+ }
+ switch (keycode) {
+ case MAC_TGL:
+ onMac = !onMac;
+ onMac ? SEND_STRING("On mac") : SEND_STRING("Not on MAC");
+ return false;
+ }
+ }
+
+ switch (keycode)
+ {
+ case QWERTY:
+ if (record->event.pressed) {
+ #ifdef AUDIO_ENABLE
+ PLAY_SONG(tone_qwerty);
+ #endif
+ layer_on(_QWERTY);
+ }
+ return false;
+ case LOWER:
+ if (record->event.pressed) {
+ layer_on(_LOWER);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ } else {
+ layer_off(_LOWER);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ }
+ return false;
+ case RAISE:
+ if (record->event.pressed) {
+ layer_on(_RAISE);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ } else {
+ layer_off(_RAISE);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ }
+ return false;
+ case ADJUST:
+ if (record->event.pressed) {
+ layer_on(_ADJUST);
+ } else {
+ layer_off(_ADJUST);
+ }
+ return false;
+ // == Macros START ===
+ case ARROW:
+ if (record->event.pressed) SEND_STRING("->");
+ return false;
+ case F_ARROW:
+ if (record->event.pressed) SEND_STRING("=>");
+ return false;
+ case GREP:
+ if (record->event.pressed) SEND_STRING(" | grep "); return false;
+ // == Macros END ===
+ // == Multi Os START ===
+ case KC_HOME:// make the home behave the same on OSX
+ if (record->event.pressed && onMac) {
+ SEND_STRING(SS_LCTRL("a"));
+ return false;
+ }
+ case KC_END:// make the end behave the same on OSX
+ if (record->event.pressed && onMac) {
+ tap_code16(C(KC_E));
+ return false;
+ }
+ case AC_A:// Accent á
+ if (record->event.pressed) SEND_STRING(SS_LALT("e") "a"); return false;
+ case AC_E:// Accent é
+ if (record->event.pressed) SEND_STRING(SS_LALT("e") "e"); return false;
+ case AC_I:// Accent í
+ if (record->event.pressed) SEND_STRING(SS_LALT("e") "i"); return false;
+ case AC_O:// Accent ó
+ if (record->event.pressed) SEND_STRING(SS_LALT("e") "o"); return false;
+ case CUT: if (record->event.pressed) return CMD(KC_X);
+ case COPY:
+ if (record->event.pressed) {
+ onMac ? SEND_STRING(SS_LGUI("c")) : SEND_STRING(SS_LCTRL("c"));
+ }
+ return false;
+ case PASTE:
+ if (record->event.pressed) {
+ onMac ? SEND_STRING(SS_LGUI("v")) : SEND_STRING(SS_LCTRL("v"));
+ }
+ return false;
+ case SAVE:
+ if (record->event.pressed) {
+ onMac ? SEND_STRING(SS_LGUI("s")) : SEND_STRING(SS_LCTRL("s"));
+ }
+ return false;
+ case UNDO:
+ if (record->event.pressed) {
+ onMac ? SEND_STRING(SS_LGUI("z")) : SEND_STRING(SS_LCTRL("z"));
+ }
+ return false;
+ case FIND:
+ if (record->event.pressed) {
+ onMac ? SEND_STRING(SS_LGUI("f")) : SEND_STRING(SS_LCTRL("f"));
+ }
+ return false;
+ case CHG_LAYOUT:
+ if (record->event.pressed) {
+ onMac ? SEND_STRING(SS_LCTRL(" ")) : SEND_STRING(SS_LCTRL("f"));
+ }
+ return false;
+ // == Multi Os END ===
+#ifdef RGBLIGHT_ENABLE
+ case RGB_SLD:
+ if (record->event.pressed) { rgblight_mode(1); }
+ return false;
+ break;
+ //First time alt + tab, and alt stays sticky. Next press we just send tab. Any other key releases the alt
+#endif
+ case ALT_TAB:
+ if (record->event.pressed)
+ {
+ if (altPressed)
+ {
+ tap_code(KC_TAB);
+ }
+ else
+ {
+ altPressed = true;
+ layer_on(7); // go to movement layer
+ onMac ? register_code(KC_LGUI) : register_code(KC_LALT);
+ tap_code(KC_TAB);
+ }
+ }
+ return false;
+ // avoid alt releasing if the key is of movement
+ case KC_RIGHT ... KC_UP:
+ if (altPressed)
+ {
+ return true; // yes QMK, do your stuff
+ }
+ }
+ // Reset sticky alt tab
+ if (altPressed)
+ {
+ onMac ? unregister_code(KC_LGUI) : unregister_code(KC_LALT);
+ altPressed = false;
+ layer_off(7);
+ return false;
+ }
+ return true;
+};
+
+//**************** LEADER *********************//
+#ifdef LEADER_ENABLE
+LEADER_EXTERNS();
+#ifdef RGBLIGHT_ENABLE
+
+void leader_start() {
+ rgblight_setrgb_range(5, 100, 199, 10,15);
+};
+
+void leader_end(){
+ rgblight_setrgb_range(200, 200, 255, 10,15);
+};
+#endif
+
+void matrix_scan_user(void)
+{
+ if (leading && leader_sequence_size > 0 && timer_elapsed(leader_time) > LEADER_TIMEOUT)
+ {
+ leading = false;
+ SEQ_ONE_KEY(KC_T) {
+ SEND_STRING("``" SS_TAP(X_LEFT));
+ }
+ // Triple ticks
+ SEQ_TWO_KEYS(KC_T, KC_T) {
+ SEND_STRING("```" SS_TAP(X_ENTER) SS_TAP(X_ENTER) "```" SS_TAP(X_UP));
+ }
+ // ==== International spanish accent vowels ====
+ SEQ_ONE_KEY(KC_A) {
+ SEND_STRING(SS_LALT("e") "a");
+ }
+ SEQ_ONE_KEY(KC_E) {
+ SEND_STRING(SS_LALT("e") "e");
+ }
+ SEQ_ONE_KEY(KC_I) {
+ SEND_STRING(SS_LALT("e") "i");
+ }
+ SEQ_ONE_KEY(KC_O) {
+ SEND_STRING(SS_LALT("e") "o");
+ }
+ SEQ_ONE_KEY(KC_U) {
+ SEND_STRING(SS_LALT("e") "u");
+ }
+ SEQ_ONE_KEY(KC_N) { // ñ
+ SEND_STRING(SS_LALT("n") "n");
+ }
+ // ==== MACROS ===
+ SEQ_ONE_KEY(KC_G) { // grep
+ SEND_STRING(" | grep ");
+ }
+ SEQ_ONE_KEY(KC_K) {
+ onMac ? SEND_STRING(SS_LCTRL(" ")) : SEND_STRING(SS_LCTRL("f"));
+ }
+ SEQ_TWO_KEYS(KC_D, KC_G) { // vim delete all
+ if(onMac){
+ SEND_STRING(SS_LGUI("a") SS_TAP(X_D));
+ } else {
+ SEND_STRING(SS_LCTRL("a") SS_TAP(X_D));
+ }
+ }
+ SEQ_ONE_KEY(KC_BSPACE) { // tripe delete!
+ SEND_STRING(SS_TAP(X_BSPACE) SS_TAP(X_BSPACE) SS_TAP(X_BSPACE));
+ }
+ SEQ_TWO_KEYS(KC_P, KC_G) {
+ SEND_STRING("ps -ef | grep ");
+ }
+ SEQ_TWO_KEYS(KC_J, KC_A) {
+ SEND_STRING("() => {}"SS_TAP(X_LEFT) SS_TAP(X_LEFT)SS_TAP(X_LEFT) SS_TAP(X_LEFT)SS_TAP(X_LEFT) SS_TAP(X_LEFT)SS_TAP(X_LEFT));
+ }
+ SEQ_TWO_KEYS(KC_S, KC_S) {
+ SEND_STRING("~/.ssh/ "); // this is a pain to type
+ }
+ SEQ_TWO_KEYS(KC_F, KC_T) {
+ SEND_STRING("feat():" SS_TAP(X_LEFT) SS_TAP(X_LEFT));
+ }
+ // ### LAYER CHANGE
+ SEQ_ONE_KEY(KC_1) {
+ layer_on(1);
+ }
+ SEQ_ONE_KEY(KC_H) { // control enter, because yes
+ SEND_STRING(SS_DOWN(X_LCTRL) SS_TAP(X_ENTER) SS_UP(X_LCTRL));
+ }
+ // paste all
+ SEQ_ONE_KEY(KC_P) {
+ if(onMac){
+ SEND_STRING(SS_LGUI("a") SS_LGUI("v"));
+ } else {
+ SEND_STRING(SS_LCTRL("a") SS_LCTRL("v"));
+ }
+ }
+ SEQ_THREE_KEYS(KC_M, KC_A, KC_C) {
+ onMac = true;
+ #ifdef RGBLIGHT_ENABLE
+ rgblight_setrgb(255, 255, 255);
+ #endif
+ }
+ SEQ_THREE_KEYS(KC_W, KC_I, KC_N) {
+ onMac = false;
+ #ifdef RGBLIGHT_ENABLE
+ rgblight_setrgb(255, 255, 0);
+ #endif
+ }
+ /* Copy all */
+ SEQ_ONE_KEY(KC_Y) {
+ if(onMac){
+ SEND_STRING(SS_LGUI("a") SS_LGUI("c"));
+ } else {
+ SEND_STRING(SS_LCTRL("a") SS_LCTRL("c"));
+ }
+ }
+ //emoji bar
+ SEQ_TWO_KEYS(KC_E, KC_E) {
+ SEND_STRING(SS_DOWN(X_LGUI) SS_LCTRL(" ") SS_UP(X_LGUI));
+ }
+
+ SEQ_TWO_KEYS(KC_F, KC_F) {
+ SEND_STRING("ps -ef | grep ");
+ }
+ SEQ_TWO_KEYS(KC_H, KC_T) {
+ SEND_STRING("https://");
+ }
+
+ leader_end();
+ }
+}
+#endif // LEADER
+
+// ======== INCREMENTAL MACROS STUFF =============
+
+#define MAX_INCREMENTAL_MACRO 20
+#define TAP_ROTATION_TIMEOUT 400
+
+uint16_t latest_kc = 0;
+uint16_t latest_rotation = 0;
+int key_count = 0;
+
+const char incremental_macros[][MAX_INCREMENTAL_MACRO] = { "String1"SS_TAP(X_HOME)"X-", "String2"SS_TAP(X_HOME) };
+
+bool process_incremental_macro (uint16_t kc) {
+
+ if( kc < INC_MACROS_START || kc > INC_MACROS_END ){
+ return false;
+ }
+ int macro_idx = (int) (kc - INC_MACROS_START) - 1;
+ char tempstring[3] = {0};
+ tempstring[0] = incremental_macros[macro_idx][key_count];
+ // Special cases of SS_TAP SS_UP and SS_DOWN, they require two characters so get both once and skip on next iteration
+ if( tempstring[0] == '\1' || tempstring[0] == '\2' || tempstring[0] == '\3'){
+ tempstring[1] = incremental_macros[macro_idx][++key_count];
+ }
+ if( tempstring[0] == '\0'){
+ key_count = 0;
+ }
+ send_string(tempstring);
+
+ return true;
+};
+
+void refresh_incremental_macros (uint16_t kc) {
+ if (kc == latest_kc)
+ {
+ if ( (timer_elapsed(latest_rotation) > TAP_ROTATION_TIMEOUT) || (key_count >= MAX_INCREMENTAL_MACRO) ) key_count = 0;
+ else key_count++;
+ } else {
+ key_count = 0;
+ latest_kc = kc;
+ }
+
+ latest_rotation = timer_read();
+}
+
+
+// ======== VISUAL STUDIO CODE SHORTCUTS STUFF
+
+bool is_macro (uint16_t kc){
+ return kc > MACRO_START && kc < MACRO_END;
+};
+
+bool command_shift_p (bool isMac) {
+ isMac
+ ? SEND_STRING(SS_DOWN(X_LSHIFT)SS_LGUI("p")SS_UP(X_LSHIFT))
+ : SEND_STRING(SS_DOWN(X_LSHIFT)SS_LCTRL("p")SS_UP(X_LSHIFT));
+ return false;
+};
+
+bool VSCommand(bool isMac, char *cmd)
+{
+ command_shift_p (isMac);
+ send_string(cmd);
+ SEND_STRING(SS_TAP(X_ENTER));
+ return false;
+};
+
+bool handle_macro(uint16_t kc)
+{
+ switch (kc)
+ {
+ case T_TERM: return VSCommand(onMac, "toit");
+ case FIX_ALL: return VSCommand(onMac, "faap");
+ case BLK_CMNT: return VSCommand(onMac, "tbc");
+ case LN_CMNT: return VSCommand(onMac, "tlic");
+ case CMD_S_P: return command_shift_p(onMac);
+ case TRI_TICKS: SEND_STRING("[[[ "); break;
+ }
+ return false;
+};
diff --git a/users/danielo515/danielo515.h b/users/danielo515/danielo515.h
new file mode 100644
index 0000000000..95c01b6e8a
--- /dev/null
+++ b/users/danielo515/danielo515.h
@@ -0,0 +1,105 @@
+#pragma once
+
+#include "quantum.h"
+
+
+bool handle_macro(uint16_t kc);
+bool is_macro (uint16_t kc);
+bool process_incremental_macro (uint16_t);
+void refresh_incremental_macros (uint16_t);
+//**************** KEYCODES *********************//
+
+enum custom_keycodes
+{
+ PLACEHOLDER = SAFE_RANGE, // can always be here
+ EPRM,
+ RGB_SLD,
+ ALT_TAB,
+ // Macros
+ ARROW,
+ F_ARROW,
+ QWERTY,
+ GREP,
+ // Accented characters
+ AC_A,
+ AC_E,
+ AC_I,
+ AC_O,
+ // Custom multi-os key-codes
+ CUT,
+ COPY,
+ PASTE,
+ SAVE,
+ UNDO,
+ CHG_LAYOUT,
+ FIND,
+ // OTHER OLD STUFF
+ LOWER,
+ RAISE,
+ ADJUST,
+ MAC_TGL,
+ MACRO_START, // START OF VSC DECLARATIONS
+ T_TERM,
+ FIX_ALL,
+ BLK_CMNT,
+ LN_CMNT,
+ CMD_S_P,
+ TRI_TICKS,
+ MACRO_END, // END OF VSC DECLARATIONS
+ INC_MACROS_START,
+ INC_MACROS_END,
+};
+
+
+enum layers {
+ _QWERTY,
+ _LOWER,
+ _RAISE,
+ _F,
+ _D,
+ _A,
+ _S,
+ _J,
+ _K,
+ _MACROS,
+ _ADJUST,
+ _SAFE_LAYER
+};
+
+// Function letters
+#define FN_F LT(_F,KC_F)
+#define FN_D LT(_D,KC_D)
+#define FN_S LT(_S,KC_S)
+#define FN_A LT(_A,KC_A)
+#define FN_K LT(_K,KC_K)
+#define FN_J LT(_J,KC_J)
+#define KC_FN_D FN_D
+#define KC_FN_S FN_S
+#define KC_FN_F FN_F
+
+#define KC_MACROS OSL(_MACROS)
+
+
+#define KC_E_COLN LSFT(KC_DOT)
+#define KC_E_EQL ES_EQL
+#define KC_GUI OSM(MOD_RGUI)
+#define KC_R_NUB S(KC_NUBS)
+#define KC_E_LT KC_NUBS
+#define KC_E_GT S(KC_NUBS)
+#define KC_E_TILD ES_TILD
+#define KC_E_MINS ES_MINS
+#define KC_S_SPC SFT_T(KC_SPC) // Tap for Space, hold for Shift
+#define KC_E_OVRR ES_OVRR
+#define KC_E_APOS ES_APOS
+#define KC_E_IEXL ES_IEXL
+// Short hand for complex key combinations
+# define WIN_LEFT_HALF LALT(LGUI(KC_LEFT))
+# define WIN_RIGHT_HALF LALT(LGUI(KC_RIGHT))
+# define WIN_TO_LEFT LALT(LSFT( LGUI(KC_LEFT) ))
+# define WIN_TO_RIGHT LALT(LSFT( LGUI(KC_RIGHT) ))
+
+// Ready to use Tap dance definitions, just put them on your layout
+
+#ifdef TAP_DANCE_ENABLE
+ #include "tap_dance.h"
+#endif
diff --git a/users/danielo515/readme.md b/users/danielo515/readme.md
new file mode 100644
index 0000000000..1343df9786
--- /dev/null
+++ b/users/danielo515/readme.md
@@ -0,0 +1,14 @@
+Copyright 2017 Daniel Rodriguez @ danielo515
+
+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/>.
diff --git a/users/danielo515/rules.mk b/users/danielo515/rules.mk
new file mode 100644
index 0000000000..091baf20c9
--- /dev/null
+++ b/users/danielo515/rules.mk
@@ -0,0 +1,9 @@
+SRC += danielo515.c
+
+ifeq ($(strip $(COMBO_ENABLE)), yes)
+ SRC += combo.c
+endif
+
+ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
+ SRC += tap_dance.c
+endif
diff --git a/users/danielo515/tap_dance.c b/users/danielo515/tap_dance.c
new file mode 100644
index 0000000000..7ddb55c29d
--- /dev/null
+++ b/users/danielo515/tap_dance.c
@@ -0,0 +1,139 @@
+#include "tap_dance.h"
+//**************** Definitions needed for quad function to work *********************//
+#ifdef QUAD_DANCE
+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 || state->pressed == 0)
+ 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. In example below, that means to send `xx` instead of `Escape`.
+ else if (state->count == 2)
+ {
+ if (state->interrupted)
+ return DOUBLE_SINGLE_TAP;
+ else if (state->pressed)
+ return DOUBLE_HOLD;
+ else
+ return DOUBLE_TAP;
+ }
+ else
+ return 6; //magic number. At some point this method will expand to work for more presses
+};
+
+//**************** Definitions needed for quad function to work *********************//
+# endif
+
+// Slightly better tap dance double: interruption sends double single and any number over double sends the single that number of times
+void qk_tap_dance_pair_finished_safe(qk_tap_dance_state_t *state, void *user_data) {
+ qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
+ int count = state->count;
+ if (state->count == 2) {
+ if (state->interrupted){
+ tap_code16(pair->kc1);register_code16 (pair->kc1);
+ state->count = 1; // Reset the counter as we are using the first key
+ } else register_code16 (pair->kc2);
+ return;
+ }
+ register_code16 (pair->kc1);
+ while(--count){
+ unregister_code16(pair->kc1);
+ register_code16 (pair->kc1);
+ }
+}
+
+void qk_tap_dance_pair_reset_safe(qk_tap_dance_state_t *state, void *user_data) {
+ qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
+ if (state->count == 2) {
+ unregister_code16 (pair->kc2);
+ return;
+ }
+ unregister_code16(pair->kc1);
+}
+
+//**************** Tap dance functions *********************//
+
+qk_tap_dance_action_t tap_dance_actions[] = {
+ [COPY_CUT] = ACTION_TAP_DANCE_FN(td_copy_cut),
+ [PASTE_DANCE] = ACTION_TAP_DANCE_FN(td_paste),
+ [_TD_F1] = ACTION_TAP_DANCE_DOUBLE(KC_1, KC_F1),
+ [_TD_F2] = ACTION_TAP_DANCE_DOUBLE(KC_2, KC_F2),
+ [_TD_F3] = ACTION_TAP_DANCE_DOUBLE(KC_3, KC_F3),
+ [_TD_F4] = ACTION_TAP_DANCE_DOUBLE(KC_4, KC_F4),
+ [_TD_F5] = ACTION_TAP_DANCE_DOUBLE(KC_5, KC_F5),
+ [_TD_F6] = ACTION_TAP_DANCE_DOUBLE(KC_6, KC_F6),
+ [_TD_F7] = ACTION_TAP_DANCE_DOUBLE(KC_7, KC_F7),
+ [_TD_F8] = ACTION_TAP_DANCE_DOUBLE(KC_8, KC_F8),
+ [_TD_F9] = ACTION_TAP_DANCE_DOUBLE(KC_9, KC_F9),
+ [_TD_F10] = ACTION_TAP_DANCE_DOUBLE(KC_0, KC_F10),
+ [_TD_F11] = ACTION_TAP_DANCE_DOUBLE(KC_MINS, KC_F11),
+ [_TD_F12] = ACTION_TAP_DANCE_DOUBLE(KC_EQL, KC_F12),
+ [_TD_H_ENTER] = ACTION_TAP_DANCE_DOUBLE(KC_H, KC_ENT),
+ [_TD_CLN] = ACTION_TAP_DANCE_DOUBLE(KC_SCLN, KC_COLON),
+ [_TD_SLASH] = ACTION_TAP_DANCE_DOUBLE(KC_SLASH, KC_BSLASH),
+ // OLD ONES
+ [LEFT_HOME] = ACTION_TAP_DANCE_DOUBLE(KC_LEFT, KC_HOME),
+ [RGT_HOME] = ACTION_TAP_DANCE_DOUBLE_SAFE(KC_RGHT, KC_END),
+ [J_ENT] = ACTION_TAP_DANCE_DOUBLE_SAFE(KC_J,KC_ENT),
+ [H_MINS] = ACTION_TAP_DANCE_DOUBLE_SAFE(KC_H,KC_SLASH),
+ [_TD_COPY] = ACTION_TAP_DANCE_FN(dance_copy),
+ [_TD_CUT] = ACTION_TAP_DANCE_FN(dance_cut),
+ [_TD_PASTE] = ACTION_TAP_DANCE_FN(dance_paste)
+};
+
+void td_copy_cut(qk_tap_dance_state_t *state, void *user_data)
+{
+ if (state->count == 2)
+ {
+ onMac ? SEND_STRING(SS_LGUI("x")) : SEND_STRING(SS_LCTRL("x"));
+ }
+ else
+ {
+ onMac ? SEND_STRING(SS_LGUI("c")) : SEND_STRING(SS_LCTRL("c"));
+ }
+ reset_tap_dance(state);
+};
+
+void td_paste(qk_tap_dance_state_t *state, void *user_data)
+{
+ if (state->count == 2)
+ {
+ onMac ? SEND_STRING(SS_DOWN(X_RSHIFT) SS_LGUI("v") SS_UP(X_RSHIFT)) : SEND_STRING(SS_DOWN(X_RSHIFT) SS_LCTRL("v") SS_UP(X_RSHIFT));
+ }
+ else
+ {
+ onMac ? SEND_STRING(SS_LGUI("v")) : SEND_STRING(SS_LCTRL("v"));
+ }
+ reset_tap_dance(state);
+};
+
+//===== The awesome tap dance for CUT, COPY and PASTE letters
+void dance_copy (qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 1) { tap_code16(KC_C); }
+ else
+ if (state->interrupted) { tap_code16(KC_C);tap_code16(KC_C);}
+ else CMD(KC_C);
+
+ reset_tap_dance (state);
+}
+
+void dance_cut (qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 1) { tap_code16(KC_X); }
+ else { CMD(KC_X); }
+ reset_tap_dance (state);
+}
+
+void dance_paste (qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 1) {
+ tap_code16(KC_V);
+ }
+ else {
+ CMD(KC_V);
+ }
+ reset_tap_dance (state);
+}
diff --git a/users/danielo515/tap_dance.h b/users/danielo515/tap_dance.h
new file mode 100644
index 0000000000..6ec4fe13cf
--- /dev/null
+++ b/users/danielo515/tap_dance.h
@@ -0,0 +1,80 @@
+#include "quantum.h"
+extern bool CMD(uint16_t kc);
+extern bool onMac;
+
+
+#define ACTION_TAP_DANCE_DOUBLE_SAFE(kc1, kc2) { \
+ .fn = { NULL, qk_tap_dance_pair_finished_safe, qk_tap_dance_pair_reset_safe }, \
+ .user_data = (void *)&((qk_tap_dance_pair_t) { kc1, kc2 }), \
+ }
+
+#ifdef QUAD_DANCE
+//Enums used to clearly convey the state of the tap dance
+enum {
+ SINGLE_TAP = 1,
+ SINGLE_HOLD = 2,
+ DOUBLE_TAP = 3,
+ DOUBLE_HOLD = 4,
+ DOUBLE_SINGLE_TAP = 5 //send SINGLE_TAP twice - NOT DOUBLE_TAP
+ // Add more enums here if you want for triple, quadruple, etc.
+};
+int cur_dance (qk_tap_dance_state_t *state);
+# endif
+
+enum tap_dance {
+ COPY_CUT,
+ PASTE_DANCE,
+ _TD_F1,
+ _TD_F2,
+ _TD_F3,
+ _TD_F4,
+ _TD_F5,
+ _TD_F6,
+ _TD_F7,
+ _TD_F8,
+ _TD_F9,
+ _TD_F10,
+ _TD_F11,
+ _TD_F12,
+ _TD_H_ENTER,
+ _TD_CLN,
+ _TD_SLASH,
+ // old ones
+ LEFT_HOME,
+ J_ENT,
+ H_MINS,
+ RGT_HOME,
+ _TD_COPY,
+ _TD_CUT,
+ _TD_PASTE,
+};
+void qk_tap_dance_pair_finished_safe(qk_tap_dance_state_t *state, void *user_data);
+void qk_tap_dance_pair_reset_safe(qk_tap_dance_state_t *state, void *user_data);
+void td_copy_cut (qk_tap_dance_state_t *state, void *user_data);
+void td_paste(qk_tap_dance_state_t *state, void *user_data);
+int cur_dance (qk_tap_dance_state_t *state);
+void dance_cut (qk_tap_dance_state_t *state, void *user_data);
+void dance_copy (qk_tap_dance_state_t *state, void *user_data);
+void dance_paste (qk_tap_dance_state_t *state, void *user_data);
+
+#define TD_COPY TD(_TD_COPY)
+#define TD_CUT TD(_TD_CUT)
+#define KC_TD_COPY TD(_TD_COPY) // Declarations for macros that add KC_
+#define KC_TD_CUT TD(_TD_CUT)
+#define KC_TD_PASTE TD(_TD_PASTE)
+#define KC_E_GRV ES_GRV
+#define TD_F1 TD(_TD_F1)
+#define TD_F2 TD(_TD_F2)
+#define TD_F3 TD(_TD_F3)
+#define TD_F4 TD(_TD_F4)
+#define TD_F5 TD(_TD_F5)
+#define TD_F6 TD(_TD_F6)
+#define TD_F7 TD(_TD_F7)
+#define TD_F8 TD(_TD_F8)
+#define TD_F9 TD(_TD_F9)
+#define TD_F10 TD(_TD_F10)
+#define TD_F11 TD(_TD_F11)
+#define TD_F12 TD(_TD_F12)
+#define H_ENTER TD(_TD_H_ENTER)
+#define TD_CLN TD(_TD_CLN)
+#define TD_SLASH TD(_TD_SLASH)