Contributing

Windows surface split

Two independent Windows integrations. Do not mix them in one code path.

SurfaceTransportUIPackage
Widgets Boardwidget_data.json keys ac:template:{id} / ac:data:{id} + pending_actionsAdaptive Cards via C# IWidgetProviderMSIX App Extension com.microsoft.windows.widgets
Desktop wallpaper (WorkerW)Existing desktop webview / widget.htmlFrameless Tauri webview HWND reparented under WorkerW (or Progman on 24H2)No MSIX widget extension; layer: "desktop"

Widgets Board

  • Transpile: Rust to_adaptive_card (+ rasterize chart/canvas/gauge → PNG data URI)
  • Host write: desktop::write_board_card on cfg(windows) — adaptive_card::board_card emits one card with a body per distinct size branch, each tagged "$when": "${$host.widgetSize == \"small\" || …}"; a config with one branch gives a plain card
  • Provider: templates/windows-widget/WidgetProvider
    • IWidgetProvider + IWidgetProvider2 (customization), IWidgetProviderAnalytics, IWidgetProviderErrors (WinAppSDK 1.6 as referenced; the board calls the last two on Windows 11 build 26900+)
    • start: WidgetManager.GetWidgetInfos() recovers pinned widgets and their CustomState
    • CustomState is sent on every UpdateWidget; "customizing" while the customize card is shown ("Open app" → host action customize, "Done" → back to the card)
    • analytics / error JSON is appended to provider.log next to widget_data.json
    • manifest advertises small / medium / large and IsCustomizable="true"
  • Init: npx tauri-plugin-widgets-api init-windows
  • Preview / goldens: templates/windows-widget/PreviewHost → tests/golden/windows/ (record on Windows VM via just record-windows <case>)
  • Adaptive Card JSON snapshots: tests/snapshots/adaptive/ (pnpm -C scripts cli gen-adaptive-snapshots)
  • Compile check from macOS: dotnet msbuild -restore -t:Compile -p:Smoke=false -p:EnableWindowsTargeting=true -p:Platform=x64 -p:RuntimeIdentifier=win-x64 on a copy with the CLSID placeholder filled (the PRI / Appx tasks after compile need Windows)

Desktop layer (WorkerW)

  • layer: "desktop" on createWidgetWindow; Rust API tauri_plugin_widgets::windows::{attach_to_desktop, attach_window} (always built on Windows; feature workerw is a no-op kept for compatibility)
  • Classic: 0x052C to Progman spawns a top-level WorkerW behind the SHELLDLL_DefView host → child of it
  • Windows 11 24H2+: no top-level WorkerW appears; SHELLDLL_DefView and the wallpaper WorkerW are Progman children → the window becomes a Progman child z-ordered right below SHELLDLL_DefView
  • Position is kept: screen rect converted to parent client coordinates (virtual screen origin may be negative)
  • Explorer restart: one hidden top-level window on a watcher thread receives the TaskbarCreated broadcast and re-attaches every live attached window
  • Compile-check: cargo check --target x86_64-pc-windows-msvc --no-default-features --features rasterize (default image-prefetch pulls ring, which needs Windows C headers) or cargo xwin check
  • Runtime smoke only on an interactive Windows desktop session (scripts/win/workerw-smoke.ps1 optional)

UTM tooling

CommandRole
just win-upSSH healthcheck
just win-bootstrapInstall VS Build Tools / WinAppSDK via PS
just win-syncSync repo to C:\work\tauri-plugin-widgets
just test-windows-remoteshot.ps1 smoke
just test-windows-visual / record-windowsPreviewHost PNG
just win-pack / win-sideloadPublish + sideload helpers
just check-windows-xwinCross-check plugin
just build-windows-example-xwinCross-build demo app