From c01a3cfacaf6ce39b23ec81270549734b6ca1c71 Mon Sep 17 00:00:00 2001
From: James Young <18669334+noroadsleft@users.noreply.github.com>
Date: Thu, 22 Jun 2023 09:31:34 -0700
Subject: [PATCH] Viktus OSAv2 Numpad Community Layout Support and Configurator
 Touch-Up (#21342)

* [style] sort JSON keys in layout objects

* [chore] correct layout data

* [refactor] rename LAYOUT_all_split to LAYOUT_ortho_5x4

* [refactor] rename LAYOUT_2u_plus_2u_enter_2u_zero to LAYOUT_numpad_5x4

* [enhancement] enable Community Layout support
---
 keyboards/viktus/osav2_numpad/info.json       | 44 +++++++++++--------
 .../osav2_numpad/keymaps/default/keymap.c     |  2 +-
 .../viktus/osav2_numpad/keymaps/via/keymap.c  |  2 +-
 3 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/keyboards/viktus/osav2_numpad/info.json b/keyboards/viktus/osav2_numpad/info.json
index d347631ccc..941d65f367 100644
--- a/keyboards/viktus/osav2_numpad/info.json
+++ b/keyboards/viktus/osav2_numpad/info.json
@@ -39,8 +39,16 @@
             "twinkle": true
         }
     },
+    "layout_aliases": {
+        "LAYOUT_all_split": "LAYOUT_ortho_5x4",
+        "LAYOUT_2u_plus_2u_enter_2u_zero": "LAYOUT_numpad_5x4"
+    },
+    "community_layouts": [
+        "ortho_5x4",
+        "numpad_5x4"
+    ],
     "layouts": {
-        "LAYOUT_all_split": {
+        "LAYOUT_ortho_5x4": {
             "layout": [
                 {"label": "K00", "matrix": [0, 0], "x": 0, "y": 0},
                 {"label": "K01", "matrix": [0, 1], "x": 1, "y": 0},
@@ -84,7 +92,7 @@
                 {"label": "K40", "matrix": [4, 0], "x": 0, "y": 4},
                 {"label": "K41", "matrix": [4, 1], "x": 1, "y": 4},
                 {"label": "K42", "matrix": [4, 2], "x": 2, "y": 4},
-                {"label": "K43", "matrix": [4, 3], "h": 2, "x": 3, "y": 3}
+                {"label": "K43", "matrix": [4, 3], "x": 3, "y": 3, "h": 2}
             ]
         },
         "LAYOUT_2u_plus_2u_enter": {
@@ -99,14 +107,14 @@
                 {"label": "K20", "matrix": [2, 0], "x": 0, "y": 2},
                 {"label": "K21", "matrix": [2, 1], "x": 1, "y": 2},
                 {"label": "K22", "matrix": [2, 2], "x": 2, "y": 2},
-                {"label": "K23", "matrix": [2, 3], "h": 2, "x": 3, "y": 1},
+                {"label": "K23", "matrix": [2, 3], "x": 3, "y": 1, "h": 2},
                 {"label": "K30", "matrix": [3, 0], "x": 0, "y": 3},
                 {"label": "K31", "matrix": [3, 1], "x": 1, "y": 3},
                 {"label": "K32", "matrix": [3, 2], "x": 2, "y": 3},
                 {"label": "K40", "matrix": [4, 0], "x": 0, "y": 4},
                 {"label": "K41", "matrix": [4, 1], "x": 1, "y": 4},
                 {"label": "K42", "matrix": [4, 2], "x": 2, "y": 4},
-                {"label": "K43", "matrix": [4, 3], "h": 2, "x": 3, "y": 3}
+                {"label": "K43", "matrix": [4, 3], "x": 3, "y": 3, "h": 2}
             ]
         },
         "LAYOUT_2u_enter_2u_zero": {
@@ -126,12 +134,12 @@
                 {"label": "K30", "matrix": [3, 0], "x": 0, "y": 3},
                 {"label": "K31", "matrix": [3, 1], "x": 1, "y": 3},
                 {"label": "K32", "matrix": [3, 2], "x": 2, "y": 3},
-                {"label": "K41", "matrix": [4, 1], "h": 2, "x": 0, "y": 4},
+                {"label": "K41", "matrix": [4, 1], "x": 0, "y": 4, "w": 2},
                 {"label": "K42", "matrix": [4, 2], "x": 2, "y": 4},
-                {"label": "K43", "matrix": [4, 3], "h": 2, "x": 3, "y": 3}
+                {"label": "K43", "matrix": [4, 3], "x": 3, "y": 3, "h": 2}
             ]
         },
-        "LAYOUT_2u_plus_2u_enter_2u_zero": {
+        "LAYOUT_numpad_5x4": {
             "layout": [
                 {"label": "K00", "matrix": [0, 0], "x": 0, "y": 0},
                 {"label": "K01", "matrix": [0, 1], "x": 1, "y": 0},
@@ -143,13 +151,13 @@
                 {"label": "K20", "matrix": [2, 0], "x": 0, "y": 2},
                 {"label": "K21", "matrix": [2, 1], "x": 1, "y": 2},
                 {"label": "K22", "matrix": [2, 2], "x": 2, "y": 2},
-                {"label": "K23", "matrix": [2, 3], "h": 2, "x": 3, "y": 1},
+                {"label": "K23", "matrix": [2, 3], "x": 3, "y": 1, "h": 2},
                 {"label": "K30", "matrix": [3, 0], "x": 0, "y": 3},
                 {"label": "K31", "matrix": [3, 1], "x": 1, "y": 3},
                 {"label": "K32", "matrix": [3, 2], "x": 2, "y": 3},
-                {"label": "K41", "matrix": [4, 1], "h": 2, "x": 0, "y": 4},
+                {"label": "K41", "matrix": [4, 1], "x": 0, "y": 4, "w": 2},
                 {"label": "K42", "matrix": [4, 2], "x": 2, "y": 4},
-                {"label": "K43", "matrix": [4, 3], "h": 2, "x": 3, "y": 3}
+                {"label": "K43", "matrix": [4, 3], "x": 3, "y": 3, "h": 2}
             ]
         },
         "LAYOUT_mirrored_2u_enter": {
@@ -169,7 +177,7 @@
                 {"label": "K31", "matrix": [3, 1], "x": 1, "y": 3},
                 {"label": "K32", "matrix": [3, 2], "x": 2, "y": 3},
                 {"label": "K33", "matrix": [3, 3], "x": 3, "y": 3},
-                {"label": "K40", "matrix": [4, 0], "h": 2, "x": 0, "y": 3},
+                {"label": "K40", "matrix": [4, 0], "x": 0, "y": 3, "h": 2},
                 {"label": "K41", "matrix": [4, 1], "x": 1, "y": 4},
                 {"label": "K42", "matrix": [4, 2], "x": 2, "y": 4},
                 {"label": "K43", "matrix": [4, 3], "x": 3, "y": 4}
@@ -184,14 +192,14 @@
                 {"label": "K11", "matrix": [1, 1], "x": 1, "y": 1},
                 {"label": "K12", "matrix": [1, 2], "x": 2, "y": 1},
                 {"label": "K13", "matrix": [1, 3], "x": 3, "y": 1},
-                {"label": "K20", "matrix": [2, 0], "h": 2, "x": 0, "y": 1},
+                {"label": "K20", "matrix": [2, 0], "x": 0, "y": 1, "h": 2},
                 {"label": "K21", "matrix": [2, 1], "x": 1, "y": 2},
                 {"label": "K22", "matrix": [2, 2], "x": 2, "y": 2},
                 {"label": "K23", "matrix": [2, 3], "x": 3, "y": 2},
                 {"label": "K31", "matrix": [3, 1], "x": 1, "y": 3},
                 {"label": "K32", "matrix": [3, 2], "x": 2, "y": 3},
                 {"label": "K33", "matrix": [3, 3], "x": 3, "y": 3},
-                {"label": "K40", "matrix": [4, 0], "h": 2, "x": 0, "y": 3},
+                {"label": "K40", "matrix": [4, 0], "x": 0, "y": 3, "h": 2},
                 {"label": "K41", "matrix": [4, 1], "x": 1, "y": 4},
                 {"label": "K42", "matrix": [4, 2], "x": 2, "y": 4},
                 {"label": "K43", "matrix": [4, 3], "x": 3, "y": 4}
@@ -214,9 +222,9 @@
                 {"label": "K31", "matrix": [3, 1], "x": 1, "y": 3},
                 {"label": "K32", "matrix": [3, 2], "x": 2, "y": 3},
                 {"label": "K33", "matrix": [3, 3], "x": 3, "y": 3},
-                {"label": "K40", "matrix": [4, 0], "h": 2, "x": 0, "y": 3},
+                {"label": "K40", "matrix": [4, 0], "x": 0, "y": 3, "h": 2},
                 {"label": "K41", "matrix": [4, 1], "x": 1, "y": 4},
-                {"label": "K42", "matrix": [4, 2], "w": 2, "x": 2, "y": 4}
+                {"label": "K42", "matrix": [4, 2], "x": 2, "y": 4, "w": 2}
             ]
         },
         "LAYOUT_mirrored_2u_plus_2u_enter_2u_zero": {
@@ -228,16 +236,16 @@
                 {"label": "K11", "matrix": [1, 1], "x": 1, "y": 1},
                 {"label": "K12", "matrix": [1, 2], "x": 2, "y": 1},
                 {"label": "K13", "matrix": [1, 3], "x": 3, "y": 1},
-                {"label": "K20", "matrix": [2, 0], "h": 2, "x": 0, "y": 1},
+                {"label": "K20", "matrix": [2, 0], "x": 0, "y": 1, "h": 2},
                 {"label": "K21", "matrix": [2, 1], "x": 1, "y": 2},
                 {"label": "K22", "matrix": [2, 2], "x": 2, "y": 2},
                 {"label": "K23", "matrix": [2, 3], "x": 3, "y": 2},
                 {"label": "K31", "matrix": [3, 1], "x": 1, "y": 3},
                 {"label": "K32", "matrix": [3, 2], "x": 2, "y": 3},
                 {"label": "K33", "matrix": [3, 3], "x": 3, "y": 3},
-                {"label": "K40", "matrix": [4, 0], "h": 2, "x": 0, "y": 3},
+                {"label": "K40", "matrix": [4, 0], "x": 0, "y": 3, "h": 2},
                 {"label": "K41", "matrix": [4, 1], "x": 1, "y": 4},
-                {"label": "K42", "matrix": [4, 2], "w": 2, "x": 2, "y": 4}
+                {"label": "K42", "matrix": [4, 2], "x": 2, "y": 4, "w": 2}
             ]
         }
     }
diff --git a/keyboards/viktus/osav2_numpad/keymaps/default/keymap.c b/keyboards/viktus/osav2_numpad/keymaps/default/keymap.c
index ce8a1d2774..ac99f1d8c7 100644
--- a/keyboards/viktus/osav2_numpad/keymaps/default/keymap.c
+++ b/keyboards/viktus/osav2_numpad/keymaps/default/keymap.c
@@ -17,7 +17,7 @@
 #include QMK_KEYBOARD_H
 
 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-    [0] = LAYOUT_all_split(
+    [0] = LAYOUT_ortho_5x4(
         KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
         KC_P7,  KC_P8,   KC_P9,   KC_PPLS,
         KC_P4,  KC_P5,   KC_P6,   KC_PEQL,
diff --git a/keyboards/viktus/osav2_numpad/keymaps/via/keymap.c b/keyboards/viktus/osav2_numpad/keymaps/via/keymap.c
index ce8a1d2774..ac99f1d8c7 100644
--- a/keyboards/viktus/osav2_numpad/keymaps/via/keymap.c
+++ b/keyboards/viktus/osav2_numpad/keymaps/via/keymap.c
@@ -17,7 +17,7 @@
 #include QMK_KEYBOARD_H
 
 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-    [0] = LAYOUT_all_split(
+    [0] = LAYOUT_ortho_5x4(
         KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
         KC_P7,  KC_P8,   KC_P9,   KC_PPLS,
         KC_P4,  KC_P5,   KC_P6,   KC_PEQL,