From 2029ed77afe94315a87c3938eea4d85822604e19 Mon Sep 17 00:00:00 2001 From: alex-ds13 <145657253+alex-ds13@users.noreply.github.com> Date: Fri, 10 Jan 2025 15:22:59 +0000 Subject: [PATCH] docs(schema): update all json schemas --- komorebi-bar/src/config.rs | 16 ++-- schema.bar.json | 184 ++++++++++++++++++++++++++++++------- 2 files changed, 160 insertions(+), 40 deletions(-) diff --git a/komorebi-bar/src/config.rs b/komorebi-bar/src/config.rs index 6462bbacd..811cc73f7 100644 --- a/komorebi-bar/src/config.rs +++ b/komorebi-bar/src/config.rs @@ -14,26 +14,26 @@ use std::path::PathBuf; #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)] /// The `komorebi.bar.json` configuration file reference for `v0.1.33` pub struct KomobarConfig { - /// Bar height + /// Bar height (default: 50) pub height: Option, /// Bar horizontal padding. Use one value for symmetric padding or use `[left, right]` to - /// specify a different padding on each side. + /// specify a different padding on each side (default: 10) pub horizontal_padding: Option, /// Bar vertical padding. Use one value for symmetric padding or use `[top, bottom]` to - /// specify a different padding on each side. + /// specify a different padding on each side (default: 10) pub vertical_padding: Option, /// Bar horizontal margin. Use one value for symmetric margin or use `[left, right]` to - /// specify a different margin on each side. + /// specify a different margin on each side (default: 0) pub horizontal_margin: Option, /// Bar vertical margin. Use one value for symmetric margin or use `[top, bottom]` to - /// specify a different margin on each side. + /// specify a different margin on each side (default: 0) pub vertical_margin: Option, /// Bar positioning options #[serde(alias = "viewport")] pub position: Option, /// Frame options (see: https://docs.rs/egui/latest/egui/containers/frame/struct.Frame.html) pub frame: Option, - /// Monitor options + /// The monitor index or the full monitor options pub monitor: MonitorConfigOrIndex, /// Font family pub font_family: Option, @@ -107,10 +107,10 @@ pub struct FrameConfig { #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)] #[serde(untagged)] pub enum MonitorConfigOrIndex { - /// A `MonitorConfig` struct with the monitor index and an optional `work_area_offset` - MonitorConfig(MonitorConfig), /// The monitor index where you want the bar to show Index(usize), + /// The full monitor options with the index and an optional work_area_offset + MonitorConfig(MonitorConfig), } #[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)] diff --git a/schema.bar.json b/schema.bar.json index af7dd93af..53f1b2215 100644 --- a/schema.bar.json +++ b/schema.bar.json @@ -1186,6 +1186,63 @@ } ] }, + "height": { + "description": "Bar height (default: 50)", + "type": "number", + "format": "float" + }, + "horizontal_margin": { + "description": "Bar horizontal margin. Use one value for symmetric margin or use `[left, right]` to specify a different margin on each side (default: 0)", + "anyOf": [ + { + "description": "A symmetric spacing on some axis (horizontal or vertical), with the same size on both sides", + "type": "number", + "format": "float" + }, + { + "description": "A detailed spacing on some axis (horizontal or vertical), with a size for each side. If an horizontal spacing, then it will be (left, right), if vertical it will be (top, bottom)", + "type": "array", + "items": [ + { + "type": "number", + "format": "float" + }, + { + "type": "number", + "format": "float" + } + ], + "maxItems": 2, + "minItems": 2 + } + ] + }, + "horizontal_padding": { + "description": "Bar horizontal padding. Use one value for symmetric padding or use `[left, right]` to specify a different padding on each side (default: 10)", + "anyOf": [ + { + "description": "A symmetric spacing on some axis (horizontal or vertical), with the same size on both sides", + "type": "number", + "format": "float" + }, + { + "description": "A detailed spacing on some axis (horizontal or vertical), with a size for each side. If an horizontal spacing, then it will be (left, right), if vertical it will be (top, bottom)", + "type": "array", + "items": [ + { + "type": "number", + "format": "float" + }, + { + "type": "number", + "format": "float" + } + ], + "maxItems": 2, + "minItems": 2 + } + ] + }, "icon_scale": { "description": "Scale of the icons relative to the font_size [[1.0-2.0]]. (default: 1.4)", "type": "number", @@ -2034,51 +2091,62 @@ "format": "float" }, "monitor": { - "description": "Monitor options", - "type": "object", - "required": [ - "index" - ], - "properties": { - "index": { - "description": "Komorebi monitor index of the monitor on which to render the bar", + "description": "The monitor index or the full monitor options", + "anyOf": [ + { + "description": "The monitor index where you want the bar to show", "type": "integer", "format": "uint", "minimum": 0.0 }, - "work_area_offset": { - "description": "Automatically apply a work area offset for this monitor to accommodate the bar", + { + "description": "The full monitor options with the index and an optional work_area_offset", "type": "object", "required": [ - "bottom", - "left", - "right", - "top" + "index" ], "properties": { - "bottom": { - "description": "The bottom point in a Win32 Rect", - "type": "integer", - "format": "int32" - }, - "left": { - "description": "The left point in a Win32 Rect", + "index": { + "description": "Komorebi monitor index of the monitor on which to render the bar", "type": "integer", - "format": "int32" - }, - "right": { - "description": "The right point in a Win32 Rect", - "type": "integer", - "format": "int32" + "format": "uint", + "minimum": 0.0 }, - "top": { - "description": "The top point in a Win32 Rect", - "type": "integer", - "format": "int32" + "work_area_offset": { + "description": "Automatically apply a work area offset for this monitor to accommodate the bar", + "type": "object", + "required": [ + "bottom", + "left", + "right", + "top" + ], + "properties": { + "bottom": { + "description": "The bottom point in a Win32 Rect", + "type": "integer", + "format": "int32" + }, + "left": { + "description": "The left point in a Win32 Rect", + "type": "integer", + "format": "int32" + }, + "right": { + "description": "The right point in a Win32 Rect", + "type": "integer", + "format": "int32" + }, + "top": { + "description": "The top point in a Win32 Rect", + "type": "integer", + "format": "int32" + } + } } } } - } + ] }, "position": { "description": "Bar positioning options", @@ -3343,6 +3411,58 @@ "format": "uint8", "minimum": 0.0 }, + "vertical_margin": { + "description": "Bar vertical margin. Use one value for symmetric margin or use `[top, bottom]` to specify a different margin on each side (default: 0)", + "anyOf": [ + { + "description": "A symmetric spacing on some axis (horizontal or vertical), with the same size on both sides", + "type": "number", + "format": "float" + }, + { + "description": "A detailed spacing on some axis (horizontal or vertical), with a size for each side. If an horizontal spacing, then it will be (left, right), if vertical it will be (top, bottom)", + "type": "array", + "items": [ + { + "type": "number", + "format": "float" + }, + { + "type": "number", + "format": "float" + } + ], + "maxItems": 2, + "minItems": 2 + } + ] + }, + "vertical_padding": { + "description": "Bar vertical padding. Use one value for symmetric padding or use `[top, bottom]` to specify a different padding on each side (default: 10)", + "anyOf": [ + { + "description": "A symmetric spacing on some axis (horizontal or vertical), with the same size on both sides", + "type": "number", + "format": "float" + }, + { + "description": "A detailed spacing on some axis (horizontal or vertical), with a size for each side. If an horizontal spacing, then it will be (left, right), if vertical it will be (top, bottom)", + "type": "array", + "items": [ + { + "type": "number", + "format": "float" + }, + { + "type": "number", + "format": "float" + } + ], + "maxItems": 2, + "minItems": 2 + } + ] + }, "widget_spacing": { "description": "Spacing between widgets (default: 10.0)", "type": "number",