When a momentary layer is held, reactivate the layer if it turns off

If we have two keys on our keymap that momentarily go to the same layer (which
is the case for the factory firmware), we hold both, and release one, we want
the layer to remain active still.

To this effect, in `handleKeymapKeyswitchEvent` we will handle the case when a
momentary layer key is pressed, but not toggled on (that is, it is held): if it
is not a next/previous switch, we re-activate the layer if it wasn't on.

This fixes #154, thanks to @ToyKeeper for the report.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/175/head
Gergely Nagy 7 years ago
parent 9e222ea58e
commit b218143faf

@ -20,6 +20,11 @@ static void handleKeymapKeyswitchEvent(Key keymapEntry, uint8_t keyState) {
} else { } else {
Layer.on(target); Layer.on(target);
} }
} else if (keyIsPressed(keyState) &&
target != KEYMAP_NEXT &&
target != KEYMAP_PREVIOUS) {
if (!Layer.isOn(target))
Layer.on(target);
} }
if (keyToggledOff(keyState)) { if (keyToggledOff(keyState)) {
if (target == KEYMAP_NEXT) { if (target == KEYMAP_NEXT) {

Loading…
Cancel
Save