Add and set up the Leader plugin

This commit is contained in:
Gergely Polonkai 2022-06-25 07:22:16 +02:00
parent 0da0c8c003
commit c754ad4082
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4

View File

@ -46,6 +46,8 @@
#include "TapDance.h" #include "TapDance.h"
#include "Kaleidoscope-Leader.h"
/** The Model 100's key layouts are defined as 'keymaps'. /** The Model 100's key layouts are defined as 'keymaps'.
* *
* Each keymap is defined as a list using the 'KEYMAP_STACKED' macro, built * Each keymap is defined as a list using the 'KEYMAP_STACKED' macro, built
@ -83,6 +85,16 @@ enum {
ONEHAND_RIGHT, ONEHAND_RIGHT,
}; };
enum {
LEAD_EXT_PY,
LEAD_EXT_ORG,
LEAD_INIT_PY,
};
enum {
MAIN,
};
/* This comment temporarily turns off astyle's indent enforcement /* This comment temporarily turns off astyle's indent enforcement
* so we can make the keymaps actually resemble the physical key layout better * so we can make the keymaps actually resemble the physical key layout better
*/ */
@ -97,7 +109,7 @@ KEYMAPS(
Key_LeftControl, Key_Backspace, OSL(SHIFTED), Key_Escape, Key_LeftControl, Key_Backspace, OSL(SHIFTED), Key_Escape,
OSL(FUNCTION), OSL(FUNCTION),
___, Key_6, Key_7, Key_8, Key_9, Key_Backtick, MoveToLayer(HUN), LEAD(MAIN), Key_6, Key_7, Key_8, Key_9, Key_Backtick, MoveToLayer(HUN),
TD(1), 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_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_Enter, Key_B, Key_M, Key_W, Key_V, Key_Y, Key_Slash,
@ -228,6 +240,23 @@ KEYMAPS(
/* Re-enable astyle's indent enforcement */ /* Re-enable astyle's indent enforcement */
// clang-format on // clang-format on
#define MACRO_TYPER(name, string) \
static void name##Typer(uint8_t seq_index) { \
Macros.type((string)); \
}
#define LEAD_MACRO(name) name##Typer
// Note that this layout was made for a Hungarian OS layout, hence the y/z and _/? swaps.
MACRO_TYPER(extPython, ".pz");
MACRO_TYPER(extOrg, ".org");
MACRO_TYPER(initPy, "??init??.pz");
static const kaleidoscope::plugin::Leader::dictionary_t leader_dictionary[] PROGMEM = LEADER_DICT
({LEADER_SEQ(LEAD(MAIN), Key_P), LEAD_MACRO(extPython)},
{LEADER_SEQ(LEAD(MAIN), Key_O), LEAD_MACRO(extOrg)},
{LEADER_SEQ(LEAD(MAIN), Key_I), LEAD_MACRO(initPy)});
void toggleLedsOnSuspendResume( void toggleLedsOnSuspendResume(
kaleidoscope::plugin::HostPowerManagement::Event event) { kaleidoscope::plugin::HostPowerManagement::Event event) {
switch (event) { switch (event) {
@ -290,7 +319,8 @@ KALEIDOSCOPE_INIT_PLUGINS(
OneShot, OneShot,
EscapeOneShot, EscapeOneShot,
EscapeOneShotConfig, EscapeOneShotConfig,
TapDance TapDance,
Leader
); );
void setup() { void setup() {
@ -301,6 +331,7 @@ void setup() {
StalkerEffect.activate(); StalkerEffect.activate();
EEPROMKeymap.setup(9); EEPROMKeymap.setup(9);
ColormapEffect.max_layers(9); ColormapEffect.max_layers(9);
Leader.dictionary = leader_dictionary;
MouseKeys.speed = 2; MouseKeys.speed = 2;
MouseKeys.setSpeedLimit(31); MouseKeys.setSpeedLimit(31);
MouseKeys.wheelDelay = 60; MouseKeys.wheelDelay = 60;