feat(wallpaper): composite window captures onto a custom background - #20
Merged
Conversation
Implements the CleanShot-style "Wallpaper" feature correctly: window captures are composited onto a chosen background image or solid color, with adjustable padding and a CSS drop-shadow that follows the window's real alpha shape (rounded corners). Area / fullscreen captures are unaffected — they already include the real desktop. The previous attempt (now scrapped) tried to swap the actual macOS wallpaper via `osascript` before each capture. That's not what CleanShot does and produced the wrong visual. Implementation: - New `src/main/capture/compositor.ts`. Spawns a hidden BrowserWindow sized to `windowSize + 2 * padding`, loads inline HTML that paints the bg + the window image with `filter: drop-shadow(...)`, then uses `webContents.capturePage()` to extract the composite as PNG. Window image and bg image are passed as base64 data URLs so we don't have to fight CSP for `file://` references. - `takeScreenshot` writes the raw window screenshot to a temp file when compositing is needed, runs the compositor, then unlinks the temp. Falls back to the raw window image on any compositor error. - Settings → Wallpaper now has a real panel: mode picker (System / Custom image / Solid color), padding slider, image picker, color picker. - Settings → General gains "Hide desktop icons while capturing" — the during-capture flavor that mirrors CleanShot's General-tab checkbox. The persistent toggle stays on the menu bar. Tested: - typecheck, lint, vitest (21), prod build all green - the heavy lifting (BrowserWindow + capturePage) needs a runtime smoke test on macOS — manual instructions are in the PR description Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
aryasadeghy
enabled auto-merge (squash)
May 9, 2026 23:43
| // Trusted local content (our own HTML + already-validated images). | ||
| // We need this off so the data: URL renders the embedded images | ||
| // without CSP fights. | ||
| webSecurity: false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the CleanShot-style "Wallpaper" feature correctly: window captures are composited onto a chosen background image or solid color, with adjustable padding and a CSS drop-shadow that follows the window's real alpha shape (rounded corners). Area / fullscreen captures are unaffected — they already include the real desktop.
The previous attempt (now scrapped) tried to swap the actual macOS wallpaper via
osascriptbefore each capture. That's not what CleanShot does and produced the wrong visual.Implementation:
src/main/capture/compositor.ts. Spawns a hidden BrowserWindow sized towindowSize + 2 * padding, loads inline HTML that paints the bg + the window image withfilter: drop-shadow(...), then useswebContents.capturePage()to extract the composite as PNG. Window image and bg image are passed as base64 data URLs so we don't have to fight CSP forfile://references.takeScreenshotwrites the raw window screenshot to a temp file when compositing is needed, runs the compositor, then unlinks the temp. Falls back to the raw window image on any compositor error.Tested:
Summary
Type
Screenshots / recording
Test plan
npm run lintnpm run typechecknpm testClean-room confirmation
Linked issues
Closes #