Skip to content

core: Widget data contract (Payload tagged union) #18

Closed

Description

@unhappychoice

Foundation type that every fetcher produces and every renderer consumes. Same schema serves internal types AND plugin subprocess JSON output.

Scope

  • Payload enum tagged by render type: text / list / gauge / sparkline / chart / bignum / image
  • Each variant carries its own data shape (tagged union via serde #[serde(tag = "render", content = "data")])
  • Common meta fields: title, icon, optional status (ok / warn / error for color hints)
  • text / list variants carry optional format template (fastfetch-style "{key}" substitution)

Example JSON (plugin output)

{ "render": "text",      "data": { "lines": ["..."] }, "title": "...", "format": "..." }
{ "render": "list",      "data": { "items": [{"key":"...","value":"...","status":"ok"}] } }
{ "render": "gauge",     "data": { "value": 0.73, "label": "CPU" } }
{ "render": "sparkline", "data": { "values": [1,2,3,4] } }
{ "render": "chart",     "data": { "series": [{"name":"...","points":[[x,y]]}] } }
{ "render": "bignum",    "data": { "text": "12:34" } }
{ "render": "image",     "data": { "path": "..." } }

Blocks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    core

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions