From 091c29ed2e180812c0061027145533f5621700e1 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 16 Jun 2022 12:52:43 +0200 Subject: [PATCH] Define tap dance for parens/braces The keys labeled as Tab and Enter are now all the brackets. Tap tapped once is `(`, tapped twice is `[`, tapped thrice is `{`. Enter tapped once is `)`, tapped twice is `]`, tapped thrice is `}`. --- Model100.ino | 6 ++++-- TapDance.cpp | 25 +++++++++++++++++++++++++ TapDance.h | 17 +++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 TapDance.cpp create mode 100644 TapDance.h diff --git a/Model100.ino b/Model100.ino index 2516950..b35728a 100644 --- a/Model100.ino +++ b/Model100.ino @@ -44,6 +44,8 @@ #include "Kaleidoscope-TapDance.h" +#include "TapDance.h" + enum { MACRO_VERSION_INFO, MACRO_ANY, @@ -94,14 +96,14 @@ enum { KEYMAPS( [PRIMARY] = KEYMAP_STACKED (___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, - RALT(Key_7), LSHIFT(Key_6), Key_Comma, Key_Period, Key_P, Key_Z, ___, + RALT(Key_7), LSHIFT(Key_6), Key_Comma, Key_Period, Key_P, Key_Z, TD(0), ___, Key_A, Key_O, Key_E, Key_U, Key_I, ___, RALT(Key_Comma), Key_Q, Key_J, Key_K, Key_X, Key_Tab, Key_LeftControl, Key_Backspace, OSL(SHIFTED), Key_Escape, OSL(FUNCTION), M(1), Key_6, Key_7, Key_8, Key_9, Key_Backtick, MoveToLayer(HUN), - ___, Key_F, Key_G, Key_C, Key_R, Key_L, LSHIFT(Key_7), + TD(1), Key_F, Key_G, Key_C, Key_R, Key_L, LSHIFT(Key_7), Key_D, Key_H, Key_T, Key_N, Key_S, LSHIFT(Key_1), Key_Enter, Key_B, Key_M, Key_W, Key_V, Key_Y, Key_Slash, Key_LeftGui, Key_Enter, Key_Spacebar, OSM(LeftAlt), diff --git a/TapDance.cpp b/TapDance.cpp new file mode 100644 index 0000000..501c11c --- /dev/null +++ b/TapDance.cpp @@ -0,0 +1,25 @@ +#include + +#include "TapDance.h" + +namespace gpolonkai { +namespace TapDance { +bool cancelOneShot = false; +} +} + +void +tapDanceAction( + uint8_t tap_dance_index, + KeyAddr key_addr, + uint8_t tap_count, + kaleidoscope::plugin::TapDance::ActionType tap_dance_action +) +{ + switch (tap_dance_index) { + case LEFT_PARENS: + return tapDanceActionKeys(tap_count, tap_dance_action, LSHIFT(Key_8), RALT(Key_F), RALT(Key_B)); + case RIGHT_PARENS: + return tapDanceActionKeys(tap_count, tap_dance_action, LSHIFT(Key_9), RALT(Key_G), RALT(Key_N)); + } +} diff --git a/TapDance.h b/TapDance.h new file mode 100644 index 0000000..d92aac2 --- /dev/null +++ b/TapDance.h @@ -0,0 +1,17 @@ +#pragma once + +#include + +enum { + LEFT_PARENS, + RIGHT_PARENS, +}; + +extern void +tapDanceAction(uint8_t tapDanceIndex, KeyAddr key_addr, uint8_t tapCount, kaleidoscope::plugin::TapDance::ActionType tapDanceAction); + +namespace gpolonkai { +namespace TapDance { + extern bool cancelOneShot; +} +}