The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ

Revert "Remove the LayerBasedTheme plugin"

This reverts commit 48ceca0dd2.
main
Gergely Polonkai 3 months ago
parent c754ad4082
commit 5cf9205790
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4
  1. 32
      LayerBasedTheme.cpp
  2. 30
      LayerBasedTheme.h
  3. 5
      Model100.ino

@ -0,0 +1,32 @@
#include "LayerBasedTheme.h"
#include "kaleidoscope/layers.h"
#include "kaleidoscope/plugin/LEDControl.h"
namespace kaleidoscope {
namespace plugin {
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;
}
LayerBasedTheme::TransientLEDMode::TransientLEDMode(
const LayerBasedTheme *parent)
: parent_(parent){};
} // namespace plugin
} // namespace kaleidoscope
kaleidoscope::plugin::LayerBasedTheme LayerBasedTheme;

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

@ -48,6 +48,8 @@
#include "Kaleidoscope-Leader.h"
#include "LayerBasedTheme.h"
/** The Model 100's key layouts are defined as 'keymaps'.
*
* Each keymap is defined as a list using the 'KEYMAP_STACKED' macro, built
@ -320,7 +322,8 @@ KALEIDOSCOPE_INIT_PLUGINS(
EscapeOneShot,
EscapeOneShotConfig,
TapDance,
Leader
Leader,
LayerBasedTheme
);
void setup() {

Loading…
Cancel
Save