{
  "title": "Coding layers (Tab symbols, Right Option numbers, Caps Esc/Ctrl)",
  "rules": [
    {
      "description": "Tab held = symbol layer for coding (UK & US layouts)",
      "manipulators": [
        {
          "from": {
            "key_code": "tab",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "set_variable": {
                "name": "symbol_layer",
                "value": 1
              }
            }
          ],
          "to_after_key_up": [
            {
              "set_variable": {
                "name": "symbol_layer",
                "value": 0
              }
            }
          ],
          "to_if_alone": [
            {
              "key_code": "tab"
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "y",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "backslash"
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "u",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "6",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "i",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "7",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "o",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "8",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "p",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "backslash",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "h",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "hyphen",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "j",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "9",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "k",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "0",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "l",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "open_bracket",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "semicolon",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "close_bracket",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "n",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "equal_sign"
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "m",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "open_bracket"
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "comma",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "close_bracket"
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "period",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "comma",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "slash",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "period",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "w",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "2",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            },
            {
              "input_sources": [
                {
                  "input_source_id": "^com\\.apple\\.keylayout\\.British"
                }
              ],
              "type": "input_source_if"
            }
          ],
          "from": {
            "key_code": "e",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "3",
              "modifiers": [
                "left_option"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "e",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "3",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "r",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "4",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "t",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "5",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "f",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "1",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "d",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "equal_sign",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "g",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "grave_accent_and_tilde",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "name": "symbol_layer",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "b",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "grave_accent_and_tilde"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "Right Option held = numbers: a s d f g h j k = 1 2 3 4 5 6 7 8, m , = 9 0",
      "manipulators": [
        {
          "from": {
            "key_code": "a",
            "modifiers": {
              "mandatory": [
                "right_option"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "1"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "s",
            "modifiers": {
              "mandatory": [
                "right_option"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "2"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "d",
            "modifiers": {
              "mandatory": [
                "right_option"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "3"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f",
            "modifiers": {
              "mandatory": [
                "right_option"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "4"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "g",
            "modifiers": {
              "mandatory": [
                "right_option"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "5"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "h",
            "modifiers": {
              "mandatory": [
                "right_option"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "6"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "j",
            "modifiers": {
              "mandatory": [
                "right_option"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "7"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "k",
            "modifiers": {
              "mandatory": [
                "right_option"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "8"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "m",
            "modifiers": {
              "mandatory": [
                "right_option"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "9"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "comma",
            "modifiers": {
              "mandatory": [
                "right_option"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "0"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "Caps Lock: tap for Escape, hold for Control",
      "manipulators": [
        {
          "from": {
            "key_code": "caps_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_control"
            }
          ],
          "to_if_alone": [
            {
              "key_code": "escape"
            }
          ],
          "type": "basic"
        }
      ]
    }
  ]
}