mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-18 14:48:34 +01:00
docs(schema): ensure every enum variant has a renderable title
This commit is contained in:
1 parent
b421043494
commit
ff8c852e62
13 files changed
+508
-10
No files matched your search
@@ -0,0 +1,432 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Check schema.json and schema.bar.json for missing docstrings and map them to Rust source files.
|
||||
|
||||
This script analyzes the generated JSON schemas and identifies:
|
||||
1. Type definitions ($defs) missing top-level descriptions
|
||||
2. Enum variants missing descriptions (in oneOf/anyOf)
|
||||
3. Enum variants missing titles (object variants in oneOf/anyOf)
|
||||
4. Struct properties missing descriptions
|
||||
5. Top-level schema properties missing descriptions
|
||||
|
||||
For each missing docstring, it attempts to find the corresponding Rust source
|
||||
file and line number where the docstring should be added.
|
||||
"""
|
||||
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class MissingDoc:
|
||||
type_name: str
|
||||
kind: str # "type", "variant", "property", "variant_title"
|
||||
item_name: Optional[str] # variant or property name
|
||||
rust_file: Optional[str] = None
|
||||
rust_line: Optional[int] = None
|
||||
|
||||
def __str__(self):
|
||||
location = ""
|
||||
if self.rust_file and self.rust_line:
|
||||
location = f" -> {self.rust_file}:{self.rust_line}"
|
||||
elif self.rust_file:
|
||||
location = f" -> {self.rust_file}"
|
||||
|
||||
if self.kind == "type":
|
||||
return f"[TYPE] {self.type_name}{location}"
|
||||
elif self.kind == "variant":
|
||||
return f"[VARIANT] {self.type_name}::{self.item_name}{location}"
|
||||
elif self.kind == "variant_title":
|
||||
return f"[VARIANT_TITLE] {self.type_name}::{self.item_name}{location}"
|
||||
else:
|
||||
return f"[PROPERTY] {self.type_name}.{self.item_name}{location}"
|
||||
|
||||
|
||||
@dataclass
|
||||
class SchemaConfig:
|
||||
"""Configuration for a schema to check."""
|
||||
|
||||
schema_file: str
|
||||
search_paths: list[str]
|
||||
display_name: str
|
||||
|
||||
|
||||
def find_rust_definition(
|
||||
type_name: str, item_name: Optional[str], kind: str, search_paths: list[Path]
|
||||
) -> tuple[Optional[str], Optional[int]]:
|
||||
"""Find the Rust file and line number for a type/variant/property definition."""
|
||||
|
||||
if kind == "type":
|
||||
patterns = [
|
||||
rf"pub\s+enum\s+{type_name}\b",
|
||||
rf"pub\s+struct\s+{type_name}\b",
|
||||
]
|
||||
elif kind in ("variant", "variant_title"):
|
||||
patterns = [
|
||||
rf"^\s*{re.escape(item_name)}\s*[,\(\{{]",
|
||||
rf"^\s*{re.escape(item_name)}\s*$",
|
||||
rf"^\s*#\[.*\]\s*\n\s*{re.escape(item_name)}\b",
|
||||
]
|
||||
else: # property
|
||||
patterns = [rf"pub\s+{re.escape(item_name)}\s*:"]
|
||||
|
||||
for search_path in search_paths:
|
||||
for rust_file in search_path.rglob("*.rs"):
|
||||
try:
|
||||
content = rust_file.read_text()
|
||||
lines = content.split("\n")
|
||||
|
||||
if kind == "type":
|
||||
for pattern in patterns:
|
||||
for i, line in enumerate(lines):
|
||||
if re.search(pattern, line):
|
||||
return str(rust_file), i + 1
|
||||
|
||||
elif kind in ("variant", "variant_title", "property"):
|
||||
parent_pattern = rf"pub\s+(?:enum|struct)\s+{type_name}\b"
|
||||
in_type = False
|
||||
brace_count = 0
|
||||
found_open_brace = False
|
||||
|
||||
for i, line in enumerate(lines):
|
||||
if re.search(parent_pattern, line):
|
||||
in_type = True
|
||||
brace_count = 0
|
||||
found_open_brace = False
|
||||
|
||||
if in_type:
|
||||
if "{" in line:
|
||||
found_open_brace = True
|
||||
brace_count += line.count("{") - line.count("}")
|
||||
|
||||
for pattern in patterns:
|
||||
if re.search(pattern, line):
|
||||
return str(rust_file), i + 1
|
||||
|
||||
if found_open_brace and brace_count <= 0:
|
||||
in_type = False
|
||||
except Exception:
|
||||
continue
|
||||
|
||||
return None, None
|
||||
|
||||
|
||||
def _get_variant_identifier(variant: dict) -> str:
|
||||
"""Extract a meaningful identifier for a variant.
|
||||
|
||||
Tries to find the best identifier by checking:
|
||||
1. A top-level const value (e.g., {"const": "Linear"})
|
||||
2. A property with a const value (e.g., {"kind": {"const": "Bar"}})
|
||||
3. The first required property name
|
||||
4. The type field
|
||||
5. Falls back to "unknown"
|
||||
"""
|
||||
# Check for top-level const value (simple enum variant)
|
||||
if "const" in variant:
|
||||
return str(variant["const"])
|
||||
|
||||
properties = variant.get("properties", {})
|
||||
|
||||
# Check for a property with a const value (common pattern for tagged enums)
|
||||
for prop_name, prop_def in properties.items():
|
||||
if isinstance(prop_def, dict) and "const" in prop_def:
|
||||
return str(prop_def["const"])
|
||||
|
||||
# Fall back to first required property name
|
||||
required = variant.get("required", [])
|
||||
if required:
|
||||
return str(required[0])
|
||||
|
||||
# Fall back to type
|
||||
if "type" in variant:
|
||||
return str(variant["type"])
|
||||
|
||||
return "unknown"
|
||||
|
||||
|
||||
def check_type_description(type_name: str, type_def: dict) -> list[MissingDoc]:
|
||||
"""Check if a type definition has proper documentation."""
|
||||
missing = []
|
||||
has_top_description = "description" in type_def
|
||||
|
||||
# Always check for top-level type description first
|
||||
# (except for types that are purely references or have special handling)
|
||||
needs_type_description = True
|
||||
|
||||
# Check oneOf variants (tagged enums with variant descriptions)
|
||||
if "oneOf" in type_def:
|
||||
# oneOf types should have a top-level description
|
||||
if not has_top_description:
|
||||
missing.append(MissingDoc(type_name, "type", None, None, None))
|
||||
|
||||
for variant in type_def["oneOf"]:
|
||||
# Case 1: Simple const variant (e.g., {"const": "Swap", "description": "..."})
|
||||
variant_name = variant.get("const") or variant.get("title")
|
||||
if variant_name and "description" not in variant:
|
||||
missing.append(
|
||||
MissingDoc(type_name, "variant", str(variant_name), None, None)
|
||||
)
|
||||
|
||||
# Case 2: String enum inside oneOf (e.g., {"type": "string", "enum": [...]})
|
||||
# These variants don't have individual descriptions in the schema
|
||||
if "enum" in variant and variant.get("type") == "string":
|
||||
for enum_variant in variant["enum"]:
|
||||
missing.append(
|
||||
MissingDoc(type_name, "variant", str(enum_variant), None, None)
|
||||
)
|
||||
|
||||
# Case 3: Object variant with properties (e.g., CubicBezier)
|
||||
if "properties" in variant and "description" not in variant:
|
||||
for prop_name in variant.get("required", []):
|
||||
missing.append(
|
||||
MissingDoc(type_name, "variant", str(prop_name), None, None)
|
||||
)
|
||||
|
||||
# Case 4: Object variant missing title (needed for schema UI display)
|
||||
# Object variants should have a title or const for proper display in editors
|
||||
if (
|
||||
"properties" in variant
|
||||
and "title" not in variant
|
||||
and "const" not in variant
|
||||
):
|
||||
# Try to find a good identifier for the variant (for display only)
|
||||
variant_id = _get_variant_identifier(variant)
|
||||
missing.append(
|
||||
MissingDoc(type_name, "variant_title", str(variant_id), None, None)
|
||||
)
|
||||
|
||||
# Check anyOf variants - check each variant individually
|
||||
elif "anyOf" in type_def:
|
||||
# anyOf types should have a top-level description
|
||||
if not has_top_description:
|
||||
missing.append(MissingDoc(type_name, "type", None, None, None))
|
||||
|
||||
# Check each variant for description (skip pure $ref and null types)
|
||||
for variant in type_def["anyOf"]:
|
||||
# Skip null type variants (used for Option<T>)
|
||||
if variant.get("type") == "null":
|
||||
continue
|
||||
# Skip pure $ref variants (the referenced type is checked separately)
|
||||
if "$ref" in variant and len(variant) == 1:
|
||||
continue
|
||||
# Skip $ref variants that have a description
|
||||
if "$ref" in variant and "description" in variant:
|
||||
continue
|
||||
# Variant with $ref but no description
|
||||
if "$ref" in variant and "description" not in variant:
|
||||
# Extract the type name from the $ref
|
||||
ref_name = variant["$ref"].split("/")[-1]
|
||||
missing.append(MissingDoc(type_name, "variant", ref_name, None, None))
|
||||
# Non-ref variant without description
|
||||
elif "description" not in variant and "$ref" not in variant:
|
||||
# Try to identify the variant by its type or const
|
||||
variant_id = variant.get("const") or variant.get("type") or "unknown"
|
||||
missing.append(
|
||||
MissingDoc(type_name, "variant", str(variant_id), None, None)
|
||||
)
|
||||
|
||||
# Check for missing title on object variants in anyOf
|
||||
if (
|
||||
"properties" in variant
|
||||
and "title" not in variant
|
||||
and "const" not in variant
|
||||
):
|
||||
variant_id = _get_variant_identifier(variant)
|
||||
missing.append(
|
||||
MissingDoc(type_name, "variant_title", str(variant_id), None, None)
|
||||
)
|
||||
|
||||
# Check simple string enums (no oneOf means no variant descriptions possible in schema)
|
||||
elif "enum" in type_def:
|
||||
if not has_top_description:
|
||||
missing.append(MissingDoc(type_name, "type", None, None, None))
|
||||
# Each enum variant needs a docstring - these can't have descriptions in simple enum format
|
||||
for variant in type_def["enum"]:
|
||||
missing.append(MissingDoc(type_name, "variant", str(variant), None, None))
|
||||
|
||||
# Check struct properties
|
||||
elif "properties" in type_def:
|
||||
# Structs should always have a top-level description
|
||||
if not has_top_description:
|
||||
missing.append(MissingDoc(type_name, "type", None, None, None))
|
||||
|
||||
for prop_name, prop_def in type_def["properties"].items():
|
||||
if "description" not in prop_def:
|
||||
missing.append(MissingDoc(type_name, "property", prop_name, None, None))
|
||||
|
||||
# Simple type without description (like PathBuf, Hex)
|
||||
elif not has_top_description:
|
||||
# Only flag if it has a concrete type (not just a $ref)
|
||||
if type_def.get("type") is not None:
|
||||
missing.append(MissingDoc(type_name, "type", None, None, None))
|
||||
|
||||
return missing
|
||||
|
||||
|
||||
def check_top_level_properties(schema: dict, root_type_name: str) -> list[MissingDoc]:
|
||||
"""Check top-level schema properties for missing descriptions."""
|
||||
missing = []
|
||||
properties = schema.get("properties", {})
|
||||
|
||||
for prop_name, prop_def in properties.items():
|
||||
if "description" not in prop_def:
|
||||
missing.append(
|
||||
MissingDoc(root_type_name, "property", prop_name, None, None)
|
||||
)
|
||||
|
||||
return missing
|
||||
|
||||
|
||||
def check_schema(
|
||||
schema_path: Path,
|
||||
search_paths: list[Path],
|
||||
project_root: Path,
|
||||
display_name: str,
|
||||
) -> tuple[list[MissingDoc], int]:
|
||||
"""Check a single schema file and return missing docs and exit code."""
|
||||
if not schema_path.exists():
|
||||
print(f"Error: {schema_path.name} not found at {schema_path}")
|
||||
return [], 1
|
||||
|
||||
with open(schema_path) as f:
|
||||
schema = json.load(f)
|
||||
|
||||
all_missing: list[MissingDoc] = []
|
||||
|
||||
# Check top-level schema properties
|
||||
root_type_name = schema.get("title", "Root")
|
||||
all_missing.extend(check_top_level_properties(schema, root_type_name))
|
||||
|
||||
# Check all type definitions
|
||||
for type_name, type_def in sorted(schema.get("$defs", {}).items()):
|
||||
# Skip PerAnimationPrefixConfig2/3 as they're generated variants
|
||||
if (
|
||||
type_name.startswith("PerAnimationPrefixConfig")
|
||||
and type_name != "PerAnimationPrefixConfig"
|
||||
):
|
||||
continue
|
||||
all_missing.extend(check_type_description(type_name, type_def))
|
||||
|
||||
# Find Rust source locations
|
||||
print(f"Scanning Rust source files for {display_name}...", file=sys.stderr)
|
||||
for doc in all_missing:
|
||||
doc.rust_file, doc.rust_line = find_rust_definition(
|
||||
doc.type_name, doc.item_name, doc.kind, search_paths
|
||||
)
|
||||
if doc.rust_file:
|
||||
try:
|
||||
doc.rust_file = str(Path(doc.rust_file).relative_to(project_root))
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
return all_missing, 0
|
||||
|
||||
|
||||
def print_results(all_missing: list[MissingDoc], display_name: str) -> None:
|
||||
"""Print the results for a schema check."""
|
||||
# Group by file
|
||||
by_file: dict[str, list[MissingDoc]] = {}
|
||||
external: list[MissingDoc] = []
|
||||
|
||||
for doc in all_missing:
|
||||
if doc.rust_file:
|
||||
by_file.setdefault(doc.rust_file, []).append(doc)
|
||||
else:
|
||||
external.append(doc)
|
||||
|
||||
# Print summary
|
||||
print("\n" + "=" * 70)
|
||||
print(f"MISSING DOCSTRINGS IN SCHEMA ({display_name})")
|
||||
print("=" * 70)
|
||||
|
||||
type_count = sum(1 for d in all_missing if d.kind == "type")
|
||||
variant_count = sum(1 for d in all_missing if d.kind == "variant")
|
||||
variant_title_count = sum(1 for d in all_missing if d.kind == "variant_title")
|
||||
prop_count = sum(1 for d in all_missing if d.kind == "property")
|
||||
|
||||
print(f"\nTotal: {len(all_missing)} missing docstrings/titles")
|
||||
print(f" - {type_count} types")
|
||||
print(f" - {variant_count} variants")
|
||||
print(f" - {variant_title_count} variant titles")
|
||||
print(f" - {prop_count} properties")
|
||||
|
||||
# Print by file
|
||||
for rust_file in sorted(by_file.keys()):
|
||||
docs = sorted(by_file[rust_file], key=lambda d: d.rust_line or 0)
|
||||
print(f"\n{rust_file}:")
|
||||
print("-" * len(rust_file))
|
||||
for doc in docs:
|
||||
print(f" {doc}")
|
||||
|
||||
# Print external items (types not found in source)
|
||||
if external:
|
||||
print(f"\nExternal/Unknown location:")
|
||||
print("-" * 25)
|
||||
for doc in external:
|
||||
print(f" {doc}")
|
||||
|
||||
print("\n" + "=" * 70)
|
||||
|
||||
|
||||
def main():
|
||||
project_root = Path.cwd()
|
||||
|
||||
# Define schemas to check with their respective search paths
|
||||
schemas = [
|
||||
SchemaConfig(
|
||||
schema_file="schema.json",
|
||||
search_paths=["komorebi/src", "komorebi-themes/src"],
|
||||
display_name="komorebi",
|
||||
),
|
||||
SchemaConfig(
|
||||
schema_file="schema.bar.json",
|
||||
search_paths=["komorebi-bar/src", "komorebi-themes/src"],
|
||||
display_name="komorebi-bar",
|
||||
),
|
||||
]
|
||||
|
||||
total_missing = 0
|
||||
has_errors = False
|
||||
|
||||
for schema_config in schemas:
|
||||
schema_path = project_root / schema_config.schema_file
|
||||
search_paths = [
|
||||
project_root / p
|
||||
for p in schema_config.search_paths
|
||||
if (project_root / p).exists()
|
||||
]
|
||||
|
||||
missing, error_code = check_schema(
|
||||
schema_path,
|
||||
search_paths,
|
||||
project_root,
|
||||
schema_config.display_name,
|
||||
)
|
||||
|
||||
if error_code != 0:
|
||||
has_errors = True
|
||||
continue
|
||||
|
||||
print_results(missing, schema_config.display_name)
|
||||
total_missing += len(missing)
|
||||
|
||||
# Print combined summary
|
||||
if len(schemas) > 1:
|
||||
print("\n" + "=" * 70)
|
||||
print("COMBINED SUMMARY")
|
||||
print("=" * 70)
|
||||
print(f"Total missing docstrings across all schemas: {total_missing}")
|
||||
print("=" * 70)
|
||||
|
||||
if has_errors:
|
||||
return 1
|
||||
|
||||
return 1 if total_missing > 0 else 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -47,8 +47,8 @@ deadlock $RUST_LOG="trace":
|
||||
docgen starlight:
|
||||
rm {{ starlight }}/src/data/cli/macos/*.md
|
||||
cargo run --package komorebic -- docgen --output {{ starlight }}/src/data/cli/macos
|
||||
schemars-docgen ./schema.json --output {{ starlight }}/src/content/docs/reference/komorebi-macos.mdx --format mdx --title "komorebi.json (macOS)" --description "komorebi for Mac configuration schema reference"
|
||||
schemars-docgen ./schema.bar.json --output {{ starlight }}/src/content/docs/reference/bar-macos.mdx --format mdx --title "komorebi.bar.json (macOS)" --description "komorebi-bar for Mac configuration schema reference"
|
||||
schemars-docgen ./schema.json --output {{ starlight }}/src/content/docs/reference/komorebi-macos.mdx --title "komorebi.json (macOS)" --description "komorebi for Mac configuration schema reference"
|
||||
schemars-docgen ./schema.bar.json --output {{ starlight }}/src/content/docs/reference/bar-macos.mdx --title "komorebi.bar.json (macOS)" --description "komorebi-bar for Mac configuration schema reference"
|
||||
|
||||
jsonschema:
|
||||
cargo run --package komorebic -- static-config-schema > schema.json
|
||||
|
||||
@@ -560,6 +560,7 @@ impl From<Position> for Pos2 {
|
||||
/// Komorebi bar theme
|
||||
pub enum KomobarTheme {
|
||||
/// Theme from catppuccin-egui
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Catppuccin"))]
|
||||
Catppuccin {
|
||||
/// Name of the Catppuccin theme (theme previews: https://github.com/catppuccin/catppuccin)
|
||||
name: komorebi_themes::Catppuccin,
|
||||
@@ -568,6 +569,7 @@ pub enum KomobarTheme {
|
||||
auto_select_text: Option<komorebi_themes::CatppuccinValue>,
|
||||
},
|
||||
/// Theme from base16-egui-themes
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Base16"))]
|
||||
Base16 {
|
||||
/// Name of the Base16 theme (theme previews: https://tinted-theming.github.io/tinted-gallery/)
|
||||
name: komorebi_themes::Base16,
|
||||
@@ -576,6 +578,7 @@ pub enum KomobarTheme {
|
||||
auto_select_text: Option<komorebi_themes::Base16Value>,
|
||||
},
|
||||
/// Custom Base16 theme
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Custom"))]
|
||||
Custom {
|
||||
/// Colours of the custom Base16 theme palette
|
||||
colours: Box<komorebi_themes::Base16ColourPalette>,
|
||||
|
||||
@@ -34,12 +34,16 @@ mod defaults {
|
||||
/// Grouping
|
||||
pub enum Grouping {
|
||||
/// No grouping is applied
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "None"))]
|
||||
None,
|
||||
/// Widgets are grouped as a whole
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Bar"))]
|
||||
Bar(GroupingConfig),
|
||||
/// Widgets are grouped by alignment
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Alignment"))]
|
||||
Alignment(GroupingConfig),
|
||||
/// Widgets are grouped individually
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Widget"))]
|
||||
Widget(GroupingConfig),
|
||||
}
|
||||
|
||||
|
||||
@@ -116,8 +116,10 @@ pub enum DateFormat {
|
||||
/// Day Date Month Year format (8 September 2024)
|
||||
DayDateMonthYear,
|
||||
/// Custom format (https://docs.rs/chrono/latest/chrono/format/strftime/index.html)
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Custom"))]
|
||||
Custom(String),
|
||||
/// Custom format with modifiers
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "CustomModifiers"))]
|
||||
CustomModifiers(CustomModifiers),
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +24,10 @@ use std::fmt::Formatter;
|
||||
|
||||
#[derive(Copy, Clone, Debug, Serialize, PartialEq)]
|
||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
#[serde(untagged)]
|
||||
/// Komorebi layout kind
|
||||
pub enum KomorebiLayout {
|
||||
/// Predefined layout
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Default"))]
|
||||
Default(komorebi_client::DefaultLayout),
|
||||
/// Monocle mode
|
||||
Monocle,
|
||||
|
||||
@@ -140,6 +140,7 @@ pub enum TimeFormat {
|
||||
/// Twenty-four-hour format displayed as a binary clock with rectangles (with seconds) (https://en.wikipedia.org/wiki/Binary_clock)
|
||||
BinaryRectangle,
|
||||
/// Custom format (https://docs.rs/chrono/latest/chrono/format/strftime/index.html)
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Default"))]
|
||||
Custom(String),
|
||||
}
|
||||
|
||||
|
||||
@@ -37,26 +37,36 @@ pub trait BarWidget {
|
||||
/// Widget configuration
|
||||
pub enum WidgetConfig {
|
||||
/// Applications widget configuration
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Applications"))]
|
||||
Applications(ApplicationsConfig),
|
||||
/// Battery widget configuration
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Battery"))]
|
||||
Battery(BatteryConfig),
|
||||
/// CPU widget configuration
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Cpu"))]
|
||||
Cpu(CpuConfig),
|
||||
/// Date widget configuration
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Date"))]
|
||||
Date(DateConfig),
|
||||
// Keyboard(KeyboardConfig),
|
||||
/// Komorebi widget configuration
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Komorebi"))]
|
||||
Komorebi(KomorebiConfig),
|
||||
// Media(MediaConfig),
|
||||
/// Memory widget configuration
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Memory"))]
|
||||
Memory(MemoryConfig),
|
||||
/// Network widget configuration
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Network"))]
|
||||
Network(NetworkConfig),
|
||||
/// Storage widget configuration
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Storage"))]
|
||||
Storage(StorageConfig),
|
||||
/// Time widget configuration
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Time"))]
|
||||
Time(TimeConfig),
|
||||
/// Update widget configuration
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Update"))]
|
||||
Update(UpdateConfig),
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ pub enum AnimationStyle {
|
||||
EaseOutBounce,
|
||||
/// Ease in out bounce
|
||||
EaseInOutBounce,
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "CubicBezier"))]
|
||||
#[value(skip)]
|
||||
/// Custom Cubic Bézier function
|
||||
CubicBezier(f64, f64, f64, f64),
|
||||
|
||||
@@ -629,6 +629,7 @@ pub struct AnimationsConfig {
|
||||
/// Komorebi theme
|
||||
pub enum KomorebiTheme {
|
||||
/// A theme from catppuccin-egui
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Catppuccin"))]
|
||||
Catppuccin {
|
||||
/// Name of the Catppuccin theme (theme previews: https://github.com/catppuccin/catppuccin)
|
||||
name: komorebi_themes::Catppuccin,
|
||||
@@ -671,6 +672,7 @@ pub enum KomorebiTheme {
|
||||
bar_accent: Option<komorebi_themes::CatppuccinValue>,
|
||||
},
|
||||
/// A theme from base16-egui-themes
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Base16"))]
|
||||
Base16 {
|
||||
/// Name of the Base16 theme (theme previews: https://tinted-theming.github.io/tinted-gallery/)
|
||||
name: komorebi_themes::Base16,
|
||||
@@ -713,6 +715,7 @@ pub enum KomorebiTheme {
|
||||
bar_accent: Option<komorebi_themes::Base16Value>,
|
||||
},
|
||||
/// A custom Base16 theme
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Custom"))]
|
||||
Custom {
|
||||
/// Colours of the custom Base16 theme palette
|
||||
colours: Box<komorebi_themes::Base16ColourPalette>,
|
||||
|
||||
@@ -1192,8 +1192,10 @@ impl From<&CFDictionary> for WindowBounds {
|
||||
/// Aspect ratio for temporarily floating windows
|
||||
pub enum AspectRatio {
|
||||
/// A predefined aspect ratio
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Predefined"))]
|
||||
Predefined(PredefinedAspectRatio),
|
||||
/// A custom W:H aspect ratio
|
||||
#[cfg_attr(feature = "schemars", schemars(title = "Custom"))]
|
||||
Custom(i32, i32),
|
||||
}
|
||||
|
||||
|
||||
+41
-7
@@ -2158,6 +2158,7 @@
|
||||
"const": "DayDateMonthYear"
|
||||
},
|
||||
{
|
||||
"title": "Custom",
|
||||
"description": "Custom format (https://docs.rs/chrono/latest/chrono/format/strftime/index.html)",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -2171,6 +2172,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "CustomModifiers",
|
||||
"description": "Custom format with modifiers",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -2337,6 +2339,7 @@
|
||||
"description": "Grouping",
|
||||
"oneOf": [
|
||||
{
|
||||
"title": "None",
|
||||
"description": "No grouping is applied",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -2350,6 +2353,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Bar",
|
||||
"description": "Widgets are grouped as a whole",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -2364,6 +2368,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Alignment",
|
||||
"description": "Widgets are grouped by alignment",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -2378,6 +2383,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Widget",
|
||||
"description": "Widgets are grouped individually",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -2513,6 +2519,7 @@
|
||||
"description": "Komorebi bar theme",
|
||||
"oneOf": [
|
||||
{
|
||||
"title": "Catppuccin",
|
||||
"description": "Theme from catppuccin-egui",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -2561,6 +2568,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Base16",
|
||||
"description": "Theme from base16-egui-themes",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -2609,6 +2617,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Custom",
|
||||
"description": "Custom Base16 theme",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -2784,26 +2793,40 @@
|
||||
},
|
||||
"KomorebiLayout": {
|
||||
"description": "Komorebi layout kind",
|
||||
"anyOf": [
|
||||
"oneOf": [
|
||||
{
|
||||
"title": "Default",
|
||||
"description": "Predefined layout",
|
||||
"$ref": "#/$defs/DefaultLayout"
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Default": {
|
||||
"$ref": "#/$defs/DefaultLayout"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"Default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Monocle mode",
|
||||
"type": "null"
|
||||
"type": "string",
|
||||
"const": "Monocle"
|
||||
},
|
||||
{
|
||||
"description": "Floating layer",
|
||||
"type": "null"
|
||||
"type": "string",
|
||||
"const": "Floating"
|
||||
},
|
||||
{
|
||||
"description": "Paused",
|
||||
"type": "null"
|
||||
"type": "string",
|
||||
"const": "Paused"
|
||||
},
|
||||
{
|
||||
"description": "Custom layout",
|
||||
"type": "null"
|
||||
"type": "string",
|
||||
"const": "Custom"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -3450,6 +3473,7 @@
|
||||
"const": "BinaryRectangle"
|
||||
},
|
||||
{
|
||||
"title": "Default",
|
||||
"description": "Custom format (https://docs.rs/chrono/latest/chrono/format/strftime/index.html)",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3502,6 +3526,7 @@
|
||||
"description": "Widget configuration",
|
||||
"oneOf": [
|
||||
{
|
||||
"title": "Applications",
|
||||
"description": "Applications widget configuration",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3515,6 +3540,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Battery",
|
||||
"description": "Battery widget configuration",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3528,6 +3554,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Cpu",
|
||||
"description": "CPU widget configuration",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3541,6 +3568,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Date",
|
||||
"description": "Date widget configuration",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3554,6 +3582,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Komorebi",
|
||||
"description": "Komorebi widget configuration",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3567,6 +3596,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Memory",
|
||||
"description": "Memory widget configuration",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3580,6 +3610,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Network",
|
||||
"description": "Network widget configuration",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3593,6 +3624,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Storage",
|
||||
"description": "Storage widget configuration",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3606,6 +3638,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Time",
|
||||
"description": "Time widget configuration",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3619,6 +3652,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Update",
|
||||
"description": "Update widget configuration",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -3634,7 +3668,7 @@
|
||||
]
|
||||
},
|
||||
"WorkspacesDisplayFormat": {
|
||||
"description": "Workspaces widget display format",
|
||||
"description": "Workspaces display format",
|
||||
"anyOf": [
|
||||
{
|
||||
"description": "Show all icons only",
|
||||
|
||||
@@ -468,6 +468,7 @@
|
||||
"const": "EaseInOutBounce"
|
||||
},
|
||||
{
|
||||
"title": "CubicBezier",
|
||||
"description": "Custom Cubic Bézier function",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -595,10 +596,12 @@
|
||||
"description": "Aspect ratio for temporarily floating windows",
|
||||
"anyOf": [
|
||||
{
|
||||
"title": "Predefined",
|
||||
"description": "A predefined aspect ratio",
|
||||
"$ref": "#/$defs/PredefinedAspectRatio"
|
||||
},
|
||||
{
|
||||
"title": "Custom",
|
||||
"description": "A custom W:H aspect ratio",
|
||||
"type": "array",
|
||||
"maxItems": 2,
|
||||
@@ -2538,6 +2541,7 @@
|
||||
"description": "Komorebi theme",
|
||||
"oneOf": [
|
||||
{
|
||||
"title": "Catppuccin",
|
||||
"description": "A theme from catppuccin-egui",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -2640,6 +2644,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Base16",
|
||||
"description": "A theme from base16-egui-themes",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -2742,6 +2747,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Custom",
|
||||
"description": "A custom Base16 theme",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Reference in new issue
Block a user