From 11e8c50ac4e7fb4795d567353e422946072a604e Mon Sep 17 00:00:00 2001 From: Ilya Zhuravlev Date: Sun, 18 Oct 2020 00:37:03 -0400 Subject: [PATCH] keycodes: add LT layer-tap keycodes --- src/main/python/keycodes.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/python/keycodes.py b/src/main/python/keycodes.py index 8a6520d..f8e9d6e 100644 --- a/src/main/python/keycodes.py +++ b/src/main/python/keycodes.py @@ -168,6 +168,7 @@ KEYCODES_ISO = [ KEYCODES_LAYERS = [] +QK_LAYER_TAP = 0x4000 QK_ONE_SHOT_MOD = 0x5500 QK_MOD_TAP = 0x6000 @@ -197,6 +198,10 @@ def MT(mod): return QK_MOD_TAP | (mod << 8) +def LT(layer): + return QK_LAYER_TAP | (((layer) & 0xF) << 8) + + KEYCODES_QUANTUM = [ K(0x5C00, "RESET", "Reset", "Reboot to bootloader"), K(QK_ONE_SHOT_MOD | MOD_LSFT, "OSM(MOD_LSFT)", "OSM\nLSft", "Enable Left Shift for one keypress"), @@ -351,6 +356,10 @@ def recreate_layer_keycodes(layers): KEYCODES_LAYERS.extend(generate_keycodes_for_mask("OSL", 0x5400)) KEYCODES_LAYERS.extend(generate_keycodes_for_mask("TO", 0x5000 | (1 << 4))) + for x in range(layers): + KEYCODES_LAYERS.append(Keycode(LT(x), "LT({}, kc)".format(x), "LT {}\n(kc)".format(x), + "kc on tap, switch to layer {} while held".format(x), masked=True)) + recreate_keycodes()