Skip to content

Commit

Permalink
docs(schema): update all json schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-ds13 committed Jan 10, 2025
1 parent a9c2e6d commit 2029ed7
Show file tree
Hide file tree
Showing 2 changed files with 160 additions and 40 deletions.
16 changes: 8 additions & 8 deletions komorebi-bar/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<f32>,
/// 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<SpacingAxisConfig>,
/// 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<SpacingAxisConfig>,
/// 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<SpacingAxisConfig>,
/// 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<SpacingAxisConfig>,
/// Bar positioning options
#[serde(alias = "viewport")]
pub position: Option<PositionConfig>,
/// Frame options (see: https://docs.rs/egui/latest/egui/containers/frame/struct.Frame.html)
pub frame: Option<FrameConfig>,
/// Monitor options
/// The monitor index or the full monitor options
pub monitor: MonitorConfigOrIndex,
/// Font family
pub font_family: Option<String>,
Expand Down Expand Up @@ -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)]
Expand Down
184 changes: 152 additions & 32 deletions schema.bar.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 2029ed7

Please sign in to comment.