feature: Allow overload to accept an arbitrary action (#199)

master
Raheman Vaiya 4 years ago
parent bae6dd7b55
commit 083b124bb9
  1. BIN
      data/keyd-application-mapper.1.gz
  2. BIN
      data/keyd.1.gz
  3. 4
      docs/keyd.scdoc
  4. 2
      src/descriptor.c
  5. 8
      src/keyboard.c
  6. 21
      t/overload5.t
  7. 1
      t/test.conf

Binary file not shown.

Binary file not shown.

@ -332,8 +332,8 @@ arguments.
*toggle(<layer>)*
Permanently toggle the state of the given layer.
*overload(<layer>, <macro>)*
Activates the given layer while held and executes the provided macro when tapped.
*overload(<layer>, <action>)*
Activates the given while held and executes <action> on tap.
*timeout(<action 1>, <timeout>, <action 2>)*
If the key is held in isolation for more than _<timeout> ms_, activate the first

@ -34,7 +34,7 @@ static struct {
{ "oneshot", OP_ONESHOT, { ARG_LAYER } },
{ "toggle", OP_TOGGLE, { ARG_LAYER } },
{ "layer", OP_LAYER, { ARG_LAYER } },
{ "overload", OP_OVERLOAD, { ARG_LAYER, ARG_MACRO } },
{ "overload", OP_OVERLOAD, { ARG_LAYER, ARG_DESCRIPTOR } },
{ "timeout", OP_TIMEOUT, { ARG_DESCRIPTOR, ARG_TIMEOUT, ARG_DESCRIPTOR } },
{ "macro2", OP_MACRO2, { ARG_TIMEOUT, ARG_TIMEOUT, ARG_MACRO } },
};

@ -383,6 +383,7 @@ static long process_descriptor(struct keyboard *kbd, uint8_t code,
switch (d->op) {
struct macro *macro;
struct layer *layer;
struct descriptor *descriptor;
uint8_t mods;
case OP_KEYSEQUENCE:
@ -428,7 +429,7 @@ static long process_descriptor(struct keyboard *kbd, uint8_t code,
break;
case OP_OVERLOAD:
layer = &layers[d->args[0].idx];
macro = &macros[d->args[1].idx];
descriptor = &descriptors[d->args[1].idx];
if (pressed) {
activate_layer(kbd, code, layer);
@ -438,8 +439,9 @@ static long process_descriptor(struct keyboard *kbd, uint8_t code,
if (kbd->last_pressed_code == code) {
clear_oneshot(kbd);
update_mods(kbd, dl, 0);
execute_macro(kbd, dl, macro);
process_descriptor(kbd, code, descriptor, dl, 1);
process_descriptor(kbd, code, descriptor, dl, 0);
}
update_mods(kbd, NULL, 0);

@ -0,0 +1,21 @@
7 down
7 up
x down
x up
7 down
x down
x up
7 up
meta down
control down
meta up
control up
control down
x down
x up
control up
meta down
x down
x up
meta up

@ -16,6 +16,7 @@ w = oneshot(customshift)
4 = toggle(test)
5 = layer(symbols)
6 = overload(6l, esc)
7 = overload(meta, oneshot(control))
9 = M-C-S-x
q = toggle(M-C-A)
l = layer(test)

Loading…
Cancel
Save