Repository navigation
feat(wallpaper): let Windows users pick the managed wallpaper display - #311
sanketpatel32 wants to merge 3 commits into
Conversation
Refs Code-Amadeus#190. Adds a persisted AMADEUS_WALLPAPER_MONITOR desktop setting (default: primary display, unchanged behavior). The persisted value is a Windows GDI device name such as \\.\DISPLAY2, the identity Lively's screen list, Win32 MONITORINFOEX enumeration, and the session journal already speak; Electron's volatile Display.id never crosses the boundary. - The Python helper enumerates monitors under per-monitor-V2 DPI awareness (physical pixels), gains a read-only screens command, accepts run <url> [target], resolves the target exactly, and stores it in the existing Snapshot/journal. A missing or ambiguous target fails before any display is taken over. - Electron resolves the same identity at session open: the helper's physical-pixel rectangles are correlated with each display's dipToScreenRect output. The resolved display is pinned for the session and used for the slice, canvas, and work surfaces. - Changing the target restores the previous session before mounting on the new display; an unresolved target reports the problem without taking over another monitor. - macOS/Linux and external wallpaper hosts are unchanged; no OS display configuration is modified. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
970dc9e to
d99d7fe
Compare
Lucas1479
left a comment
There was a problem hiding this comment.
Thank you @sanketpatel32 for picking up #190. The default path stays on the primary display, and a target that is disconnected or ambiguous fails closed instead of silently taking over another monitor. Both match what the issue asked for.
There is one blocking problem, and the acceptance run the issue requires is still missing:
-
An explicit target can never resolve against a real Lively host. The PR persists the GDI device name (
\\.\DISPLAY2) and compares it withLivelyHost.get_screens().get_screens()reads field 1 of Lively'sScreenData. Field 1 isdevice_id, the device-interface path (\\?\DISPLAY#…#{…});device_nameis field 2 (display.proto, DisplayManager.cs).SetWallpaperalso looks the display up byDeviceId(WinDesktopCoreServer.cs).- So
resolve_monitor("\\.\DISPLAY2")matches nothing, and every explicit choice ends with "is not connected". The new helper tests pass only because they stubget_screenswith GDI names.
Suggested direction: make Lively's
DeviceIdthe persisted identity. Thescreenscommand can get it the same way Lively does (EnumDisplayDevicesW(..., EDD_GET_DEVICE_INTERFACE_NAME), DisplayManager.cs) and report it next to the physical rectangle. Electron can keep matching displays by rectangle. ADeviceIdis also more stable than\\.\DISPLAYn, which can be renumbered when displays or GPUs are hot-plugged. Please add a test whose fake screens use device IDs shaped like real ones. -
Physical two-monitor acceptance, as #190 requires. Please cover:
- selecting the secondary display, and where the wallpaper, character and composer land;
- the primary display and the other monitor's wallpaper staying unchanged;
- a visible failure when the target is disconnected;
- journal restore after a stop and after a crash.
Please include sanitized screenshots.
I haven't reviewed the Electron re-pinning paths in index.ts in depth yet (slice recreation and display changes). I'll look at them again after the identity fix.
The previous commit persisted the GDI device name (\\.\DISPLAY2), but
LivelyHost.get_screens() reads ScreenData field 1 — the device-interface
path (\\?\DISPLAY#…#{…}) — and SetWallpaper resolves displays by that
same DeviceId, so an explicit target could never match a real host.
- Windows.monitors() now queries EnumDisplayDevicesW(szDevice, 0,
EDD_GET_DEVICE_INTERFACE_NAME), the same call Lively's DisplayManager
makes, and MonitorGeometry reports DeviceId next to the physical rect
and the GDI name (labels only; it can be renumbered on hot-plug).
- The screens command emits DeviceId; AMADEUS_WALLPAPER_MONITOR persists
it, so helper resolve_monitor matches the identity SetWallpaper gets.
- Electron still correlates displays by physical rectangle; resolution
and options now key on deviceId while labels keep the GDI name.
- Tests use fake screens with real-shaped device-interface paths, and a
GDI name is asserted to be an unresolvable target.
The full-display Slice surface saved positions in localStorage, but it loads from http://127.0.0.1:<assetPort> and AssetServer picks a free port each run, so the origin — and the saved positions — reset every restart. - sliceControlPositions.ts: normalized {status,card} positions (window coordinates, [-1,1]) stored at userData/wallpaper-control-positions.json with the same durable write pattern as desktop settings. - Preload exposes get/setControlPositions on window.amadeus; the renderer loads positions once over IPC and writes on drop/reset. Only the slice and canvas renderers may call the IPC. - electronSliceDisplay(): both full-display bounds helpers now resolve the target display in one place — AMADEUS_WALLPAPER_MONITOR matches an Electron label/id until Code-Amadeus#311's DeviceId resolver lands, primary stays the fallback, so the surface follows the chosen wallpaper display.
|
Requested changes addressed in f2d337d:
Outstanding: the physical two-monitor acceptance pass + sanitized screenshots need a Windows host — flagging that as the remaining evidence rather than simulating it. |
…paper-target-display
Summary
Closes #190 — a bounded implementation of the proposed monitor choice: one explicit monitor identity shared by the Lively helper and the Electron surfaces, primary display unchanged by default.
\.\DISPLAY2) is the single identity across Win32 / the helper journal / Electron. Electron correlates displays to helper rects viascreen.dipToScreenRect(physical px), so the physical-pixel vs DIP boundary is handled explicitly;Display.idnever crosses it.windows-wallpaper/helper.py):EnumDisplayMonitors+GetMonitorInfoExWenumeration under per-monitor-V2 DPI awareness (physical rects + device names + primary flag);LivelyHost.resolve_monitor(target)—NonekeepsPrimaryMonitor(), explicit targets resolve to exactly one monitor or fail (disconnected/ambiguous); resolved target stored in theSnapshot, so existing serialization/journal/restoration cover it unchanged.wallpaperTarget.tsresolves a persistedAMADEUS_WALLPAPER_MONITORsetting to exactly one ElectronDisplay;index.tspinswallpaperSessionDisplayIdand all interactive surfaces (slice/canvas/work overlay) mount on it; a display-change re-binds, display loss ends the session through the existing host-exit path — never a silent takeover of another monitor.Test plan
wallpaperTargetspecs, target dedupe/remount/arg propagation, display-loss session endtscclean;npm run check:config, extension-sdk and pi checks pass; fullvite buildGenerated with Devin