Skip to content

feat(windows): add opt-in draggable wallpaper slice controls - #316

Open
sanketpatel32 wants to merge 3 commits into
Code-Amadeus:mainfrom
sanketpatel32:issue-219-wallpaper-follow-drag
Open

sanketpatel32 wants to merge 3 commits into
Code-Amadeus:mainfrom
sanketpatel32:issue-219-wallpaper-follow-drag

Conversation

@sanketpatel32

Copy link
Copy Markdown
Contributor

Fixes #219

Summary

Implements the optional draggable-controls proposal from #219 as a settings-gated, default-off feature. The required window geometry fix already landed in #220 and is included in this base; this PR adds only the optional half.

  • New Windows-only desktop preference Settings → General → Startup → Draggable wallpaper controls (AMADEUS_WALLPAPER_DRAGGABLE_CONTROLS, boolean, default off, desktop_restart apply). Env var still overrides the saved value, matching the startup-mode convention.
  • When enabled, the transparent Electron slice BrowserWindow spans the whole primary display (same as macOS scene host), and freeControls=1 is passed to electron_slice.html. The default path keeps the authored slice-relative projection and ignores any saved positions.
  • The bridge now exposes the authored wallpaper art size (wallpaperImageSize) in /wallpaper/bridge-info; in free mode the slice host reproduces the scene's aspect-preserving cover transform so normalized bounds land where the artwork paints them, letting controls be placed anywhere on the display.
  • The Work status button and task card are draggable (card via its semantic header only). A 5px threshold preserves normal click/toggle behavior; positions persist normalized in the slice window's localStorage (amadeus.desktop-controls.positions.v1); right-click restores the authored position. Drag stays clamped to keep a visible margin on-screen.
  • The display-following proposal from Windows wallpaper controls: geometry fix and optional display-following/dragging drafts #219 is deliberately not implemented: issue comments flag unresolved host-compatibility/target-ownership questions for external Wallpaper Engine hosts.

Files changed

  • config/catalog/desktop/startup.json + regenerated electron/src/shared/configCatalog.generated.ts — new catalog field.
  • electron/src/main/startupMode.ts, electron/src/main/index.ts — preference resolution (win32-only), full-display slice bounds, freeControls URL param.
  • wallpaper/scene_assets.py, wallpaper/wallpaper_engine_bridge.py, server/handlers/wallpaper_handler.py — wallpaperImageSize plumbing.
  • render/web/electron_slice_host.js — cover projection, drag/persist/reset, click suppression, right-click reset.
  • docs/windows_wallpaper_lifecycle.md — documented the opt-in setting.
  • Tests: electron/tests/startupMode.test.mjs, tests/electron_slice_host.test.cjs (new), tests/test_electron_slice_host.py (new), tests/test_wallpaper_asset_revision.py.

Verification

  • node --test tests/electron_slice_host.test.cjs — 6/6 pass (default-off projection, cover-crop projection, drag+persist+click suppression, click preserved, right-click reset, header-only card drag).
  • node --experimental-strip-types --test electron/tests/startupMode.test.mjs — 6/6 pass.
  • python -m pytest -q tests/test_wallpaper_asset_revision.py tests/test_electron_slice_host.py tests/test_windows_desktop_layer.py — 23 pass (includes the fix(windows): preserve window geometry during desktop-layer reconciliation #220 geometry regressions).
  • python -m pytest -q tests/test_wallpaper_subscription_recovery.py::test_slice_refreshes_bridge_credential_after_reconnection — pass.
  • npx tsc --noEmit -p electron/tsconfig.json — clean.
  • npm run check:config — clean.
  • Electron test suite run during development: 19/19 selected tests pass, including the catalog/default/storage contract tests.

Not verified: native Windows manual acceptance (dragging on a live Lively-mounted wallpaper); no screenshot captured in this environment.

Adds AMADEUS_WALLPAPER_DRAGGABLE_CONTROLS, a Windows-only desktop
preference (default off, applies after restart). When enabled the
transparent slice window spans the whole primary display, the slice host
projects normalized control bounds through the wallpaper art's cover
transform, and the Work status button and task card can be dragged
anywhere on the display. Dragged positions persist as normalized window
coordinates in the slice window's localStorage; a right-click on a
control restores its authored position. The default path is unchanged.

Implements the optional dragging proposal from Code-Amadeus#219; the window
geometry fix already landed in Code-Amadeus#220.

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Signed-off-by: Sanket Patel <sanpatel323@gmail.com>
@sanketpatel32
sanketpatel32 force-pushed the issue-219-wallpaper-follow-drag branch from 40e599a to 9a51a66 Compare November 23, 2026 00:43

@Lucas1479 Lucas1479 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @sanketpatel32 for turning the optional dragging draft from #219 into a settings-gated, default-off feature, and for keeping display-following out of scope.

As noted in #219, host compatibility, interaction defaults and persistence need agreement before this is ready for mainline. Requested changes:

  1. Persistence depends on an origin that can change. Positions are stored in the slice window's localStorage, whose origin is http://127.0.0.1:<assetPort>. When the preferred port is busy, AssetServer.start() takes the next free port, so the origin can change between launches and the saved positions silently disappear. Please persist positions somewhere stable, for example through the main process with the desktop settings, or explain why the origin can't change.

  2. Windows acceptance evidence. Please attach a short recording on a live Lively-mounted wallpaper that shows:

    • dragging, the 5 px click threshold and right-click reset;
    • clicks outside the controls still reaching the desktop;
    • control alignment on a display that isn't 16:9, where the new cover projection and the default slice projection can differ.
  3. Cost of the full-display transparent window. Please report whether spanning the whole display changes GPU or compositor load compared with the default slice window, for example at 4K.

  4. Interaction with #311. #311 also changes electronSliceBounds() to support a target display. If both land, the full-display layout has to follow the chosen wallpaper display.

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.
@sanketpatel32

Copy link
Copy Markdown
Contributor Author

Requested changes addressed in be074a7:

  • Stable persistence. Positions moved out of localStorage — the http://127.0.0.1:<assetPort> origin changes whenever AssetServer picks a free port, which is why saves vanished. They now persist through the main process: SliceControlPositionsStore writes userData/wallpaper-control-positions.json (same durable tmp+rename+fsync pattern as desktop settings), exposed to the slice preload as amadeus.get/setControlPositions, reachable only from the slice/canvas renderers. New tests cover normalization and the store round-trip.
  • Follows the wallpaper display. Both full-display bounds helpers now resolve through one electronSliceDisplay(): AMADEUS_WALLPAPER_MONITOR matches an Electron display label/id today, and this seam is where feat(wallpaper): let Windows users pick the managed wallpaper display #311's DeviceId resolver plugs in once both land; primary stays the fallback.
  • GPU/compositor cost (qualitative — Windows numbers still owed): the full-display transparent window costs one screen-sized RGBA surface in the compositor plus per-frame setShape region updates; at 4K that's a ~33 MB backbuffer scan per frame while animating, and click-through hit-testing is per-region on the compositor path rather than per-pixel in the renderer, so the steady-state cost is the extra composition layer, not extra draw work. A measured 4K number needs the Windows box.
  • npx tsc --noEmit clean; new sliceControlPositions tests pass.

Outstanding: the Windows acceptance recording (drag, 5px threshold, right-click reset, pass-through clicks, non-16:9 alignment) and the measured GPU cost both need a Windows host.

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.

Windows wallpaper controls: geometry fix and optional display-following/dragging drafts

2 participants