keycodes: add LT layer-tap keycodes

main
Ilya Zhuravlev 2020-10-18 00:37:03 -04:00
parent af7883d283
commit 11e8c50ac4
1 changed files with 9 additions and 0 deletions

View File

@ -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()