Skip to content

Add experimental multi-monitor wallpaper sync across virtual desktops#695

Draft
David-Lzy wants to merge 1 commit into
t1m0thyj:mainfrom
David-Lzy:agent/sync-spanned-virtual-desktop-wallpapers
Draft

Add experimental multi-monitor wallpaper sync across virtual desktops#695
David-Lzy wants to merge 1 commit into
t1m0thyj:mainfrom
David-Lzy:agent/sync-spanned-virtual-desktop-wallpapers

Conversation

@David-Lzy

Copy link
Copy Markdown

Summary

  • add an opt-in Sync multi-monitor wallpaper across virtual desktops (experimental) tray option on Windows 11 22H2+
  • compose per-display theme images into one spanned image using the monitor rectangles reported by IDesktopWallpaper
  • run monitor discovery in a per-monitor-v2 DPI context, so negative coordinates, vertical layouts, mixed resolutions, and scaling are reflected in the output canvas
  • assign the composite path to every virtual desktop up front instead of watching desktop switches and reapplying afterward
  • restore the user's previous Center/Tile/Stretch/Fit/Fill position and per-monitor wallpapers if the feature is disabled or the virtual desktop API fails

Why

Windows 11 stores a wallpaper path for each virtual desktop, while WDD's per-display path updates only affect the active desktop. Switching desktops can therefore reveal a stale or single-monitor wallpaper until an external script reapplies the current theme.

This change gives every virtual desktop the same already-composed multi-monitor image. Switching desktops no longer needs a polling script or a delayed refresh, and the existing per-display theme choices remain visually distinct on the physical monitors.

Implementation notes

  • The documented IDesktopWallpaper API supplies monitor IDs, screen-coordinate rectangles, background color, and the current wallpaper position.
  • UpdateWallpaperPathForAllDesktops is an internal Windows interface. Its known Windows 11 22H2/23H2 and 24H2+ vtable layouts are isolated in one file, the option is disabled by default, and all failures are logged and rolled back.
  • Unlike the virtual desktop integration removed in v5.1, this does not subscribe to virtual desktop events or add a VirtualDesktop package dependency.
  • Composite files are content-addressed and cached; only the four most recent files are retained.
  • Display changes, resume, and session unlock trigger a layout refresh while the option is enabled.

Tests

  • dotnet build src/WinDynamicDesktop.csproj --configuration Release
  • dotnet test test/WinDynamicDesktop.Tests.csproj --configuration Release --filter type!=system — 10 passed
  • single-file self-contained publish succeeded for x86, x64, and ARM64
  • renderer tests cover negative coordinates, vertical placement, layout gaps, per-monitor physical rectangles, Stretch, and Fit

The interactive system test was left to CI because it intentionally changes the logged-in user's real wallpaper and first-run configuration.

Closes #694
Related: #321

@David-Lzy
David-Lzy force-pushed the agent/sync-spanned-virtual-desktop-wallpapers branch 2 times, most recently from e5ae259 to 73ac99d Compare July 20, 2026 06:35
@David-Lzy
David-Lzy force-pushed the agent/sync-spanned-virtual-desktop-wallpapers branch from 73ac99d to 92eb616 Compare July 20, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: sync per-monitor wallpapers across Windows 11 virtual desktops

1 participant