diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk
index 0bc32c537c..4819f66787 100644
--- a/builddefs/common_features.mk
+++ b/builddefs/common_features.mk
@@ -555,6 +555,7 @@ ifeq ($(strip $(VIAL_ENABLE)), yes)
QMK_SETTINGS ?= yes
TAP_DANCE_ENABLE ?= yes
COMBO_ENABLE ?= yes
+ KEY_OVERRIDE_ENABLE ?= yes
SRC += $(QUANTUM_DIR)/vial.c
EXTRAINCDIRS += $(KEYMAP_OUTPUT)
OPT_DEFS += -DVIAL_ENABLE -DNO_DEBUG -DSERIAL_NUMBER=\"vial:f64c2b3c\"
diff --git a/keyboards/bongopad/keymaps/vial/rules.mk b/keyboards/bongopad/keymaps/vial/rules.mk
index f59d7a17af..50c8916927 100644
--- a/keyboards/bongopad/keymaps/vial/rules.mk
+++ b/keyboards/bongopad/keymaps/vial/rules.mk
@@ -3,4 +3,5 @@ VIAL_ENABLE = yes
VIAL_ENCODERS_ENABLE = yes
LTO_ENABLE = yes
COMBO_ENABLE = no
-QMK_SETTINGS = no
\ No newline at end of file
+QMK_SETTINGS = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/bpiphany/frosty_flake/keymaps/vial/rules.mk b/keyboards/bpiphany/frosty_flake/keymaps/vial/rules.mk
index b62def6d90..d20616a1c4 100644
--- a/keyboards/bpiphany/frosty_flake/keymaps/vial/rules.mk
+++ b/keyboards/bpiphany/frosty_flake/keymaps/vial/rules.mk
@@ -4,3 +4,4 @@ VIAL_ENABLE = yes
TAP_DANCE_ENABLE = no
COMBO_ENABLE = no
QMK_SETTINGS = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/cablecardesigns/cypher/rev6/keymaps/vial/rules.mk b/keyboards/cablecardesigns/cypher/rev6/keymaps/vial/rules.mk
index b09ec49041..a60b51944e 100644
--- a/keyboards/cablecardesigns/cypher/rev6/keymaps/vial/rules.mk
+++ b/keyboards/cablecardesigns/cypher/rev6/keymaps/vial/rules.mk
@@ -3,4 +3,5 @@ VIAL_ENABLE = yes
LTO_ENABLE = yes
# to reduce firmware size
QMK_SETTINGS = no
-TAP_DANCE_ENABLE = no
\ No newline at end of file
+TAP_DANCE_ENABLE = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/capsunlocked/cu65/keymaps/vial/rules.mk b/keyboards/capsunlocked/cu65/keymaps/vial/rules.mk
index b9e49e51e7..fdd7b4ca27 100644
--- a/keyboards/capsunlocked/cu65/keymaps/vial/rules.mk
+++ b/keyboards/capsunlocked/cu65/keymaps/vial/rules.mk
@@ -7,3 +7,4 @@ VIAL_COMBO_ENABLE = yes
TAP_DANCE_ENABLE = yes
VIAL_TAP_DANCE_ENABLE = yes
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/checkerboards/nop60/keymaps/vial/rules.mk b/keyboards/checkerboards/nop60/keymaps/vial/rules.mk
index 6ea04bad27..d94bd7bc2b 100644
--- a/keyboards/checkerboards/nop60/keymaps/vial/rules.mk
+++ b/keyboards/checkerboards/nop60/keymaps/vial/rules.mk
@@ -2,4 +2,4 @@ VIA_ENABLE = yes
VIAL_ENABLE = yes
LTO_ENABLE = yes
TAP_DANCE_ENABLE = no
-
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/cx60/keymaps/vial/rules.mk b/keyboards/cx60/keymaps/vial/rules.mk
index b823138c83..2742175b12 100644
--- a/keyboards/cx60/keymaps/vial/rules.mk
+++ b/keyboards/cx60/keymaps/vial/rules.mk
@@ -2,3 +2,4 @@ LTO_ENABLE = yes
VIA_ENABLE = yes
VIAL_ENABLE = yes
QMK_SETTINGS = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/cx60/keymaps/vial_caps/rules.mk b/keyboards/cx60/keymaps/vial_caps/rules.mk
index b823138c83..2742175b12 100644
--- a/keyboards/cx60/keymaps/vial_caps/rules.mk
+++ b/keyboards/cx60/keymaps/vial_caps/rules.mk
@@ -2,3 +2,4 @@ LTO_ENABLE = yes
VIA_ENABLE = yes
VIAL_ENABLE = yes
QMK_SETTINGS = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/doodboard/duckboard_r2/keymaps/vial/rules.mk b/keyboards/doodboard/duckboard_r2/keymaps/vial/rules.mk
index 1ee1f3087d..18e3365b84 100644
--- a/keyboards/doodboard/duckboard_r2/keymaps/vial/rules.mk
+++ b/keyboards/doodboard/duckboard_r2/keymaps/vial/rules.mk
@@ -17,5 +17,6 @@ VIALRGB_ENABLE = yes
QMK_SETTINGS = no
TAP_DANCE_ENABLE = no
COMBO_ENABLE = no
+KEY_OVERRIDE_ENABLE = no
-SRC += oled.c
\ No newline at end of file
+SRC += oled.c
diff --git a/keyboards/gray_studio/think65/solder/keymaps/vial/rules.mk b/keyboards/gray_studio/think65/solder/keymaps/vial/rules.mk
index ee51cc7c92..6cc77f055a 100644
--- a/keyboards/gray_studio/think65/solder/keymaps/vial/rules.mk
+++ b/keyboards/gray_studio/think65/solder/keymaps/vial/rules.mk
@@ -5,3 +5,4 @@ CONSOLE_ENABLE = no
VIAL_ENABLE = yes
QMK_SETTINGS = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/handwired/baredev/rev1/keymaps/vial/rules.mk b/keyboards/handwired/baredev/rev1/keymaps/vial/rules.mk
index 614819506a..4117c2846c 100644
--- a/keyboards/handwired/baredev/rev1/keymaps/vial/rules.mk
+++ b/keyboards/handwired/baredev/rev1/keymaps/vial/rules.mk
@@ -7,4 +7,5 @@ MIDI_ENABLE = no
BLUETOOTH_ENABLE = no
KEY_LOCK_ENABLE = no
TERMINAL_ENABLE = no
-LTO_ENABLE = yes
\ No newline at end of file
+LTO_ENABLE = yes
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/handwired/jotanck/keymaps/vial/rules.mk b/keyboards/handwired/jotanck/keymaps/vial/rules.mk
index ce8900efbc..e00dd2bf78 100644
--- a/keyboards/handwired/jotanck/keymaps/vial/rules.mk
+++ b/keyboards/handwired/jotanck/keymaps/vial/rules.mk
@@ -6,3 +6,4 @@ COMBO_ENABLE = yes
TAPDANCE_ENABLE = yes
LTO_ENABLE = no
QMK_SETTINGS = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/handwired/snatchpad/keymaps/vial/rules.mk b/keyboards/handwired/snatchpad/keymaps/vial/rules.mk
index 6f7f2b3173..9885eb4393 100644
--- a/keyboards/handwired/snatchpad/keymaps/vial/rules.mk
+++ b/keyboards/handwired/snatchpad/keymaps/vial/rules.mk
@@ -2,3 +2,4 @@ VIA_ENABLE = yes
VIAL_ENABLE = yes
VIAL_ENCODERS_ENABLE = yes
LTO_ENABLE = yes
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/hineybush/h87a/keymaps/vial/rules.mk b/keyboards/hineybush/h87a/keymaps/vial/rules.mk
index 1d50588b99..d830c376d8 100644
--- a/keyboards/hineybush/h87a/keymaps/vial/rules.mk
+++ b/keyboards/hineybush/h87a/keymaps/vial/rules.mk
@@ -3,4 +3,4 @@ VIAL_ENABLE = yes
TAP_DANCE_ENABLE = no
COMBO_ENABLE = no
QMK_SETTINGS = no
-
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/hineybush/h88/keymaps/vial/rules.mk b/keyboards/hineybush/h88/keymaps/vial/rules.mk
index 1d50588b99..d830c376d8 100644
--- a/keyboards/hineybush/h88/keymaps/vial/rules.mk
+++ b/keyboards/hineybush/h88/keymaps/vial/rules.mk
@@ -3,4 +3,4 @@ VIAL_ENABLE = yes
TAP_DANCE_ENABLE = no
COMBO_ENABLE = no
QMK_SETTINGS = no
-
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/idb/idb_60/keymaps/vial/rules.mk b/keyboards/idb/idb_60/keymaps/vial/rules.mk
index 0bfdf1cad5..265d2fe31e 100644
--- a/keyboards/idb/idb_60/keymaps/vial/rules.mk
+++ b/keyboards/idb/idb_60/keymaps/vial/rules.mk
@@ -2,3 +2,4 @@ VIA_ENABLE = yes
VIAL_ENABLE = yes
LTO_ENABLE = yes
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/idobao/id87/v1/keymaps/vial/rules.mk b/keyboards/idobao/id87/v1/keymaps/vial/rules.mk
index 08323c2d50..ac49000028 100644
--- a/keyboards/idobao/id87/v1/keymaps/vial/rules.mk
+++ b/keyboards/idobao/id87/v1/keymaps/vial/rules.mk
@@ -3,3 +3,4 @@ VIA_ENABLE = yes
VIAL_ENABLE = yes
TAP_DANCE_ENABLE = no
COMBO_ENABLE = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/ilumkb/primus75/keymaps/vial/config.h b/keyboards/ilumkb/primus75/keymaps/vial/config.h
index 5a3372b782..3d1363f061 100644
--- a/keyboards/ilumkb/primus75/keymaps/vial/config.h
+++ b/keyboards/ilumkb/primus75/keymaps/vial/config.h
@@ -5,3 +5,4 @@
#define VIAL_UNLOCK_COMBO_ROWS { 0, 0 }
#define VIAL_UNLOCK_COMBO_COLS { 0, 15 }
+#define VIAL_COMBO_ENTRIES 6
diff --git a/keyboards/ilumkb/primus75/keymaps/vial/rules.mk b/keyboards/ilumkb/primus75/keymaps/vial/rules.mk
index 69354a7147..d94bd7bc2b 100644
--- a/keyboards/ilumkb/primus75/keymaps/vial/rules.mk
+++ b/keyboards/ilumkb/primus75/keymaps/vial/rules.mk
@@ -2,3 +2,4 @@ VIA_ENABLE = yes
VIAL_ENABLE = yes
LTO_ENABLE = yes
TAP_DANCE_ENABLE = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/kbdfans/kbd67/hotswap/keymaps/vial/rules.mk b/keyboards/kbdfans/kbd67/hotswap/keymaps/vial/rules.mk
index 148dfa63c4..7d7551adbf 100644
--- a/keyboards/kbdfans/kbd67/hotswap/keymaps/vial/rules.mk
+++ b/keyboards/kbdfans/kbd67/hotswap/keymaps/vial/rules.mk
@@ -2,3 +2,4 @@ VIA_ENABLE = yes
LTO_ENABLE = yes
VIAL_ENABLE = yes
QMK_SETTINGS = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/kbdfans/kbd67/mkiirgb/v2/keymaps/vial/rules.mk b/keyboards/kbdfans/kbd67/mkiirgb/v2/keymaps/vial/rules.mk
index 5f678fd668..537a828bbe 100644
--- a/keyboards/kbdfans/kbd67/mkiirgb/v2/keymaps/vial/rules.mk
+++ b/keyboards/kbdfans/kbd67/mkiirgb/v2/keymaps/vial/rules.mk
@@ -3,3 +3,4 @@ LTO_ENABLE = yes
VIAL_ENABLE = yes
QMK_SETTINGS = no
COMBO_ENABLE = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/kbdfans/kbd67/mkiirgb/v3/keymaps/vial/rules.mk b/keyboards/kbdfans/kbd67/mkiirgb/v3/keymaps/vial/rules.mk
index 6c4f4f108d..1818e2480a 100644
--- a/keyboards/kbdfans/kbd67/mkiirgb/v3/keymaps/vial/rules.mk
+++ b/keyboards/kbdfans/kbd67/mkiirgb/v3/keymaps/vial/rules.mk
@@ -13,3 +13,4 @@ COMBO_ENABLE = no # ~2408 bytes
#SPACE_CADET_ENABLE = no # ~324 bytes
#MAGIC_ENABLE = no # ~584 bytes
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/kbdfans/kbd75/keymaps/vial_rev2/rules.mk b/keyboards/kbdfans/kbd75/keymaps/vial_rev2/rules.mk
index 256d6a187b..3511d998c0 100644
--- a/keyboards/kbdfans/kbd75/keymaps/vial_rev2/rules.mk
+++ b/keyboards/kbdfans/kbd75/keymaps/vial_rev2/rules.mk
@@ -3,3 +3,4 @@ LTO_ENABLE = yes
VIAL_ENABLE = yes
QMK_SETTINGS = no
TAP_DANCE_ENABLE = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/keebio/kbo5000/keymaps/vial/rules.mk b/keyboards/keebio/kbo5000/keymaps/vial/rules.mk
index 4e59ade5f8..478112628a 100644
--- a/keyboards/keebio/kbo5000/keymaps/vial/rules.mk
+++ b/keyboards/keebio/kbo5000/keymaps/vial/rules.mk
@@ -6,3 +6,4 @@ QMK_SETTINGS = no
COMBO_ENABLE = no
BACKLIGHT_ENABLE = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/keychron/q1/rev_0100/keymaps/vial/rules.mk b/keyboards/keychron/q1/rev_0100/keymaps/vial/rules.mk
index 62568f6213..ed500574a3 100644
--- a/keyboards/keychron/q1/rev_0100/keymaps/vial/rules.mk
+++ b/keyboards/keychron/q1/rev_0100/keymaps/vial/rules.mk
@@ -6,3 +6,4 @@ VIALRGB_ENABLE = no
QMK_SETTINGS = no
TAP_DANCE_ENABLE = no
COMBO_ENABLE = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/kprepublic/bm16a/keymaps/vial/config.h b/keyboards/kprepublic/bm16a/keymaps/vial/config.h
new file mode 100644
index 0000000000..3aff809dca
--- /dev/null
+++ b/keyboards/kprepublic/bm16a/keymaps/vial/config.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#define VIAL_KEYBOARD_UID {0x58, 0x55, 0xE7, 0x22, 0xE7, 0x2F, 0xD2, 0x9A}
+
+#define VIAL_UNLOCK_COMBO_ROWS { 0, 0 }
+#define VIAL_UNLOCK_COMBO_COLS { 0, 3 }
+
+// Reduce firmware size by decreasing number of functions:
+#define DYNAMIC_KEYMAP_LAYER_COUNT 4
+#define DYNAMIC_KEYMAP_MACRO_COUNT 16
+#define VIAL_COMBO_ENTRIES 4
+#define VIAL_KEY_OVERRIDE_ENTRIES 4
+#define VIAL_TAP_DANCE_ENTRIES 4
+
+// Reduce firmware size by removing unneeded animations:
+#undef RGBLIGHT_ANIMATIONS
+#define RGBLIGHT_EFFECT_ALTERNATING
+#define RGBLIGHT_EFFECT_BREATHING
+#define RGBLIGHT_EFFECT_CHRISTMAS
+#define RGBLIGHT_EFFECT_KNIGHT
+#define RGBLIGHT_EFFECT_RAINBOW_MOOD
+#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
+#define RGBLIGHT_EFFECT_RGB_TEST
+#define RGBLIGHT_EFFECT_SNAKE
+#define RGBLIGHT_EFFECT_STATIC_GRADIENT
+// #define RGBLIGHT_EFFECT_TWINKLE
diff --git a/keyboards/kprepublic/bm16a/keymaps/vial/keymap.c b/keyboards/kprepublic/bm16a/keymaps/vial/keymap.c
new file mode 100644
index 0000000000..59eae99218
--- /dev/null
+++ b/keyboards/kprepublic/bm16a/keymaps/vial/keymap.c
@@ -0,0 +1,43 @@
+/* Copyright 2022
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [0] = LAYOUT_ortho_4x4(
+ KC_P7, KC_P8, KC_P9, KC_PMNS,
+ KC_P4, KC_P5, KC_P6, KC_PPLS,
+ KC_P1, KC_P2, KC_P3, KC_PENT,
+ KC_P0, KC_PDOT, KC_SPC, MO(1)
+ ),
+ [1] = LAYOUT_ortho_4x4(
+ RESET, KC_PAST, KC_PSLS, _______,
+ BL_TOGG, BL_DEC, BL_INC, BL_STEP,
+ RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD,
+ RGB_SAI, RGB_SAD, _______, _______
+ ),
+ [2] = LAYOUT_ortho_4x4(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
+ ),
+ [3] = LAYOUT_ortho_4x4(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
+ )
+};
diff --git a/keyboards/kprepublic/bm16a/keymaps/vial/readme.md b/keyboards/kprepublic/bm16a/keymaps/vial/readme.md
new file mode 100644
index 0000000000..2b43d7cc48
--- /dev/null
+++ b/keyboards/kprepublic/bm16a/keymaps/vial/readme.md
@@ -0,0 +1,7 @@
+# Vial Keymap for BM16a
+
+[Vial] settings for the [KPrepublic BM16a] with a default keymap based on the stock layout that this keypad ships with.
+
+
+[Vial]: https://get.vial.today
+[KPrepublic BM16a]: https://kprepublic.com/collections/bm16/products/bm16a-16-keys-custom-mechanical-keyboard-pcb-plate-programmed-numpad-layouts-qmk-firmware-with-rgb-bottom-underglow-alps-mx
diff --git a/keyboards/kprepublic/bm16a/keymaps/vial/rules.mk b/keyboards/kprepublic/bm16a/keymaps/vial/rules.mk
new file mode 100644
index 0000000000..3ac00ba36a
--- /dev/null
+++ b/keyboards/kprepublic/bm16a/keymaps/vial/rules.mk
@@ -0,0 +1,7 @@
+VIA_ENABLE = yes
+VIAL_ENABLE = yes
+
+# Reduce firmware size:
+LTO_ENABLE = yes
+MAGIC_ENABLE = no
+QMK_SETTINGS = no
diff --git a/keyboards/kprepublic/bm16a/keymaps/vial/vial.json b/keyboards/kprepublic/bm16a/keymaps/vial/vial.json
new file mode 100644
index 0000000000..2b6952562f
--- /dev/null
+++ b/keyboards/kprepublic/bm16a/keymaps/vial/vial.json
@@ -0,0 +1,15 @@
+{
+ "name": "KPrepublic BM16a",
+ "vendorId": "0x4B50",
+ "productId": "0x016A",
+ "lighting": "qmk_backlight_rgblight",
+ "matrix": { "rows": 4, "cols": 4 },
+ "layouts": {
+ "keymap": [
+ ["0,0","0,1","0,2","0,3"],
+ ["1,0","1,1","1,2","1,3"],
+ ["2,0","2,1","2,2","2,3"],
+ ["3,0","3,1","3,2","3,3"]
+ ]
+ }
+}
diff --git a/keyboards/kprepublic/bm16s/keymaps/vial/rules.mk b/keyboards/kprepublic/bm16s/keymaps/vial/rules.mk
index d2384352dd..1c122ec1c9 100644
--- a/keyboards/kprepublic/bm16s/keymaps/vial/rules.mk
+++ b/keyboards/kprepublic/bm16s/keymaps/vial/rules.mk
@@ -1,4 +1,5 @@
VIA_ENABLE = yes
VIAL_ENABLE = yes
LTO_ENABLE = yes
-COMBO_ENABLE = no
\ No newline at end of file
+COMBO_ENABLE = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/kprepublic/bm40hsrgb/keymaps/jotix_vial/rules.mk b/keyboards/kprepublic/bm40hsrgb/keymaps/jotix_vial/rules.mk
index 7b442ee3cc..babed57414 100644
--- a/keyboards/kprepublic/bm40hsrgb/keymaps/jotix_vial/rules.mk
+++ b/keyboards/kprepublic/bm40hsrgb/keymaps/jotix_vial/rules.mk
@@ -7,3 +7,4 @@ COMBO_ENABLE = yes
TAP_DANCE_ENABLE = no
LTO_ENABLE = no
QMK_SETTINGS = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/kprepublic/bm40hsrgb/keymaps/vial/rules.mk b/keyboards/kprepublic/bm40hsrgb/keymaps/vial/rules.mk
index 1eae292ecb..fc3c2620a6 100644
--- a/keyboards/kprepublic/bm40hsrgb/keymaps/vial/rules.mk
+++ b/keyboards/kprepublic/bm40hsrgb/keymaps/vial/rules.mk
@@ -4,3 +4,4 @@ LTO_ENABLE = yes
QMK_SETTINGS = no
COMBO_ENABLE = no
TAP_DANCE_ENABLE = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/lazydesigners/the40/keymaps/vial/rules.mk b/keyboards/lazydesigners/the40/keymaps/vial/rules.mk
index 043b69911e..4f2d360198 100644
--- a/keyboards/lazydesigners/the40/keymaps/vial/rules.mk
+++ b/keyboards/lazydesigners/the40/keymaps/vial/rules.mk
@@ -2,3 +2,4 @@ VIA_ENABLE = yes
VIAL_ENABLE = yes
LTO_ENABLE = yes
QMK_SETTINGS = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/lily58/keymaps/vial/rules.mk b/keyboards/lily58/keymaps/vial/rules.mk
index 2fdefb66db..d94a4b5a96 100644
--- a/keyboards/lily58/keymaps/vial/rules.mk
+++ b/keyboards/lily58/keymaps/vial/rules.mk
@@ -17,3 +17,4 @@ CONSOLE_ENABLE = no
QMK_SETTINGS = yes
LTO_ENABLE = yes
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/maple_computing/launchpad/keymaps/vial/rules.mk b/keyboards/maple_computing/launchpad/keymaps/vial/rules.mk
index 8ae08f4e70..0418160c5a 100644
--- a/keyboards/maple_computing/launchpad/keymaps/vial/rules.mk
+++ b/keyboards/maple_computing/launchpad/keymaps/vial/rules.mk
@@ -2,3 +2,4 @@ VIA_ENABLE = yes
VIAL_ENABLE = yes
LTO_ENABLE = yes
RGBLIGHT_ENABLE = yes
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/misterdeck/keymaps/vial/rules.mk b/keyboards/misterdeck/keymaps/vial/rules.mk
index c5bd63c851..2c1bcd8fc2 100644
--- a/keyboards/misterdeck/keymaps/vial/rules.mk
+++ b/keyboards/misterdeck/keymaps/vial/rules.mk
@@ -1,3 +1,4 @@
VIA_ENABLE = yes
VIAL_ENABLE = yes
QMK_SETTINGS = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/nullbitsco/nibble/keymaps/vial/rules.mk b/keyboards/nullbitsco/nibble/keymaps/vial/rules.mk
index b20d3cabf1..36b5a42d4e 100644
--- a/keyboards/nullbitsco/nibble/keymaps/vial/rules.mk
+++ b/keyboards/nullbitsco/nibble/keymaps/vial/rules.mk
@@ -3,3 +3,4 @@ VIA_ENABLE = yes
QMK_SETTINGS = no
VIAL_ENABLE = yes
VIAL_ENCODERS_ENABLE = yes
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/peej/lumberjack/keymaps/vial/rules.mk b/keyboards/peej/lumberjack/keymaps/vial/rules.mk
index 4f7618e9b2..2e31796d1b 100644
--- a/keyboards/peej/lumberjack/keymaps/vial/rules.mk
+++ b/keyboards/peej/lumberjack/keymaps/vial/rules.mk
@@ -1,2 +1,3 @@
VIA_ENABLE = yes
VIAL_ENABLE = yes
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/sergiopoverony/creator_pro/keymaps/vial/rules.mk b/keyboards/sergiopoverony/creator_pro/keymaps/vial/rules.mk
index a9a8878afb..c224117d29 100644
--- a/keyboards/sergiopoverony/creator_pro/keymaps/vial/rules.mk
+++ b/keyboards/sergiopoverony/creator_pro/keymaps/vial/rules.mk
@@ -3,3 +3,4 @@ VIAL_ENABLE = yes
VIAL_ENCODERS_ENABLE = yes
QMK_SETTINGS = no
COMBO_ENABLE = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/walletburner/cajal/keymaps/vial/rules.mk b/keyboards/walletburner/cajal/keymaps/vial/rules.mk
index 0e1926ff9d..67e450ec70 100644
--- a/keyboards/walletburner/cajal/keymaps/vial/rules.mk
+++ b/keyboards/walletburner/cajal/keymaps/vial/rules.mk
@@ -4,3 +4,4 @@ LTO_ENABLE = yes
QMK_SETTINGS = no
VIAL_ENCODERS_ENABLE = yes
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/wavtype/foundation/keymaps/vial/rules.mk b/keyboards/wavtype/foundation/keymaps/vial/rules.mk
index a80e76803c..4f2d360198 100644
--- a/keyboards/wavtype/foundation/keymaps/vial/rules.mk
+++ b/keyboards/wavtype/foundation/keymaps/vial/rules.mk
@@ -1,4 +1,5 @@
VIA_ENABLE = yes
VIAL_ENABLE = yes
LTO_ENABLE = yes
-QMK_SETTINGS = no
\ No newline at end of file
+QMK_SETTINGS = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/wavtype/p01_ultra/keymaps/vial/rules.mk b/keyboards/wavtype/p01_ultra/keymaps/vial/rules.mk
index a80e76803c..4f2d360198 100644
--- a/keyboards/wavtype/p01_ultra/keymaps/vial/rules.mk
+++ b/keyboards/wavtype/p01_ultra/keymaps/vial/rules.mk
@@ -1,4 +1,5 @@
VIA_ENABLE = yes
VIAL_ENABLE = yes
LTO_ENABLE = yes
-QMK_SETTINGS = no
\ No newline at end of file
+QMK_SETTINGS = no
+KEY_OVERRIDE_ENABLE = no
diff --git a/keyboards/wilba_tech/wt65_xtx/keymaps/vial/rules.mk b/keyboards/wilba_tech/wt65_xtx/keymaps/vial/rules.mk
index bb654744bd..39e1471e70 100644
--- a/keyboards/wilba_tech/wt65_xtx/keymaps/vial/rules.mk
+++ b/keyboards/wilba_tech/wt65_xtx/keymaps/vial/rules.mk
@@ -2,3 +2,4 @@ VIA_ENABLE = yes
VIAL_ENABLE = yes
LTO_ENABLE = yes
MOUSEKEY_ENABLE = yes
+KEY_OVERRIDE_ENABLE = no
diff --git a/quantum/action.c b/quantum/action.c
index 0f9ea2120a..6403d4b664 100644
--- a/quantum/action.c
+++ b/quantum/action.c
@@ -392,11 +392,11 @@ if (QS_oneshot_tap_toggle > 1) {
# endif
case MODS_TAP_TOGGLE:
if (event.pressed) {
- if (tap_count <= TAPPING_TOGGLE) {
+ if (tap_count <= QS_tapping_toggle) {
register_mods(mods);
}
} else {
- if (tap_count < TAPPING_TOGGLE) {
+ if (tap_count < QS_tapping_toggle) {
unregister_mods(mods);
}
}
@@ -549,11 +549,11 @@ if (QS_oneshot_tap_toggle > 1) {
case OP_TAP_TOGGLE:
/* tap toggle */
if (event.pressed) {
- if (tap_count < TAPPING_TOGGLE) {
+ if (tap_count < QS_tapping_toggle) {
layer_invert(action.layer_tap.val);
}
} else {
- if (tap_count <= TAPPING_TOGGLE) {
+ if (tap_count <= QS_tapping_toggle) {
layer_invert(action.layer_tap.val);
}
}
@@ -688,7 +688,7 @@ if (QS_oneshot_tap_toggle > 1) {
swap_hands = !swap_hands;
}
} else {
- if (tap_count < TAPPING_TOGGLE) {
+ if (tap_count < QS_tapping_toggle) {
swap_hands = !swap_hands;
}
}
diff --git a/quantum/dynamic_keymap.c b/quantum/dynamic_keymap.c
index 85f242ee8d..49971ba529 100644
--- a/quantum/dynamic_keymap.c
+++ b/quantum/dynamic_keymap.c
@@ -20,6 +20,7 @@
#include "quantum.h" // for send_string()
#include "dynamic_keymap.h"
#include "via.h" // for default VIA_EEPROM_ADDR_END
+#include
#ifdef VIAL_ENABLE
#include "vial.h"
@@ -101,9 +102,18 @@ static pin_t encoders_pad_a[] = ENCODERS_PAD_A;
#define VIAL_COMBO_SIZE 0
#endif
+// Key overrides
+#define VIAL_KEY_OVERRIDE_EEPROM_ADDR (VIAL_COMBO_EEPROM_ADDR + VIAL_COMBO_SIZE)
+
+#ifdef VIAL_KEY_OVERRIDE_ENABLE
+#define VIAL_KEY_OVERRIDE_SIZE (sizeof(vial_key_override_entry_t) * VIAL_KEY_OVERRIDE_ENTRIES)
+#else
+#define VIAL_KEY_OVERRIDE_SIZE 0
+#endif
+
// Dynamic macro
#ifndef DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR
-# define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (VIAL_COMBO_EEPROM_ADDR + VIAL_COMBO_SIZE)
+# define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (VIAL_KEY_OVERRIDE_EEPROM_ADDR + VIAL_KEY_OVERRIDE_SIZE)
#endif
// Sanity check that dynamic keymaps fit in available EEPROM
@@ -246,6 +256,28 @@ int dynamic_keymap_set_combo(uint8_t index, const vial_combo_entry_t *entry) {
}
#endif
+#ifdef VIAL_KEY_OVERRIDE_ENABLE
+int dynamic_keymap_get_key_override(uint8_t index, vial_key_override_entry_t *entry) {
+ if (index >= VIAL_KEY_OVERRIDE_ENTRIES)
+ return -1;
+
+ void *address = (void*)(VIAL_KEY_OVERRIDE_EEPROM_ADDR + index * sizeof(vial_key_override_entry_t));
+ eeprom_read_block(entry, address, sizeof(vial_key_override_entry_t));
+
+ return 0;
+}
+
+int dynamic_keymap_set_key_override(uint8_t index, const vial_key_override_entry_t *entry) {
+ if (index >= VIAL_KEY_OVERRIDE_ENTRIES)
+ return -1;
+
+ void *address = (void*)(VIAL_KEY_OVERRIDE_EEPROM_ADDR + index * sizeof(vial_key_override_entry_t));
+ eeprom_write_block(entry, address, sizeof(vial_key_override_entry_t));
+
+ return 0;
+}
+#endif
+
#if defined(VIAL_ENCODERS_ENABLE) && defined(VIAL_ENCODER_DEFAULT)
static const uint16_t PROGMEM vial_encoder_default[] = VIAL_ENCODER_DEFAULT;
_Static_assert(sizeof(vial_encoder_default)/sizeof(*vial_encoder_default) == 2 * DYNAMIC_KEYMAP_LAYER_COUNT * NUMBER_OF_ENCODERS,
@@ -299,6 +331,14 @@ void dynamic_keymap_reset(void) {
dynamic_keymap_set_combo(i, &combo);
#endif
+#ifdef VIAL_KEY_OVERRIDE_ENABLE
+ vial_key_override_entry_t ko = { 0 };
+ ko.layers = ~0;
+ ko.options = vial_ko_option_activation_negative_mod_up | vial_ko_option_activation_required_mod_down | vial_ko_option_activation_trigger_down;
+ for (size_t i = 0; i < VIAL_KEY_OVERRIDE_ENTRIES; ++i)
+ dynamic_keymap_set_key_override(i, &ko);
+#endif
+
#ifdef VIAL_ENABLE
/* re-lock the keyboard */
vial_unlocked = vial_unlocked_prev;
@@ -441,6 +481,13 @@ void dynamic_keymap_macro_reset(void) {
}
}
+static uint16_t decode_keycode(uint16_t kc) {
+ /* map 0xFF01 => 0x0100; 0xFF02 => 0x0200, etc */
+ if (kc > 0xFF00)
+ return (kc & 0xFF) << 8;
+ return kc;
+}
+
void dynamic_keymap_macro_send(uint8_t id) {
if (id >= DYNAMIC_KEYMAP_MACRO_COUNT) {
return;
@@ -495,6 +542,27 @@ void dynamic_keymap_macro_send(uint8_t id) {
data[2] = eeprom_read_byte(p++);
if (data[2] != 0)
send_string(data);
+ } else if (data[1] == VIAL_MACRO_EXT_TAP || data[1] == VIAL_MACRO_EXT_DOWN || data[1] == VIAL_MACRO_EXT_UP) {
+ data[2] = eeprom_read_byte(p++);
+ if (data[2] != 0) {
+ data[3] = eeprom_read_byte(p++);
+ if (data[3] != 0) {
+ uint16_t kc;
+ memcpy(&kc, &data[2], sizeof(kc));
+ kc = decode_keycode(kc);
+ switch (data[1]) {
+ case VIAL_MACRO_EXT_TAP:
+ vial_keycode_tap(kc);
+ break;
+ case VIAL_MACRO_EXT_DOWN:
+ vial_keycode_down(kc);
+ break;
+ case VIAL_MACRO_EXT_UP:
+ vial_keycode_up(kc);
+ break;
+ }
+ }
+ }
} else if (data[1] == SS_DELAY_CODE) {
// For delay, decode the delay and wait_ms for that amount
uint8_t d0 = eeprom_read_byte(p++);
diff --git a/quantum/dynamic_keymap.h b/quantum/dynamic_keymap.h
index 023af87ea7..3d2ed4e624 100644
--- a/quantum/dynamic_keymap.h
+++ b/quantum/dynamic_keymap.h
@@ -46,6 +46,10 @@ int dynamic_keymap_set_tap_dance(uint8_t index, const vial_tap_dance_entry_t *en
int dynamic_keymap_get_combo(uint8_t index, vial_combo_entry_t *entry);
int dynamic_keymap_set_combo(uint8_t index, const vial_combo_entry_t *entry);
#endif
+#ifdef VIAL_KEY_OVERRIDE_ENABLE
+int dynamic_keymap_get_key_override(uint8_t index, vial_key_override_entry_t *entry);
+int dynamic_keymap_set_key_override(uint8_t index, const vial_key_override_entry_t *entry);
+#endif
void dynamic_keymap_reset(void);
// These get/set the keycodes as stored in the EEPROM buffer
// Data is big-endian 16-bit values (the keycodes)
diff --git a/quantum/process_keycode/process_haptic.c b/quantum/process_keycode/process_haptic.c
index 0f07f9ac75..a17dbb3d1f 100644
--- a/quantum/process_keycode/process_haptic.c
+++ b/quantum/process_keycode/process_haptic.c
@@ -18,6 +18,7 @@
#include "quantum_keycodes.h"
#include "action_tapping.h"
#include "usb_device_state.h"
+#include "qmk_settings.h"
__attribute__((weak)) bool get_haptic_enabled_key(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
@@ -26,7 +27,7 @@ __attribute__((weak)) bool get_haptic_enabled_key(uint16_t keycode, keyrecord_t
if (record->tap.count == 0) return false;
break;
case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE_MAX:
- if (record->tap.count != TAPPING_TOGGLE) return false;
+ if (record->tap.count != QS_tapping_toggle) return false;
break;
case QK_LAYER_TAP ... QK_LAYER_TAP_MAX:
if (record->tap.count == 0) return false;
diff --git a/quantum/qmk_settings.c b/quantum/qmk_settings.c
index 6bb11f866d..9d20b1bda5 100644
--- a/quantum/qmk_settings.c
+++ b/quantum/qmk_settings.c
@@ -54,6 +54,7 @@ static const qmk_settings_proto_t protos[] PROGMEM = {
#endif
DECLARE_SETTING(18, tap_code_delay),
DECLARE_SETTING(19, tap_hold_caps_delay),
+ DECLARE_SETTING(20, tapping_toggle),
};
static const qmk_settings_proto_t *find_setting(uint16_t qsid) {
@@ -116,6 +117,7 @@ void qmk_settings_reset(void) {
QS.tapping = 0;
QS.tap_code_delay = TAP_CODE_DELAY;
QS.tap_hold_caps_delay = TAP_HOLD_CAPS_DELAY;
+ QS.tapping_toggle = TAPPING_TOGGLE;
save_settings();
/* to trigger all callbacks */
diff --git a/quantum/qmk_settings.h b/quantum/qmk_settings.h
index 4ce67103c3..15ee483b96 100644
--- a/quantum/qmk_settings.h
+++ b/quantum/qmk_settings.h
@@ -120,8 +120,10 @@ typedef struct {
uint8_t tapping;
uint16_t tap_code_delay;
uint16_t tap_hold_caps_delay;
+ uint8_t tapping_toggle;
+ uint8_t unused;
} qmk_settings_t;
-_Static_assert(sizeof(qmk_settings_t) == 34, "unexpected size of the qmk_settings_t structure");
+_Static_assert(sizeof(qmk_settings_t) == 36, "unexpected size of the qmk_settings_t structure");
typedef void (*qmk_setting_callback_t)(void);
@@ -170,6 +172,9 @@ extern qmk_settings_t QS;
#define QS_tap_code_delay (QS.tap_code_delay)
#define QS_tap_hold_caps_delay (QS.tap_hold_caps_delay)
+/* Tapping Toggle */
+#define QS_tapping_toggle (QS.tapping_toggle)
+
#else
/* dynamic settings framework is disabled => hardcode the settings and let the compiler optimize extra branches out */
@@ -202,6 +207,9 @@ extern qmk_settings_t QS;
#define QS_tap_code_delay TAP_CODE_DELAY
#define QS_tap_hold_caps_delay TAP_HOLD_CAPS_DELAY
+/* Tapping Toggle */
+#define QS_tapping_toggle TAPPING_TOGGLE
+
#endif
#if defined(__AVR__) && defined(QMK_SETTINGS)
diff --git a/quantum/vial.c b/quantum/vial.c
index da2ce56b10..b67c168737 100644
--- a/quantum/vial.c
+++ b/quantum/vial.c
@@ -58,6 +58,10 @@ static void reload_tap_dance(void);
static void reload_combo(void);
#endif
+#ifdef VIAL_KEY_OVERRIDE_ENABLE
+static void reload_key_override(void);
+#endif
+
void vial_init(void) {
#ifdef VIAL_TAP_DANCE_ENABLE
reload_tap_dance();
@@ -65,6 +69,9 @@ void vial_init(void) {
#ifdef VIAL_COMBO_ENABLE
reload_combo();
#endif
+#ifdef VIAL_KEY_OVERRIDE_ENABLE
+ reload_key_override();
+#endif
}
void vial_handle_cmd(uint8_t *msg, uint8_t length) {
@@ -214,6 +221,7 @@ void vial_handle_cmd(uint8_t *msg, uint8_t length) {
memset(msg, 0, length);
msg[0] = VIAL_TAP_DANCE_ENTRIES;
msg[1] = VIAL_COMBO_ENTRIES;
+ msg[2] = VIAL_KEY_OVERRIDE_ENTRIES;
break;
}
#ifdef VIAL_TAP_DANCE_ENABLE
@@ -249,6 +257,23 @@ void vial_handle_cmd(uint8_t *msg, uint8_t length) {
reload_combo();
break;
}
+#endif
+#ifdef VIAL_KEY_OVERRIDE_ENABLE
+ case dynamic_vial_key_override_get: {
+ uint8_t idx = msg[3];
+ vial_key_override_entry_t entry = { 0 };
+ msg[0] = dynamic_keymap_get_key_override(idx, &entry);
+ memcpy(&msg[1], &entry, sizeof(entry));
+ break;
+ }
+ case dynamic_vial_key_override_set: {
+ uint8_t idx = msg[3];
+ vial_key_override_entry_t entry;
+ memcpy(&entry, &msg[4], sizeof(entry));
+ msg[0] = dynamic_keymap_set_key_override(idx, &entry);
+ reload_key_override();
+ break;
+ }
#endif
}
@@ -259,7 +284,7 @@ void vial_handle_cmd(uint8_t *msg, uint8_t length) {
uint16_t g_vial_magic_keycode_override;
-static void vial_keycode_down(uint16_t keycode) {
+void vial_keycode_down(uint16_t keycode) {
g_vial_magic_keycode_override = keycode;
if (keycode <= QK_MODS_MAX) {
@@ -271,7 +296,7 @@ static void vial_keycode_down(uint16_t keycode) {
}
}
-static void vial_keycode_up(uint16_t keycode) {
+void vial_keycode_up(uint16_t keycode) {
g_vial_magic_keycode_override = keycode;
if (keycode <= QK_MODS_MAX) {
@@ -283,9 +308,7 @@ static void vial_keycode_up(uint16_t keycode) {
}
}
-static void vial_keycode_tap(uint16_t keycode) __attribute__((unused));
-
-static void vial_keycode_tap(uint16_t keycode) {
+void vial_keycode_tap(uint16_t keycode) {
vial_keycode_down(keycode);
qs_wait_ms(QS_tap_code_delay);
vial_keycode_up(keycode);
@@ -544,3 +567,48 @@ bool process_record_vial(uint16_t keycode, keyrecord_t *record) {
return true;
}
+
+#ifdef VIAL_KEY_OVERRIDE_ENABLE
+static bool vial_key_override_disabled = 0;
+static key_override_t overrides[VIAL_KEY_OVERRIDE_ENTRIES] = { 0 };
+static key_override_t *override_ptrs[VIAL_KEY_OVERRIDE_ENTRIES + 1] = { 0 };
+const key_override_t **key_overrides = (const key_override_t**)override_ptrs;
+
+static int vial_get_key_override(uint8_t index, key_override_t *out) {
+ vial_key_override_entry_t entry;
+ int ret;
+ if ((ret = dynamic_keymap_get_key_override(index, &entry)) != 0)
+ return ret;
+
+ memset(out, 0, sizeof(*out));
+ out->trigger = entry.trigger;
+ out->trigger_mods = entry.trigger_mods;
+ out->layers = entry.layers;
+ out->negative_mod_mask = entry.negative_mod_mask;
+ out->suppressed_mods = entry.suppressed_mods;
+ out->replacement = entry.replacement;
+ out->options = 0;
+ uint8_t opt = entry.options;
+ if (opt & vial_ko_enabled)
+ out->enabled = NULL;
+ else
+ out->enabled = &vial_key_override_disabled;
+ /* right now these options match one-to-one so this isn't strictly necessary,
+ nevertheless future-proof the code by parsing them out to ensure "stable" abi */
+ if (opt & vial_ko_option_activation_trigger_down) out->options |= ko_option_activation_trigger_down;
+ if (opt & vial_ko_option_activation_required_mod_down) out->options |= ko_option_activation_required_mod_down;
+ if (opt & vial_ko_option_activation_negative_mod_up) out->options |= ko_option_activation_negative_mod_up;
+ if (opt & vial_ko_option_one_mod) out->options |= ko_option_one_mod;
+ if (opt & vial_ko_option_no_reregister_trigger) out->options |= ko_option_no_reregister_trigger;
+ if (opt & vial_ko_option_no_unregister_on_other_key_down) out->options |= ko_option_no_unregister_on_other_key_down;
+
+ return 0;
+}
+
+static void reload_key_override(void) {
+ for (size_t i = 0; i < VIAL_KEY_OVERRIDE_ENTRIES; ++i) {
+ override_ptrs[i] = &overrides[i];
+ vial_get_key_override(i, &overrides[i]);
+ }
+}
+#endif
diff --git a/quantum/vial.h b/quantum/vial.h
index 85d297848b..897dc94563 100644
--- a/quantum/vial.h
+++ b/quantum/vial.h
@@ -22,7 +22,7 @@
#include "eeprom.h"
#include "action.h"
-#define VIAL_PROTOCOL_VERSION ((uint32_t)0x00000004)
+#define VIAL_PROTOCOL_VERSION ((uint32_t)0x00000005)
#define VIAL_RAW_EPSIZE 32
void vial_init(void);
@@ -59,14 +59,24 @@ enum {
dynamic_vial_tap_dance_set = 0x02,
dynamic_vial_combo_get = 0x03,
dynamic_vial_combo_set = 0x04,
+ dynamic_vial_key_override_get = 0x05,
+ dynamic_vial_key_override_set = 0x06,
};
+#define VIAL_MACRO_EXT_TAP 5
+#define VIAL_MACRO_EXT_DOWN 6
+#define VIAL_MACRO_EXT_UP 7
+
+void vial_keycode_down(uint16_t keycode);
+void vial_keycode_up(uint16_t keycode);
+void vial_keycode_tap(uint16_t keycode);
+
/* Fake position in keyboard matrix, can't use 255 as that is immediately rejected by IS_NOEVENT
used to send arbitrary keycodes thru process_record_quantum_helper */
#define VIAL_MATRIX_MAGIC 254
-#ifdef TAP_DANCE_ENABLE
+#ifdef TAP_DANCE_ENABLE
#define VIAL_TAP_DANCE_ENABLE
#ifndef VIAL_TAP_DANCE_ENTRIES
@@ -95,6 +105,7 @@ _Static_assert(sizeof(vial_tap_dance_entry_t) == 10, "Unexpected size of the via
#define VIAL_TAP_DANCE_ENTRIES 0
#endif
+
#ifdef COMBO_ENABLE
#define VIAL_COMBO_ENABLE
@@ -127,3 +138,49 @@ _Static_assert(sizeof(vial_combo_entry_t) == 10, "Unexpected size of the vial_co
#undef VIAL_COMBO_ENTRIES
#define VIAL_COMBO_ENTRIES 0
#endif
+
+
+#ifdef KEY_OVERRIDE_ENABLE
+#define VIAL_KEY_OVERRIDE_ENABLE
+
+#include "process_key_override.h"
+
+#ifndef VIAL_KEY_OVERRIDE_ENTRIES
+ #if TOTAL_EEPROM_BYTE_COUNT > 4000
+ #define VIAL_KEY_OVERRIDE_ENTRIES 32
+ #elif TOTAL_EEPROM_BYTE_COUNT > 2000
+ #define VIAL_KEY_OVERRIDE_ENTRIES 16
+ #elif TOTAL_EEPROM_BYTE_COUNT > 1000
+ #define VIAL_KEY_OVERRIDE_ENTRIES 8
+ #else
+ #define VIAL_KEY_OVERRIDE_ENTRIES 4
+ #endif
+#endif
+
+/* the key override structure as it is stored in eeprom and transferred to vial-gui;
+ it is deserialized into key_override_t by vial_get_key_override */
+typedef struct {
+ uint16_t trigger;
+ uint16_t replacement;
+ uint16_t layers;
+ uint8_t trigger_mods;
+ uint8_t negative_mod_mask;
+ uint8_t suppressed_mods;
+ uint8_t options;
+} vial_key_override_entry_t;
+_Static_assert(sizeof(vial_key_override_entry_t) == 10, "Unexpected size of the vial_key_override_entry_t structure");
+
+enum {
+ vial_ko_option_activation_trigger_down = (1 << 0),
+ vial_ko_option_activation_required_mod_down = (1 << 1),
+ vial_ko_option_activation_negative_mod_up = (1 << 2),
+ vial_ko_option_one_mod = (1 << 3),
+ vial_ko_option_no_reregister_trigger = (1 << 4),
+ vial_ko_option_no_unregister_on_other_key_down = (1 << 5),
+ vial_ko_enabled = (1 << 7),
+};
+
+#else
+#undef VIAL_KEY_OVERRIDE_ENTRIES
+#define VIAL_KEY_OVERRIDE_ENTRIES 0
+#endif
diff --git a/quantum/vial_ensure_keycode.h b/quantum/vial_ensure_keycode.h
index d1ae89ef3c..91cbaebca6 100644
--- a/quantum/vial_ensure_keycode.h
+++ b/quantum/vial_ensure_keycode.h
@@ -490,3 +490,13 @@ _Static_assert(MI_MODSD == 0x5CB7, "");
_Static_assert(MI_MODSU == 0x5CB8, "");
_Static_assert(MI_BENDD == 0x5CB9, "");
_Static_assert(MI_BENDU == 0x5CBA, "");
+
+_Static_assert(KC_ASUP == 0x5C17, "");
+_Static_assert(KC_ASDN == 0x5C18, "");
+_Static_assert(KC_ASRP == 0x5C19, "");
+_Static_assert(KC_ASTG == 0x5C1A, "");
+_Static_assert(KC_ASON == 0x5C1B, "");
+_Static_assert(KC_ASOFF == 0x5C1C, "");
+_Static_assert(CMB_ON == 0x5CF7, "");
+_Static_assert(CMB_OFF == 0x5CF8, "");
+_Static_assert(CMB_TOG == 0x5CF9, "");