Contributing
Windows surface split
Two independent Windows integrations. Do not mix them in one code path.
| Surface | Transport | UI | Package |
|---|---|---|---|
| Widgets Board | widget_data.json keys ac:template:{id} / ac:data:{id} + pending_actions | Adaptive Cards via C# IWidgetProvider | MSIX App Extension com.microsoft.windows.widgets |
| Desktop wallpaper (WorkerW) | Existing desktop webview / widget.html | Frameless 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_cardoncfg(windows)—adaptive_card::board_cardemits 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/WidgetProviderIWidgetProvider+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 theirCustomState CustomStateis sent on everyUpdateWidget;"customizing"while the customize card is shown ("Open app" → host actioncustomize, "Done" → back to the card)- analytics / error JSON is appended to
provider.lognext towidget_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 viajust 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-x64on a copy with the CLSID placeholder filled (the PRI / Appx tasks after compile need Windows)
Desktop layer (WorkerW)
layer: "desktop"oncreateWidgetWindow; Rust APItauri_plugin_widgets::windows::{attach_to_desktop, attach_window}(always built on Windows; featureworkerwis a no-op kept for compatibility)- Classic:
0x052Cto Progman spawns a top-level WorkerW behind theSHELLDLL_DefViewhost → child of it - Windows 11 24H2+: no top-level WorkerW appears;
SHELLDLL_DefViewand the wallpaper WorkerW are Progman children → the window becomes a Progman child z-ordered right belowSHELLDLL_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
TaskbarCreatedbroadcast and re-attaches every live attached window - Compile-check:
cargo check --target x86_64-pc-windows-msvc --no-default-features --features rasterize(defaultimage-prefetchpullsring, which needs Windows C headers) orcargo xwin check - Runtime smoke only on an interactive Windows desktop session (
scripts/win/workerw-smoke.ps1optional)
UTM tooling
| Command | Role |
|---|---|
just win-up | SSH healthcheck |
just win-bootstrap | Install VS Build Tools / WinAppSDK via PS |
just win-sync | Sync repo to C:\work\tauri-plugin-widgets |
just test-windows-remote | shot.ps1 smoke |
just test-windows-visual / record-windows | PreviewHost PNG |
just win-pack / win-sideload | Publish + sideload helpers |
just check-windows-xwin | Cross-check plugin |
just build-windows-example-xwin | Cross-build demo app |
Linux harness (Docker)
Native arm64 Ubuntu 24.04 container — do not use --platform linux/amd64 on Apple Silicon (qemu is 5–10× slower).
Mutation testing
Unit tests pass is not proof they check anything. Mutation testing changes the code (a < into <=, a branch into true) and expects some test to fail; a mutant that survives marks code no test watches. Fix the test, not the config.