Windows setup
Two surfaces: Widgets Board (Adaptive Cards + MSIX provider) and/or the same desktop webview as other OSes.
Widgets Board (Adaptive Cards)
1. Scaffold into your app
npx tauri-plugin-widgets-api init-windows
This copies the C# IWidgetProvider into your project at src-tauri/windows-widget/ (source templates live in the plugin under templates/windows-widget/ — you do not edit those in node_modules for day-to-day work).
Generated layout:
WidgetProvider/— COM provider processPreviewHost/— headless AC → PNG (goldens / debugging)Package.appxmanifest.fragment.xml— merge into your MSIX manifestAssets/StoreLogo.pngREADME.md— same checklist as below
2. How data flows
On setWidgetConfig the Rust host writes Adaptive Cards JSON into the widget store under ac:template:{widgetId} / ac:data:{widgetId} (plus the normal config:{widgetId} IR). The C# provider reads that store and feeds Widgets Board.
Point the provider at the host data directory:
TAURI_WIDGETS_DATA=<dir containing widget_data.json>
(Default location is under the app data dir / %LOCALAPPDATA% when unset — see host logs if unsure.)
Optional: TAURI_WIDGET_LOGICAL_ID (default default) must match the widgetId you pass to setWidgetConfig.
3. Package / CLSID
- Keep or regenerate the COM CLSID (
init-windowsalready writes one intoProvider.cs+ the manifest fragment). - Merge
Package.appxmanifest.fragment.xmlinto your MSIXPackage.appxmanifest(addxmlns:comandxmlns:uap3if missing). - Include
Assets/StoreLogo.pngin the package.
4. Build
# Smoke build (no full Appx/PRI tooling):
dotnet build src-tauri/windows-widget/WidgetProvider/WidgetProvider.csproj -c Release -p:Smoke=true
# Full WinAppSDK provider (VS Build Tools / WinAppSDK installed):
dotnet build src-tauri/windows-widget/WidgetProvider/WidgetProvider.csproj -c Release -p:Smoke=false
Pack / sideload helpers used in this repo: just win-pack, just win-sideload (see Windows surfaces).
5. Dev certificate (sideload)
The MSIX Publisher string must match the certificate Subject exactly.
npx tauri-widgets signing --dev-cert
# writes src-tauri/windows-widget/DevCert.ps1 and prints it
# elevated on Windows
powershell -ExecutionPolicy Bypass -File src-tauri/windows-widget/DevCert.ps1
# or sign in one shot:
powershell -ExecutionPolicy Bypass -File src-tauri/windows-widget/DevCert.ps1 -MsixPath path\to\app.msix
init-windows also drops a starter DevCert.ps1 into the scaffold.
6. Sizes, customization, diagnostics
- All three board sizes work from one card: give the config
small/medium/largebranches; the board picks the body for its$host.widgetSize(missing sizes fall back like elsewhere). - "Customize widget" in the board menu shows a card with Open app (reaches your app as action
customizefor that board instance) and Done. - When the provider restarts, pinned widgets are picked up again (
WidgetManager.GetWidgetInfos), including whether they were in customization. - Board-reported analytics and render errors (Windows 11 build 26900+) go to
provider.lognext towidget_data.json.
Desktop webview fallback
Outside Widgets Board, use the frameless webview path: createWidgetWindow without url (built-in renderer). Do not put "/widget.html" in tauri.conf.json unless you ship your own frontend page — Desktop webview.
Allow the window label in capabilities (windows + widgets:default).
layer: "desktop" puts the window behind the desktop icons (child of the wallpaper WorkerW; on Windows 11 24H2 a child of Progman below the icon view). It is re-attached automatically when Explorer restarts.
When it fails
- Confirm scaffold path is
src-tauri/windows-widget/, not the plugin’stemplates/folder. - Set
TAURI_WIDGETS_DATAso the provider sees the samewidget_data.jsonthe Rust host writes. - After
setWidgetConfig, verifyac:template:{widgetId}exists in that store. - Match
TAURI_WIDGET_LOGICAL_ID/ Swift–JSwidgetIdconventions if you use a non-defaultid. - Surfaces overview: Windows surfaces.
More symptoms: Troubleshooting index.
macOS setup
macOS widgets require a "sidecar" Xcode project — a small project alongside your Tauri app that compiles the Widget Extension (.appex). After init-macos, a normal pnpm tauri build produces an .app (and DMG) with Contents/PlugIns/*.appex already inside.
Linux setup
Linux desktop widgets use the same embedded webview path as Desktop webview: createWidgetWindow without url (no widget.html copy). Extra Linux behavior is window pinning.