Based on a cool trick from ilianaw, this plugin allows to to make all keys on a layer act as if they're prefixed by some keystroke. The original use-case is for using Tmux or Screen - for example, you can have a layer of keys wherein all the keys in the layer act as if you've hit Control-B before the key.
Add the plugin to your available libraries by cloning it into your Arduino-Boards/libraries
directory.
#include <Kaleidoscope.h>
#include <Kaleidoscope-PrefixLayer.h>
// Have an enum for layers
// or some other way of assigning numbers to layers
enum {
_BASE,
_TMUX,
};
static const kaleidoscope::plugin::PrefixLayer::dict_t prefixlayerdict[] PROGMEM =
PREFIX_DICT({_TMUX, PREFIX_SEQ(LCTRL(Key_B))});
KALEIDOSCOPE_INIT_PLUGINS(PrefixLayer);
void setup(void) {
Kaleidoscope.setup();
PrefixLayer.dict = prefixlayerdict;
}
The plugin provides the PrefixLayer
object, with the following property.
Set the map of layers and prefix keys. This should be specified with the PREFIX_DICT() macro. The arguments to the macro should be a series of pairs like
{layer_number, prefix_sequence}
. Theprefix_sequence
section should be constructed with thePREFIX_SEQ
macro, and should be a series of keys that will be tapped before the key in the layer.The dict must be stored in
PROGMEM
as shown above.
Starting from the example is the recommended way of getting started with the plugin.