{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "description": "Pointer to the schema against which this document should be validated.",
      "type": "string"
    },
    "control-center-exclusive-zone": {
      "default": true,
      "description": "Whether or not the control center should follow the compositors exclusive zones. An example would be setting it to \"false\" to cover your panel/dock.",
      "type": "boolean"
    },
    "control-center-height": {
      "default": 600,
      "description": "Height of the control center in pixels. Ignored when 'fit-to-screen' is set to 'true'",
      "minimum": 300,
      "type": "integer"
    },
    "control-center-layer": {
      "default": "none",
      "description": "Layer of control center window",
      "enum": [
        "background",
        "bottom",
        "top",
        "overlay",
        "none"
      ],
      "type": "string"
    },
    "control-center-margin-bottom": {
      "default": 0,
      "description": "The margin (in pixels) at the bottom of the control center. 0 to disable",
      "type": "integer"
    },
    "control-center-margin-left": {
      "default": 0,
      "description": "The margin (in pixels) at the left of the control center. 0 to disable",
      "type": "integer"
    },
    "control-center-margin-right": {
      "default": 0,
      "description": "The margin (in pixels) at the right of the control center. 0 to disable",
      "type": "integer"
    },
    "control-center-margin-top": {
      "default": 0,
      "description": "The margin (in pixels) at the top of the control center. 0 to disable",
      "type": "integer"
    },
    "control-center-positionX": {
      "default": "none",
      "description": "Optional: Horizontal position of the control center. Supersedes positionX if not set to `none`",
      "enum": [
        "right",
        "left",
        "center",
        "none"
      ],
      "type": "string"
    },
    "control-center-positionY": {
      "default": "none",
      "description": "Optional: Vertical position of the control center. Supersedes positionY if not set to `none`",
      "enum": [
        "top",
        "bottom",
        "none"
      ],
      "type": "string"
    },
    "control-center-width": {
      "default": 500,
      "description": "Width of the control center in pixels",
      "minimum": 300,
      "type": "integer"
    },
    "cssPriority": {
      "default": "application",
      "description": "Which GTK priority to use when loading the default and user CSS files. Pick \"user\" to override XDG_CONFIG_HOME/gtk-3.0/gtk.css",
      "enum": [
        "application",
        "user"
      ],
      "type": "string"
    },
    "fit-to-screen": {
      "default": true,
      "description": "If the control center should expand to both edges of the screen",
      "type": "boolean"
    },
    "hide-on-action": {
      "default": true,
      "description": "Hides the control center when clicking on notification action",
      "type": "boolean"
    },
    "hide-on-clear": {
      "default": false,
      "description": "Hides the control center after pressing \"Clear All\"",
      "type": "boolean"
    },
    "image-visibility": {
      "default": "when-available",
      "description": "The notification image visibility when no icon is available.",
      "enum": [
        "always",
        "when-available",
        "never"
      ],
      "type": "string"
    },
    "keyboard-shortcuts": {
      "default": true,
      "description": "If control center should use keyboard shortcuts",
      "type": "boolean"
    },
    "layer": {
      "default": "overlay",
      "description": "Layer of notification window",
      "enum": [
        "background",
        "bottom",
        "top",
        "overlay"
      ],
      "type": "string"
    },
    "layer-shell": {
      "default": true,
      "description": "Wether or not the windows should be opened as layer-shell surfaces. Note: Requires swaync restart to apply",
      "type": "boolean"
    },
    "notification-2fa-action": {
      "default": true,
      "description": "If each notification should display a 'COPY \"1234\"' action",
      "type": "boolean"
    },
    "notification-body-image-height": {
      "default": 100,
      "description": "The notification body image height (in pixels)",
      "minimum": 100,
      "type": "integer"
    },
    "notification-body-image-width": {
      "default": 200,
      "description": "The notification body image width (in pixels)",
      "minimum": 200,
      "type": "integer"
    },
    "notification-icon-size": {
      "default": 64,
      "description": "The notification icon size (in pixels). The app icon size is 1/3",
      "minimum": 16,
      "type": "integer"
    },
    "notification-inline-replies": {
      "default": false,
      "description": "If notifications should display a text field to reply if the sender requests it. NOTE: Replying in popup notifications is only available if the compositor supports GTK Layer-Shell ON_DEMAND keyboard interactivity.",
      "type": "boolean"
    },
    "notification-visibility": {
      "additionalProperties": false,
      "description": "Set the visibility of each incoming notification. If the notification doesn't include one of the properties, that property will be ignored. All properties (except for state) use regex. If all properties match the given notification, the notification will be follow the provided state. Only the first matching object will be used.",
      "minProperties": 1,
      "patternProperties": {
        "^.{1,}$": {
          "additionalProperties": false,
          "description": "Your script object.",
          "minProperties": 2,
          "properties": {
            "app-name": {
              "description": "The app-name. Uses Regex.",
              "type": "string"
            },
            "body": {
              "description": "The body of the notification. Uses Regex.",
              "type": "string"
            },
            "category": {
              "description": "Which category the notification belongs to. Uses Regex.",
              "type": "string"
            },
            "desktop-entry": {
              "description": "The desktop-entry. Uses Regex.",
              "type": "string"
            },
            "override-urgency": {
              "default": "unset",
              "description": "The new urgency of the notification (optional)",
              "enum": [
                "unset",
                "low",
                "normal",
                "critical"
              ],
              "type": "string"
            },
            "state": {
              "default": "enabled",
              "description": "The notification visibility state.",
              "enum": [
                "ignored",
                "muted",
                "enabled",
                "transient"
              ],
              "type": "string"
            },
            "summary": {
              "description": "The summary of the notification. Uses Regex.",
              "type": "string"
            },
            "urgency": {
              "default": "Normal",
              "description": "The urgency of the notification.",
              "enum": [
                "Low",
                "Normal",
                "Critical"
              ],
              "type": "string"
            }
          },
          "required": [
            "state"
          ],
          "type": "object"
        }
      },
      "type": "object"
    },
    "notification-window-width": {
      "default": 500,
      "description": "Width of the notification in pixels",
      "type": "integer"
    },
    "positionX": {
      "default": "right",
      "description": "Horizontal position of control center and notification window",
      "enum": [
        "right",
        "left",
        "center"
      ],
      "type": "string"
    },
    "positionY": {
      "default": "top",
      "description": "Vertical position of control center and notification window",
      "enum": [
        "top",
        "center",
        "bottom"
      ],
      "type": "string"
    },
    "relative-timestamps": {
      "default": true,
      "description": "Display notification timestamps relative to now e.g. \"26 minutes ago\". If false, a local iso8601-formatted absolute timestamp is displayed.",
      "type": "boolean"
    },
    "script-fail-notify": {
      "default": true,
      "description": "Sends a notification if a script fails to run",
      "type": "boolean"
    },
    "scripts": {
      "additionalProperties": false,
      "description": "Which scripts to check and potentially run for every notification. If the notification doesn't include one of the properties, that property will be ignored. All properties (except for exec) use regex. If all properties match the given notification, the script will be run. Only the first matching script will be run.",
      "minProperties": 1,
      "patternProperties": {
        "^.{1,}$": {
          "additionalProperties": false,
          "description": "Your script object.",
          "minProperties": 2,
          "properties": {
            "app-name": {
              "description": "The app-name. Uses Regex.",
              "type": "string"
            },
            "body": {
              "description": "The body of the notification. Uses Regex.",
              "type": "string"
            },
            "category": {
              "description": "Which category the notification belongs to. Uses Regex.",
              "type": "string"
            },
            "desktop-entry": {
              "description": "The desktop-entry. Uses Regex.",
              "type": "string"
            },
            "exec": {
              "description": "The script to run. Can also run regular shell commands.",
              "type": "string"
            },
            "run-on": {
              "default": "receive",
              "description": "Whether to run the script on an action being activated, or when the notification is received.",
              "enum": [
                "action",
                "receive"
              ],
              "type": "string"
            },
            "summary": {
              "description": "The summary of the notification. Uses Regex.",
              "type": "string"
            },
            "urgency": {
              "default": "Normal",
              "description": "The urgency of the notification.",
              "enum": [
                "Low",
                "Normal",
                "Critical"
              ],
              "type": "string"
            }
          },
          "required": [
            "exec"
          ],
          "type": "object"
        }
      },
      "type": "object"
    },
    "timeout": {
      "default": 10,
      "description": "The notification timeout for notifications with normal priority",
      "type": "integer"
    },
    "timeout-critical": {
      "default": 0,
      "description": "The notification timeout for notifications with critical priority. 0 to disable",
      "type": "integer"
    },
    "timeout-low": {
      "default": 5,
      "description": "The notification timeout for notifications with low priority",
      "type": "integer"
    },
    "transition-time": {
      "default": 200,
      "description": "The notification animation duration. 0 to disable",
      "type": "integer"
    },
    "widget-config": {
      "$comment": "New widgets go here in \"patternProperties\" \u2193",
      "additionalProperties": false,
      "description": "Configure specific widget properties.",
      "patternProperties": {
        "^backlight(#[a-zA-Z0-9_-]{1,}){0,1}?$": {
          "$ref": "#/widgets/backlight"
        },
        "^buttons-grid(#[a-zA-Z0-9_-]{1,}){0,1}?$": {
          "$ref": "#/widgets/buttons-grid"
        },
        "^dnd(#[a-zA-Z0-9_-]{1,}){0,1}?$": {
          "$ref": "#/widgets/dnd"
        },
        "^inhibitors(#[a-zA-Z0-9_-]{1,}){0,1}?$": {
          "$comment": "References the widget structure from \"widgets\" below",
          "$ref": "#/widgets/inhibitors"
        },
        "^label(#[a-zA-Z0-9_-]{1,}){0,1}?$": {
          "$ref": "#/widgets/label"
        },
        "^menubar(#[a-zA-Z0-9_-]{1,}){0,1}?$": {
          "$ref": "#/widgets/menubar"
        },
        "^mpris(#[a-zA-Z0-9_-]{1,}){0,1}?$": {
          "$ref": "#/widgets/mpris"
        },
        "^title(#[a-zA-Z0-9_-]{1,}){0,1}?$": {
          "$comment": "References the widget structure from \"widgets\" below",
          "$ref": "#/widgets/title"
        },
        "^volume(#[a-zA-Z0-9_-]{1,}){0,1}?$": {
          "$ref": "#/widgets/volume"
        }
      },
      "type": "object"
    },
    "widgets": {
      "default": [
        "inhibitors",
        "title",
        "dnd",
        "notifications"
      ],
      "description": "Which order and which widgets to display. If the \"notifications\" widget isn't specified, it will be placed at the bottom.",
      "items": {
        "$comment": "Sadly can't use regex and enums at the same time. Fix in the future?",
        "pattern": "^[a-zA-Z0-9_-]{1,}(#[a-zA-Z0-9_-]{1,}){0,1}?$",
        "type": "string"
      },
      "type": "array"
    }
  },
  "title": "SwayNotificationCenter JSON schema",
  "type": "object",
  "widgets": {
    "$comment": "New widgets go here",
    "backlight": {
      "additionalProperties": false,
      "description": "Slider to control monitor brightness",
      "properties": {
        "device": {
          "default": "intel_backlight",
          "description": "Name of monitor (find possible devices using `ls /sys/class/backlight` or `ls /sys/class/leds`)",
          "type": "string"
        },
        "label": {
          "default": "Brightness",
          "description": "Text displayed in front of the backlight slider",
          "type": "string"
        },
        "min": {
          "default": 0,
          "description": "Lowest possible value for brightness",
          "type": "integer"
        },
        "subsystem": {
          "default": "backlight",
          "description": "Kernel subsystem for brightness control",
          "enum": [
            "backlight",
            "leds"
          ],
          "type": "string"
        }
      },
      "type": "object"
    },
    "buttons-grid": {
      "additionalProperties": false,
      "description": "A widget to add a grid of buttons that execute shell commands",
      "properties": {
        "actions": {
          "description": "A list of actions containing a label and a command",
          "items": {
            "properties": {
              "active": {
                "default": false,
                "description": "Wether the toggle button is active as default or not",
                "type": "boolean"
              },
              "command": {
                "default": "",
                "description": "Command to be executed on click",
                "type": "string"
              },
              "label": {
                "default": "label",
                "description": "Text to be displayed in button",
                "type": "string"
              },
              "type": {
                "default": "normal",
                "description": "Type of the button; toggle buttons receive the .active css class and an env variable 'SWAYNC_TOGGLE_STATE' is set. See example in the default config.json",
                "enum": [
                  "normal",
                  "toggle"
                ],
                "type": "string"
              },
              "update-command": {
                "default": "",
                "description": "Command to be executed on visibility change of cc to update the active state of the toggle button (should echo true or false)",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "array"
        }
      },
      "type": "object"
    },
    "dnd": {
      "additionalProperties": false,
      "description": "Control Center Do Not Disturb Widget",
      "properties": {
        "text": {
          "default": "Do Not Disturb",
          "description": "The title of the widget",
          "type": "string"
        }
      },
      "type": "object"
    },
    "inhibitors": {
      "additionalProperties": false,
      "description": "Control Center Inhibitors Widget",
      "properties": {
        "button-text": {
          "default": "Clear All",
          "description": "\"Clear All\" button text",
          "type": "string"
        },
        "clear-all-button": {
          "default": true,
          "description": "Wether to display a \"Clear All\" button",
          "type": "boolean"
        },
        "text": {
          "default": "Inhibitors",
          "description": "The title of the widget",
          "type": "string"
        }
      },
      "type": "object"
    },
    "label": {
      "additionalProperties": false,
      "description": "A generic widget that allows the user to add custom text",
      "properties": {
        "max-lines": {
          "default": 5,
          "description": "The maximum lines",
          "type": "integer"
        },
        "text": {
          "default": "Label Text",
          "description": "The text content of the widget",
          "type": "string"
        }
      },
      "type": "object"
    },
    "menubar": {
      "additionalProperties": false,
      "description": "A bar that contains action-buttons and buttons to open a dropdown with action-buttons",
      "patternProperties": {
        "^buttons(#[a-zA-Z0-9_-]{1,}){0,1}?$": {
          "additionalProperties": false,
          "description": "A list of action-buttons to be displayed in the topbar",
          "properties": {
            "actions": {
              "$ref": "#/widgets/buttons-grid/properties/actions"
            },
            "position": {
              "default": "right",
              "description": "Horizontal position of the button in the bar",
              "enum": [
                "right",
                "left"
              ],
              "type": "string"
            }
          },
          "type": "object"
        },
        "^menu(#[a-zA-Z0-9_-]{1,}){0,1}?$": {
          "additionalProperties": false,
          "description": "A button that opens a dropdown with action-buttons",
          "properties": {
            "actions": {
              "$ref": "#/widgets/buttons-grid/properties/actions"
            },
            "animation-duration": {
              "default": 250,
              "description": "Duration of animation in milliseconds",
              "type": "integer"
            },
            "animation-type": {
              "default": "slide_down",
              "description": "Animation type for menu",
              "enum": [
                "slide_down",
                "slide_up",
                "none"
              ],
              "type": "string"
            },
            "label": {
              "default": "Menu",
              "description": "Text to be displayed in button",
              "type": "string"
            },
            "position": {
              "default": "right",
              "description": "Horizontal position of the button in the bar",
              "enum": [
                "right",
                "left"
              ],
              "type": "string"
            }
          },
          "type": "object"
        }
      },
      "type": "object"
    },
    "mpris": {
      "additionalProperties": false,
      "description": "A widget that displays multiple music players",
      "properties": {
        "blur": {
          "default": true,
          "description": "Appy the artwork as the MPRIS background and blur it",
          "type": "boolean"
        },
        "image-radius": {
          "default": 12,
          "description": "The border radius of the album art. Will be overriden by setting the border-radius in the style.css for the \".widget-mpris-album-art\" class",
          "type": "integer"
        },
        "image-size": {
          "default": 96,
          "description": "The size of the album art",
          "type": "integer"
        }
      },
      "type": "object"
    },
    "title": {
      "additionalProperties": false,
      "description": "Control Center Title Widget",
      "properties": {
        "button-text": {
          "default": "Clear All",
          "description": "\"Clear All\" button text",
          "type": "string"
        },
        "clear-all-button": {
          "default": true,
          "description": "Wether to display a \"Clear All\" button",
          "type": "boolean"
        },
        "text": {
          "default": "Notifications",
          "description": "The title of the widget",
          "type": "string"
        }
      },
      "type": "object"
    },
    "volume": {
      "additionalProperties": false,
      "description": "Slider to control pulse volume",
      "properties": {
        "animation-duration": {
          "default": 250,
          "description": "Duration of animation in milliseconds",
          "type": "integer"
        },
        "animation-type": {
          "default": "slide_down",
          "description": "Animation type for menu",
          "enum": [
            "slide_down",
            "slide_up",
            "none"
          ],
          "type": "string"
        },
        "collapse-button-label": {
          "default": "\u21e9",
          "description": "Label displayed on button to hide per app volume control",
          "type": "string"
        },
        "empty-list-label": {
          "default": "No active sink input",
          "description": "Text displayed when there are not active sink inputs",
          "type": "string"
        },
        "expand-button-label": {
          "default": "\u21e7",
          "description": "Label displayed on button to show per app volume control",
          "type": "string"
        },
        "icon-size": {
          "default": 24,
          "description": "Size of the application icon in per app volume control",
          "type": "integer"
        },
        "label": {
          "default": "Volume",
          "description": "Text displayed in front of the volume slider",
          "type": "string"
        },
        "show-per-app": {
          "default": false,
          "description": "Show per app volume control",
          "type": "boolean"
        },
        "show-per-app-icon": {
          "default": true,
          "description": "Show application icon in per app control",
          "type": "boolean"
        },
        "show-per-app-label": {
          "default": false,
          "description": "Show application name in per app control",
          "type": "boolean"
        }
      },
      "type": "object"
    }
  }
}