Compare commits

..

1 Commits

Author SHA1 Message Date
f83eec3e6e
WIP: layer based led theme plugin 2022-06-03 06:44:09 +02:00
6 changed files with 219 additions and 350 deletions

View File

@ -1,31 +1,10 @@
#include "LayerBasedTheme.h" #include "LayerBasedTheme.h"
#include "kaleidoscope/layers.h"
#include "kaleidoscope/plugin/LEDControl.h"
namespace kaleidoscope { namespace kaleidoscope {
namespace plugin { namespace plugin {
EventHandlerResult LayerBasedTheme::onLayerChange() { EventHandlerResult LayerBasedTheme::onLayerChange() {
uint8_t current_layer = Layer.mostRecent();
uint8_t current_mode = ::LEDControl.get_mode_index();
uint8_t new_mode;
if (current_layer <= 3) {
new_mode = 2;
} else {
new_mode = 3;
}
if (new_mode != current_mode) {
::LEDControl.set_mode(new_mode);
}
return EventHandlerResult::OK; return EventHandlerResult::OK;
} }
LayerBasedTheme::TransientLEDMode::TransientLEDMode(
const LayerBasedTheme *parent)
: parent_(parent){};
} // namespace plugin } // namespace plugin
} // namespace kaleidoscope } // namespace kaleidoscope

View File

@ -2,27 +2,16 @@
#include "kaleidoscope/event_handler_result.h" #include "kaleidoscope/event_handler_result.h"
#include "kaleidoscope/plugin.h" #include "kaleidoscope/plugin.h"
#include "kaleidoscope/plugin/AccessTransientLEDMode.h"
#include "kaleidoscope/plugin/LEDMode.h"
#include "kaleidoscope/plugin/LEDModeInterface.h" #include "kaleidoscope/plugin/LEDModeInterface.h"
namespace kaleidoscope { namespace kaleidoscope {
namespace plugin { namespace plugin {
class LayerBasedTheme : public Plugin, class LayerBasedTheme: public Plugin,
public LEDModeInterface, public LEDModeInterface {
public AccessTransientLEDMode { public:
public:
LayerBasedTheme(void) {} LayerBasedTheme(void) {}
EventHandlerResult onLayerChange(); EventHandlerResult onLayerChange();
class TransientLEDMode : public LEDMode {
public:
explicit TransientLEDMode(const LayerBasedTheme *parent);
private:
const LayerBasedTheme *parent_;
};
}; };
} // namespace plugin } // namespace plugin
} // namespace kaleidoscope } // namespace kaleidoscope

166
Layout.h
View File

@ -1,166 +0,0 @@
enum {
PRIMARY,
SHIFTED,
ALTGR,
ALTGR_SHIFT,
FUNCTION,
HUN,
COLEMAK,
ONEHAND_LEFT,
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
*/
// clang-format off
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, 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),
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)),
[SHIFTED] = KEYMAP_STACKED
(___, LSHIFT(Key_4), RALT(Key_V), RALT(Key_X), RALT(Key_Semicolon), LSHIFT(Key_5), ___,
RALT(Key_1), LSHIFT(Key_Comma), RALT(Key_M), RALT(Key_Period), LSHIFT(Key_P), LSHIFT(Key_Z), LSHIFT(Key_Tab),
___, LSHIFT(Key_A), LSHIFT(Key_O), LSHIFT(Key_E), LSHIFT(Key_U), LSHIFT(Key_I),
___, LSHIFT(Key_Period), LSHIFT(Key_Q), LSHIFT(Key_J), LSHIFT(Key_K), LSHIFT(Key_X), ___,
___, LSHIFT(Key_Backspace), ___, ___,
___,
___, RALT(Key_3), RALT(Key_C), RALT(Key_Slash), LSHIFT(Key_8), LSHIFT(Key_9), MoveToLayer(COLEMAK),
LSHIFT(Key_Enter), LSHIFT(Key_F), LSHIFT(Key_G), LSHIFT(Key_C), LSHIFT(Key_R), LSHIFT(Key_L), LSHIFT(Key_3),
LSHIFT(Key_D), LSHIFT(Key_H), LSHIFT(Key_T), LSHIFT(Key_N), LSHIFT(Key_S), LSHIFT(Key_2),
___, LSHIFT(Key_B), LSHIFT(Key_M), LSHIFT(Key_W), LSHIFT(Key_V), LSHIFT(Key_Y), LSHIFT(Key_Slash),
___, OSL(ALTGR_SHIFT), ___, ___,
___),
[ALTGR] = KEYMAP_STACKED
(___, XXX, RALT(Key_2), RALT(LSHIFT(Key_3)), RALT(Key_U), RALT(Key_5), ___,
RALT(Key_Backtick), RALT(Key_A), Key_0, RALT(LSHIFT(Key_Period)), Key_Minus, RALT(Key_Z), ___,
___, Key_Quote, Key_Equals, Key_Semicolon, Key_RightBracket, Key_NonUsBackslashAndPipe,
___, RALT(Key_Quote), Key_LeftBracket, RALT(Key_J), Key_Backslash, RALT(Key_NonUsBackslashAndPipe), ___,
___, ___, ___, OSL(ALTGR_SHIFT),
___,
___, XXX, XXX, RALT(LSHIFT(Key_Slash)), RALT(Key_8), RALT(LSHIFT(Key_8)), MoveToLayer(ONEHAND_LEFT),
___, RALT(Key_I), RALT(Key_L), RALT(Key_E), RALT(Key_H), RALT(Key_S), RALT(Key_RightBracket),
RALT(Key_D), XXX, RALT(Key_T), RALT(Key_K), RALT(Key_Minus), RALT(Key_Equals),
___, RALT(LSHIFT(Key_O)), RALT(Key_O), RALT(Key_P), RALT(LSHIFT(Key_M)), RALT(LSHIFT(Key_Comma)), RALT(Key_Y),
OSL(ALTGR_SHIFT), ___, ___, ___,
___),
[ALTGR_SHIFT] = KEYMAP_STACKED
(___, XXX, RALT(LSHIFT(Key_2)), XXX, RALT(Key_Backslash), RALT(LSHIFT(Key_5)), ___,
RALT(Key_R), RALT(LSHIFT(Key_A)), LSHIFT(Key_0), XXX, LSHIFT(Key_Minus), RALT(LSHIFT(Key_Z)), ___,
___, LSHIFT(Key_Quote), LSHIFT(Key_Equals), LSHIFT(Key_Semicolon), LSHIFT(Key_RightBracket), LSHIFT(Key_NonUsBackslashAndPipe),
___, RALT(LSHIFT(Key_Quote)), LSHIFT(Key_LeftBracket), RALT(LSHIFT(Key_J)), LSHIFT(Key_Backslash), RALT(LSHIFT(Key_NonUsBackslashAndPipe)), ___,
___, ___, ___, ___,
___,
___, RALT(LSHIFT(Key_C)), RALT(LSHIFT(Key_R)), RALT(LSHIFT(Key_V)), RALT(LSHIFT(Key_Semicolon)), XXX, ___,
___, RALT(LSHIFT(Key_I)), RALT(LSHIFT(Key_L)), RALT(LSHIFT(Key_E)), RALT(LSHIFT(Key_H)), RALT(LSHIFT(Key_S)), RALT(LSHIFT(Key_4)),
RALT(LSHIFT(Key_D)), XXX, RALT(LSHIFT(Key_T)), RALT(LSHIFT(Key_K)), RALT(LSHIFT(Key_Minus)), RALT(LSHIFT(Key_Equals)),
___, RALT(LSHIFT(Key_7)), RALT(LSHIFT(Key_B)), RALT(LSHIFT(Key_N)), RALT(LSHIFT(Key_0)), RALT(Key_0), RALT(LSHIFT(Key_Y)),
___, ___, ___, ___,
___),
[FUNCTION] = KEYMAP_STACKED
(Key_PrintScreen, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_CapsLock,
Key_Tab, ___, Key_mouseUp, Key_mouseBtnN, Key_mouseBtnR, Key_mouseScrollDn, Key_PageUp,
Key_Home, Key_mouseL, Key_mouseDn, Key_mouseR, Key_mouseBtnL, Key_mouseScrollUp,
Key_End, Key_PrintScreen, Key_Insert, Key_mouseBtnP, Key_mouseBtnM, ___, Key_PageDown,
___, Key_Delete, ___, Key_LeftShift,
___,
Consumer_ScanPreviousTrack, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10, Key_F11,
Consumer_PlaySlashPause, Consumer_ScanNextTrack, RALT(Key_B), RALT(Key_N), RALT(Key_F), RALT(Key_G), Key_F12,
___, Key_LeftArrow, Key_DownArrow, Key_UpArrow, Key_RightArrow, RALT(Key_X),
Key_PcApplication, Consumer_Mute, Consumer_VolumeDecrement, Consumer_VolumeIncrement, ___, RALT(Key_Q), RALT(Key_W),
Key_RightShift, Key_RightAlt, Key_Enter, ___,
___),
[HUN] = KEYMAP_STACKED
(___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext,
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
___, Key_A, Key_S, Key_D, Key_F, Key_G,
___, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Backspace, Key_LeftAlt, Key_LeftShift,
OSL(FUNCTION),
___, Key_6, Key_7, Key_8, Key_9, Key_0, MoveToLayer(PRIMARY),
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Minus,
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
Key_LeftGui, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Backslash,
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
OSL(FUNCTION)),
[COLEMAK] = KEYMAP_STACKED
(___, Key_1, Key_2, Key_3, Key_4, Key_5, ___,
Key_Backtick, Key_Q, Key_W, Key_F, Key_P, Key_G, Key_Tab,
___, Key_A, Key_R, Key_S, Key_T, Key_D,
Key_NonUsBackslashAndPipe, Key_Y, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Backspace, Key_LeftAlt, Key_LeftShift,
OSL(FUNCTION),
___, Key_6, Key_7, Key_8, Key_9, Key_0, MoveToLayer(PRIMARY),
Key_Enter, Key_J, Key_L, Key_U, Key_Z, Key_Semicolon, Key_Equals,
Key_H, Key_N, Key_E, Key_I, Key_O, Key_Quote,
Key_LeftGui, Key_K, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
OSL(FUNCTION)),
[ONEHAND_LEFT] = KEYMAP_STACKED
(XXX, Key_1, Key_2, Key_3, Key_4, Key_5, Key_Tab,
XXX, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Enter,
XXX, Key_A, Key_S, Key_D, Key_F, Key_G,
XXX, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Spacebar, Key_LeftAlt, Key_LeftShift,
OSL(ONEHAND_RIGHT),
XXX, XXX, XXX, XXX, XXX, XXX, XXX,
XXX, XXX, XXX, XXX, XXX, XXX, XXX,
XXX, XXX, XXX, XXX, XXX, XXX,
___, XXX, XXX, XXX, XXX, XXX, XXX,
XXX, XXX, XXX, XXX,
XXX),
[ONEHAND_RIGHT] = KEYMAP_STACKED
(___, Key_6, Key_7, Key_8, Key_9, Key_Backtick, MoveToLayer(PRIMARY),
___, Key_Y, Key_U, Key_I, Key_O, Key_P, ___,
___, Key_H, Key_J, Key_K, Key_L, Key_Semicolon,
___, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, ___,
Key_LeftControl, Key_Backspace, Key_LeftAlt, Key_LeftShift,
___,
XXX, XXX, XXX, XXX, XXX, XXX, XXX,
XXX, XXX, XXX, XXX, XXX, XXX, XXX,
XXX, XXX, XXX, XXX, XXX, XXX,
___, XXX, XXX, XXX, XXX, XXX, XXX,
XXX, XXX, XXX, XXX,
XXX)
) // KEYMAPS(
/* Re-enable astyle's indent enforcement */
// clang-format on

View File

@ -1,66 +1,44 @@
// -*- mode: c++ -*- // -*- mode: c++ -*-
// Copyright 2016-2022 Keyboardio, inc. <jesse@keyboard.io> // Copyright 2016 Keyboardio, inc. <jesse@keyboard.io>
// See "LICENSE" for license details // See "LICENSE" for license details
#ifndef BUILD_INFORMATION #ifndef BUILD_INFORMATION
#define BUILD_INFORMATION "locally built on " __DATE__ " at " __TIME__ #define BUILD_INFORMATION "locally built on " __DATE__ " at " __TIME__
#endif #endif
#include "Kaleidoscope.h"
#include "Kaleidoscope.h"
#include "Kaleidoscope-EEPROM-Settings.h" #include "Kaleidoscope-EEPROM-Settings.h"
#include "Kaleidoscope-EEPROM-Keymap.h" #include "Kaleidoscope-EEPROM-Keymap.h"
#include "Kaleidoscope-FocusSerial.h" #include "Kaleidoscope-FocusSerial.h"
#include "Kaleidoscope-MouseKeys.h" #include "Kaleidoscope-MouseKeys.h"
#include "Kaleidoscope-Macros.h" #include "Kaleidoscope-Macros.h"
#include "Kaleidoscope-LEDControl.h" #include "Kaleidoscope-LEDControl.h"
#include "Kaleidoscope-LEDEffect-BootGreeting.h" #include "Kaleidoscope-LEDEffect-BootGreeting.h"
#include "Kaleidoscope-LEDEffect-Rainbow.h" #include "Kaleidoscope-LEDEffect-Rainbow.h"
#include "Kaleidoscope-LED-Stalker.h" #include "Kaleidoscope-LED-Stalker.h"
#include "Kaleidoscope-LED-Palette-Theme.h" #include "Kaleidoscope-LED-Palette-Theme.h"
#include "Kaleidoscope-Colormap.h" #include "Kaleidoscope-Colormap.h"
#include "Kaleidoscope-HardwareTestMode.h" #include "Kaleidoscope-HardwareTestMode.h"
#include "Kaleidoscope-HostPowerManagement.h" #include "Kaleidoscope-HostPowerManagement.h"
#include "Kaleidoscope-MagicCombo.h" #include "Kaleidoscope-MagicCombo.h"
#include "Kaleidoscope-USB-Quirks.h" #include "Kaleidoscope-USB-Quirks.h"
#include "Kaleidoscope-OneShot.h" enum {
#include "Kaleidoscope-Escape-OneShot.h" MACRO_VERSION_INFO,
MACRO_ANY,
};
#include "Kaleidoscope-LED-ActiveModColor.h"
#include "Kaleidoscope-TapDance.h"
#include "TapDance.h"
#include "Kaleidoscope-Leader.h"
#include "LayerBasedTheme.h"
#include "Layout.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
* of first the left hand's layout, followed by the right hand's layout. * of first the left hand's layout, followed by the right hand's layout.
* *
* Keymaps typically consist mostly of `Key_` definitions. There are many, many * Keymaps typically consist mostly of `Key_` definitions. There are many, many keys
* keys defined as part of the USB HID Keyboard specification. You can find the * defined as part of the USB HID Keyboard specification. You can find the names
* names (if not yet the explanations) for all the standard `Key_` defintions * (if not yet the explanations) for all the standard `Key_` defintions offered by
* offered by Kaleidoscope in these files: * Kaleidoscope in these files:
* https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/keyboard.h * https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/keyboard.h
* https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/consumerctl.h * https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/consumerctl.h
* https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/sysctl.h * https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/sysctl.h
@ -73,29 +51,197 @@
* keeping NUM and FN consistent and accessible on all layers * keeping NUM and FN consistent and accessible on all layers
* *
* A key defined as 'ShiftToLayer(FUNCTION)' will switch to FUNCTION while held. * A key defined as 'ShiftToLayer(FUNCTION)' will switch to FUNCTION while held.
* Similarly, a key defined as 'LockLayer(FUNCTION)' will switch to FUNCTION * Similarly, a key defined as 'LockLayer(FUNCTION)' will switch to FUNCTION when tapped.
* when tapped.
*/ */
#define MACRO_TYPER(name, string) \ enum {
static void name##Typer(uint8_t seq_index) { \ PRIMARY,
Macros.type((string)); \ SHIFTED,
ALTGR,
ALTGR_SHIFT,
FUNCTION,
HUN,
COLEMAK,
ONEHAND_LEFT,
ONEHAND_RIGHT,
};
/* This comment temporarily turns off astyle's indent enforcement
* so we can make the keymaps actually resemble the physical key layout better
*/
// clang-format off
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, Key_Tab,
___, Key_A, Key_O, Key_E, Key_U, Key_I,
LALT(LCTRL(Key_Delete)), RALT(Key_Comma), Key_Q, Key_J, Key_K, Key_X, Key_Escape,
Key_LeftControl, Key_Backspace, Key_LeftAlt, ShiftToLayer(SHIFTED),
ShiftToLayer(FUNCTION),
M(1), Key_6, Key_7, Key_8, Key_9, Key_Backtick, MoveToLayer(HUN),
Key_Enter, 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_LeftGui, Key_B, Key_M, Key_W, Key_V, Key_Y, Key_Slash,
ShiftToLayer(SHIFTED), ShiftToLayer(ALTGR), Key_Spacebar, Key_RightControl,
ShiftToLayer(FUNCTION)),
[SHIFTED] = KEYMAP_STACKED
(___, LSHIFT(Key_4), RALT(Key_V), RALT(Key_X), RALT(Key_Semicolon), LSHIFT(Key_5), ___,
RALT(Key_1), LSHIFT(Key_Comma), RALT(Key_M), RALT(Key_Period), LSHIFT(Key_P), LSHIFT(Key_Z), LSHIFT(Key_Tab),
___, LSHIFT(Key_A), LSHIFT(Key_O), LSHIFT(Key_E), LSHIFT(Key_U), LSHIFT(Key_I),
___, LSHIFT(Key_Period), LSHIFT(Key_Q), LSHIFT(Key_J), LSHIFT(Key_K), LSHIFT(Key_X), ___,
___, LSHIFT(Key_Backspace), ___, ___,
___,
M(0), RALT(Key_3), RALT(Key_C), RALT(Key_Slash), LSHIFT(Key_8), LSHIFT(Key_9), MoveToLayer(COLEMAK),
LSHIFT(Key_Enter), LSHIFT(Key_F), LSHIFT(Key_G), LSHIFT(Key_C), LSHIFT(Key_R), LSHIFT(Key_L), LSHIFT(Key_3),
LSHIFT(Key_D), LSHIFT(Key_H), LSHIFT(Key_T), LSHIFT(Key_N), LSHIFT(Key_S), LSHIFT(Key_2),
___, LSHIFT(Key_B), LSHIFT(Key_M), LSHIFT(Key_W), LSHIFT(Key_V), LSHIFT(Key_Y), LSHIFT(Key_Slash),
___, ShiftToLayer(ALTGR_SHIFT), ___, ___,
___),
[ALTGR] = KEYMAP_STACKED
(___, XXX, RALT(Key_2), RALT(LSHIFT(Key_3)), RALT(Key_U), RALT(Key_5), ___,
RALT(Key_Backtick), RALT(Key_A), Key_0, RALT(LSHIFT(Key_Period)), Key_Minus, RALT(Key_Z), ___,
___, Key_Quote, Key_Equals, Key_Semicolon, Key_RightBracket, Key_NonUsBackslashAndPipe,
___, RALT(Key_Quote), Key_LeftBracket, RALT(Key_J), Key_Backslash, RALT(Key_NonUsBackslashAndPipe), ___,
___, ___, ___, ShiftToLayer(ALTGR_SHIFT),
___,
___, XXX, XXX, RALT(LSHIFT(Key_Slash)), RALT(Key_8), RALT(LSHIFT(Key_8)), MoveToLayer(ONEHAND_LEFT),
___, RALT(Key_I), RALT(Key_L), RALT(Key_E), RALT(Key_H), RALT(Key_S), RALT(Key_RightBracket),
RALT(Key_D), XXX, RALT(Key_T), RALT(Key_K), RALT(Key_Minus), RALT(Key_Equals),
___, RALT(LSHIFT(Key_O)), RALT(Key_O), RALT(Key_P), RALT(LSHIFT(Key_M)), RALT(LSHIFT(Key_Comma)), RALT(Key_Y),
ShiftToLayer(ALTGR_SHIFT), ___, ___, ___,
___),
[ALTGR_SHIFT] = KEYMAP_STACKED
(___, XXX, RALT(LSHIFT(Key_2)), XXX, RALT(Key_Backslash), RALT(LSHIFT(Key_5)), ___,
RALT(Key_R), RALT(LSHIFT(Key_A)), LSHIFT(Key_0), XXX, LSHIFT(Key_Minus), RALT(LSHIFT(Key_Z)), ___,
___, LSHIFT(Key_Quote), LSHIFT(Key_Equals), LSHIFT(Key_Semicolon), LSHIFT(Key_RightBracket), LSHIFT(Key_NonUsBackslashAndPipe),
___, RALT(LSHIFT(Key_Quote)), LSHIFT(Key_LeftBracket), RALT(LSHIFT(Key_J)), LSHIFT(Key_Backslash), RALT(LSHIFT(Key_NonUsBackslashAndPipe)), ___,
___, ___, ___, ___,
___,
___, RALT(LSHIFT(Key_C)), RALT(LSHIFT(Key_R)), RALT(LSHIFT(Key_V)), RALT(LSHIFT(Key_Semicolon)), XXX, ___,
___, RALT(LSHIFT(Key_I)), RALT(LSHIFT(Key_L)), RALT(LSHIFT(Key_E)), RALT(LSHIFT(Key_H)), RALT(LSHIFT(Key_S)), RALT(LSHIFT(Key_4)),
RALT(LSHIFT(Key_D)), XXX, RALT(LSHIFT(Key_T)), RALT(LSHIFT(Key_K)), RALT(LSHIFT(Key_Minus)), RALT(LSHIFT(Key_Equals)),
___, RALT(LSHIFT(Key_7)), RALT(LSHIFT(Key_B)), RALT(LSHIFT(Key_N)), RALT(LSHIFT(Key_0)), RALT(Key_0), RALT(LSHIFT(Key_Y)),
___, ___, ___, ___,
___),
[FUNCTION] = KEYMAP_STACKED
(Key_PrintScreen, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_CapsLock,
Key_Tab, ___, Key_mouseUp, Key_mouseBtnN, Key_mouseBtnR, Key_mouseScrollDn, Key_PageUp,
Key_Home, Key_mouseL, Key_mouseDn, Key_mouseR, Key_mouseBtnL, Key_mouseScrollUp,
Key_End, Key_PrintScreen, Key_Insert, Key_mouseBtnP, Key_mouseBtnM, ___, Key_PageDown,
___, Key_Delete, ___, Key_LeftShift,
___,
Consumer_ScanPreviousTrack, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10, Key_F11,
Consumer_PlaySlashPause, Consumer_ScanNextTrack, RALT(Key_B), RALT(Key_N), RALT(Key_F), RALT(Key_G), Key_F12,
___, Key_LeftArrow, Key_DownArrow, Key_UpArrow, Key_RightArrow, RALT(Key_X),
Key_PcApplication, Consumer_Mute, Consumer_VolumeDecrement, Consumer_VolumeIncrement, ___, RALT(Key_Q), RALT(Key_W),
Key_RightShift, Key_RightAlt, Key_Enter, ___,
___),
[HUN] = KEYMAP_STACKED
(___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext,
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
___, Key_A, Key_S, Key_D, Key_F, Key_G,
___, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Backspace, Key_LeftAlt, Key_LeftShift,
ShiftToLayer(FUNCTION),
___, Key_6, Key_7, Key_8, Key_9, Key_0, MoveToLayer(PRIMARY),
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Minus,
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
Key_LeftGui, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Backslash,
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
ShiftToLayer(FUNCTION)),
[COLEMAK] = KEYMAP_STACKED
(___, Key_1, Key_2, Key_3, Key_4, Key_5, ___,
Key_Backtick, Key_Q, Key_W, Key_F, Key_P, Key_G, Key_Tab,
___, Key_A, Key_R, Key_S, Key_T, Key_D,
Key_NonUsBackslashAndPipe, Key_Y, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Backspace, Key_LeftAlt, Key_LeftShift,
ShiftToLayer(FUNCTION),
___, Key_6, Key_7, Key_8, Key_9, Key_0, MoveToLayer(PRIMARY),
Key_Enter, Key_J, Key_L, Key_U, Key_Z, Key_Semicolon, Key_Equals,
Key_H, Key_N, Key_E, Key_I, Key_O, Key_Quote,
Key_LeftGui, Key_K, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
ShiftToLayer(FUNCTION)),
[ONEHAND_LEFT] = KEYMAP_STACKED
(XXX, Key_1, Key_2, Key_3, Key_4, Key_5, Key_Tab,
XXX, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Enter,
XXX, Key_A, Key_S, Key_D, Key_F, Key_G,
XXX, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Spacebar, Key_LeftAlt, Key_LeftShift,
ShiftToLayer(ONEHAND_RIGHT),
XXX, XXX, XXX, XXX, XXX, XXX, XXX,
XXX, XXX, XXX, XXX, XXX, XXX, XXX,
XXX, XXX, XXX, XXX, XXX, XXX,
___, XXX, XXX, XXX, XXX, XXX, XXX,
XXX, XXX, XXX, XXX,
XXX),
[ONEHAND_RIGHT] = KEYMAP_STACKED
(___, Key_6, Key_7, Key_8, Key_9, Key_Backtick, MoveToLayer(PRIMARY),
___, Key_Y, Key_U, Key_I, Key_O, Key_P, ___,
___, Key_H, Key_J, Key_K, Key_L, Key_Semicolon,
___, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, ___,
Key_LeftControl, Key_Backspace, Key_LeftAlt, Key_LeftShift,
___,
XXX, XXX, XXX, XXX, XXX, XXX, XXX,
XXX, XXX, XXX, XXX, XXX, XXX, XXX,
XXX, XXX, XXX, XXX, XXX, XXX,
___, XXX, XXX, XXX, XXX, XXX, XXX,
XXX, XXX, XXX, XXX,
XXX)
) // KEYMAPS(
/* Re-enable astyle's indent enforcement */
// clang-format on
static void versionInfoMacro(uint8_t key_state) {
if (keyToggledOn(key_state)) {
Macros.type(PSTR("Keyboardio Model 100 - Kaleidoscope "));
Macros.type(PSTR(BUILD_INFORMATION));
} }
}
#define LEAD_MACRO(name) name##Typer static void anyKeyMacro(KeyEvent &event) {
if (keyToggledOn(event.state)) {
event.key.setKeyCode(Key_A.getKeyCode() + (uint8_t)(millis() % 36));
event.key.setFlags(0);
}
}
// Note that this layout was made for a Hungarian OS layout, hence the y/z and _/? swaps. const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
MACRO_TYPER(extPython, ".pz"); switch (macro_id) {
MACRO_TYPER(extOrg, ".org");
MACRO_TYPER(pyInit, "??init??");
static const kaleidoscope::plugin::Leader::dictionary_t leader_dictionary[] PROGMEM = LEADER_DICT case MACRO_VERSION_INFO:
({LEADER_SEQ(LEAD(MAIN), Key_P), LEAD_MACRO(extPython)}, versionInfoMacro(event.state);
{LEADER_SEQ(LEAD(MAIN), Key_O), LEAD_MACRO(extOrg)}, break;
{LEADER_SEQ(LEAD(MAIN), Key_I), LEAD_MACRO(pyInit)});
void toggleLedsOnSuspendResume( case MACRO_ANY:
kaleidoscope::plugin::HostPowerManagement::Event event) { anyKeyMacro(event);
break;
}
return MACRO_NONE;
}
void toggleLedsOnSuspendResume(kaleidoscope::plugin::HostPowerManagement::Event event) {
switch (event) { switch (event) {
case kaleidoscope::plugin::HostPowerManagement::Suspend: case kaleidoscope::plugin::HostPowerManagement::Suspend:
LEDControl.disable(); LEDControl.disable();
@ -108,8 +254,7 @@ void toggleLedsOnSuspendResume(
} }
} }
void hostPowerManagementEventHandler( void hostPowerManagementEventHandler(kaleidoscope::plugin::HostPowerManagement::Event event) {
kaleidoscope::plugin::HostPowerManagement::Event event) {
toggleLedsOnSuspendResume(event); toggleLedsOnSuspendResume(event);
} }
@ -146,20 +291,12 @@ KALEIDOSCOPE_INIT_PLUGINS(
LEDRainbowWaveEffect, LEDRainbowWaveEffect,
StalkerEffect, StalkerEffect,
LEDPaletteTheme, LEDPaletteTheme,
ActiveModColorEffect,
ColormapEffect, ColormapEffect,
Macros, Macros,
MouseKeys, MouseKeys,
HostPowerManagement, HostPowerManagement,
MagicCombo, MagicCombo,
USBQuirks, USBQuirks);
OneShot,
EscapeOneShot,
EscapeOneShotConfig,
TapDance,
Leader,
LayerBasedTheme
);
void setup() { void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();
@ -169,10 +306,6 @@ 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.setSpeedLimit(31);
MouseKeys.wheelDelay = 60;
} }
void loop() { void loop() {

View File

@ -1,47 +0,0 @@
#include <Kaleidoscope.h>
#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)
);
case OPENING_QMS:
return tapDanceActionKeys(
tap_count,
tap_dance_action,
// “ „ «
LSHIFT(RALT(Key_O)), RALT(Key_O), LSHIFT(RALT(Key_M)), LSHIFT(RALT(Key_7)), LSHIFT(RALT(Key_N)), RALT(Key_0)
);
case CLOSING_QMS:
return tapDanceActionKeys(
tap_count,
tap_dance_action,
// ” »
RALT(Key_P), LSHIFT(RALT(Key_Comma)), LSHIFT(RALT(Key_B)), LSHIFT(RALT(Key_0))
);
}
}

View File

@ -1,19 +0,0 @@
#pragma once
#include <Kaleidoscope-TapDance.h>
enum {
LEFT_PARENS,
RIGHT_PARENS,
OPENING_QMS,
CLOSING_QMS,
};
extern void
tapDanceAction(uint8_t tapDanceIndex, KeyAddr key_addr, uint8_t tapCount, kaleidoscope::plugin::TapDance::ActionType tapDanceAction);
namespace gpolonkai {
namespace TapDance {
extern bool cancelOneShot;
}
}