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
1 changed files with 36 additions and 5 deletions

View File

@ -46,6 +46,8 @@
#include "TapDance.h"
#include "Kaleidoscope-Leader.h"
/** The Model 100's key layouts are defined as 'keymaps'.
*
* Each keymap is defined as a list using the 'KEYMAP_STACKED' macro, built
@ -83,6 +85,16 @@ enum {
ONEHAND_RIGHT,
};
enum {
LEAD_EXT_PY,
LEAD_EXT_ORG,
LEAD_INIT_PY,
};
enum {
MAIN,
};
/* This comment temporarily turns off astyle's indent enforcement
* so we can make the keymaps actually resemble the physical key layout better
*/
@ -97,10 +109,10 @@ KEYMAPS(
Key_LeftControl, Key_Backspace, OSL(SHIFTED), Key_Escape,
OSL(FUNCTION),
___, 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),
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,
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),
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),
OSL(ALTGR)),
@ -228,6 +240,23 @@ KEYMAPS(
/* Re-enable astyle's indent enforcement */
// 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(
kaleidoscope::plugin::HostPowerManagement::Event event) {
switch (event) {
@ -290,7 +319,8 @@ KALEIDOSCOPE_INIT_PLUGINS(
OneShot,
EscapeOneShot,
EscapeOneShotConfig,
TapDance
TapDance,
Leader
);
void setup() {
@ -301,6 +331,7 @@ void setup() {
StalkerEffect.activate();
EEPROMKeymap.setup(9);
ColormapEffect.max_layers(9);
Leader.dictionary = leader_dictionary;
MouseKeys.speed = 2;
MouseKeys.setSpeedLimit(31);
MouseKeys.wheelDelay = 60;