From 361df26094eb9ec3bf5480269064d4294bef2452 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Fri, 27 Jan 2017 11:28:58 +0100 Subject: [PATCH] layers: Fix the layer toggle behaviour When toggling a layer, the same keycode should toggle the layer off, too. Without this, toggling layers won't work at all, because the target layer will never be turned off. Signed-off-by: Gergely Nagy --- src/layers.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/layers.cpp b/src/layers.cpp index 7988c4bc..fe095c2d 100644 --- a/src/layers.cpp +++ b/src/layers.cpp @@ -29,7 +29,10 @@ static void handle_keymap_key_event(Key keymapEntry, uint8_t keyState) { // switch keymap and stay there } else if (key_toggled_on(keyState)) { - Layer.on (keymapEntry.keyCode); + if (Layer.isOn (keymapEntry.keyCode) && keymapEntry.keyCode) + Layer.off(keymapEntry.keyCode); + else + Layer.on(keymapEntry.keyCode); } }