Repository navigation
feat(appearance): window background image texture layer (#7714) - #17596
chris-albert wants to merge 2 commits into
Conversation
Adds Appearance -> Window & Sidebar -> Window Background Image: pick a local image (PNG/JPEG/WebP/GIF, 4MB cap) drawn as a fixed, pointer-inert low-opacity layer over the whole window, with adjustable texture strength (capped at 0.35 so the UI stays readable) and cover / contain / stretch / center fit. Stored as an inline data URL like repo icons; sanitized in the main-process settings IPC via one shared sanitizeAppBackgroundImageSettingsUpdate(). Web client mirror returns null from the picker, so the setting is desktop-only and inert there. Covers the full-window slice of stablyai#7714; terminal-pane and sidebar backgrounds are covered by stablyai#15836 / stablyai#15525. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TgY8UxaixycxK78Tgg1uqe
Greptile SummaryThe PR adds a configurable full-window background texture with a native image picker, validated persistent settings, renderer styling, and Appearance settings controls.
Confidence Score: 4/5The PR should not merge until the picker enforces its four-megabyte limit on the buffer actually returned across IPC. The separate stat and read operations allow a changed file to bypass the advertised upload limit, potentially persisting and decoding oversized data or silently clearing an existing selection. Files Needing Attention: src/main/ipc/shell.ts, src/shared/app-background-image.ts
|
| Filename | Overview |
|---|---|
| src/main/ipc/shell.ts | Adds the native background-image picker, but its pre-read size check can be invalidated before the unchecked file read. |
| src/shared/app-background-image.ts | Defines image, opacity, and fit normalization with strict URL syntax and bounded encoded length. |
| src/main/ipc/settings.ts | Integrates the new fields into the existing main-process settings sanitization boundary. |
| src/renderer/src/app-shell/AppBackgroundImageLayer.tsx | Adds an inert fixed texture layer driven by normalized global settings. |
| src/renderer/src/components/settings/AppBackgroundImageSetting.tsx | Adds image selection, removal, strength, and fit controls; a sanitizer rejection can clear a previous image without surfacing an error. |
| src/renderer/src/lib/app-background-image-style.ts | Converts validated settings into bounded CSS background properties with safe defaults. |
Sequence Diagram
sequenceDiagram
participant U as Appearance UI
participant P as Preload bridge
participant M as Main process
participant S as Settings store
participant R as Renderer layer
U->>P: pickAppBackgroundImage()
P->>M: shell:pickAppBackgroundImage
M->>M: Pick, size-check, and read file
M-->>P: Data URL
P-->>U: Selected image
U->>P: settings.set(image, opacity, fit)
P->>M: settings:set
M->>M: Sanitize background settings
M->>S: Persist normalized settings
S-->>R: Updated settings
R->>R: Render fixed texture layer
Reviews (1): Last reviewed commit: "feat(appearance): window background imag..." | Re-trigger Greptile
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughAdds app background image support across the application. Electron selects and validates PNG, JPEG, WebP, and GIF files before returning data URLs. Shared settings helpers normalize image data, opacity, and fit values. Preload and web APIs expose image selection. Appearance settings provide image controls, search, removal, and localization. The renderer displays the configured image in a fixed overlay and includes style resolution tests. Merge Risk: 🔵 Low · up to The feature is otherwise mergeable, but the persisted image sanitizer may still allow image data larger than the documented 4 MiB limit, which could increase settings storage and rendering resource use; explicitly confirm or fix that cap before merging. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description includes the required sections, explains the change and rationale, links issue
✨ Finishing Touches 💡 1⚔️ Resolve merge conflicts 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 628d07d5-d449-47ce-b060-ed25ab3049f6
📒 Files selected for processing (17)
src/main/ipc/settings.tssrc/main/ipc/shell.tssrc/preload/api/shell-api.tssrc/preload/index.tssrc/renderer/src/App.tsxsrc/renderer/src/app-shell/AppBackgroundImageLayer.tsxsrc/renderer/src/components/settings/AppBackgroundImageSetting.tsxsrc/renderer/src/components/settings/AppearancePane.tsxsrc/renderer/src/components/settings/AppearanceWindowSidebarSection.tsxsrc/renderer/src/components/settings/appearance-search.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/app-background-image-style.test.tssrc/renderer/src/lib/app-background-image-style.tssrc/renderer/src/web/preload-api/web-shell-api.tssrc/shared/app-background-image.test.tssrc/shared/app-background-image.tssrc/shared/global-settings-types.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
|
|
||
| export const MAX_APP_BACKGROUND_IMAGE_UPLOAD_BYTES = 4 * 1024 * 1024 | ||
| /** Base64 inflates ~4/3 over the 4MB file cap, plus the data: prefix. */ | ||
| const MAX_APP_BACKGROUND_IMAGE_DATA_URL_LENGTH = 6 * 1024 * 1024 |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Enforce the 4 MiB limit after Base64 expansion.
Line 11 accepts a data URL whose decoded payload is about 4.5 MiB. A caller of settings:set can persist this value because src/main/ipc/settings.ts applies this normalizer directly. This exceeds the 4 MiB feature limit.
Proposed fix
-const MAX_APP_BACKGROUND_IMAGE_DATA_URL_LENGTH = 6 * 1024 * 1024
+const MAX_APP_BACKGROUND_IMAGE_DATA_URL_LENGTH =
+ 'data:image/jpeg;base64,'.length + Math.ceil(MAX_APP_BACKGROUND_IMAGE_UPLOAD_BYTES / 3) * 4There was a problem hiding this comment.
ℹ️ No critical issues — a couple of minor suggestions inline.
Reviewed changes
A clean, well-scoped feature that adds a full-window background image texture layer (issue #7714 slice). Reviewed all 17 files.
- Shared sanitizer —
src/shared/app-background-image.tscentralizes the data-URL regex (onlydata:image/(png|jpeg|webp|gif);base64,with a strict base64 charset + 6MB string cap), the 0–0.35 opacity clamp, and the closed fit set. - Main-process IPC —
shell:pickAppBackgroundImagemirrorspickRepoIconImage(4MB cap, mime-by-extension);settings:setsanitizes viasanitizeAppBackgroundImageSettingsUpdate. - Render layer — one
pointer-events-none/aria-hiddenfixed inset-0 z-[130]div that re-validates the URL before painting (resolveAppBackgroundImageStyle), so the default path adds zero DOM. - Settings UI — Choose/Replace/Remove, Texture Strength (
NumberField), Image Fit segmented control, plus a registered search entry.
Security posture checks out: no SVG/file:/javascript:/remote URL can pass the regex, the base64 alphabet excludes every CSS-breaking character before it's interpolated into url("…"), and the renderer re-validates independent of the main-process gate. Removal sends appBackgroundImage: undefined, which survives structured clone and clears correctly.
ℹ️ Nitpicks
- The texture sits at
z-[130], so it washes over default dialogs but not the higher-z overlays (SshPassphraseDialog/link-routing-preference-dialoguse!z-[140]/!z-[150]), and onboarding dialog content atz-[130]ties with it and wins by DOM order. The ELI5 claim that every dialog gets the wash isn't quite true — confirm that's intentional (it likely is for the auth dialogs).
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
| 'auto.components.settings.appearance.search.appBackgroundImage.description', | ||
| 'Draw an image as a subtle texture across the whole window.' | ||
| ), | ||
| keywords: [ |
There was a problem hiding this comment.
The four keyword keys (background, image, wallpaper, texture) are passed to translateSearchKeyword but only title/description were minted in en.json. Functionally harmless — translateSearchKeyword falls back to the English string in every locale — but every other search entry here mints hashed keys in en.json for its keywords. Consider adding these for consistency (and so non-English locales can eventually translate them).
| min={0} | ||
| max={MAX_APP_BACKGROUND_IMAGE_OPACITY} | ||
| step={0.01} | ||
| suffix={`0 to ${MAX_APP_BACKGROUND_IMAGE_OPACITY}`} |
There was a problem hiding this comment.
suffix={0 to ${MAX_APP_BACKGROUND_IMAGE_OPACITY}} renders the literal text "0 to 0.35" immediately after the number input, which reads as a range hint pasted onto the value rather than a unit. Consider moving the range into the description (or dropping it — min/max already bound the input) and keeping suffix for a unit, if any.
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
There was a problem hiding this comment.
ℹ️ No new issues in the latest commit — but I'm not approving because two minor threads from the prior review remain open.
Reviewed changes
The single new commit closes a time-of-check/time-of-use gap in the background image picker: shell:pickAppBackgroundImage previously trusted stats.size before reading the file, so a file that grew (or was swapped) between the stat and the readFile could slip past the 4MB cap. It now re-checks buffer.length once the file is actually in memory.
- Picker size re-check —
shell:pickAppBackgroundImagethrows ifbuffer.length > MAX_APP_BACKGROUND_IMAGE_UPLOAD_BYTESafterreadFile, complementing the existingstats.sizeearly-exit (which still avoids reading oversized files into memory).
The two open threads from the prior review — the suffix range hint on the Texture Strength input, and the unminted search-keyword keys in en.json — are both unchanged nits, untouched by this commit, and remain on the PR for the author to address.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

ELI5
You can now pick a picture and Orca draws it as a faint texture across the whole window — every pane, sidebar, and dialog gets the same subtle wallpaper feel. Strength and fit are adjustable, Remove puts everything back exactly how it was, and if you never touch the setting nothing changes.
What Changed
appBackgroundImage(inlinedata:image/*URL),appBackgroundImageOpacity(0–0.35, default 0.08),appBackgroundImageFit(cover|contain|stretch|center) onGlobalSettings. Sanitized in the main settings IPC via one sharedsanitizeAppBackgroundImageSettingsUpdate()insrc/shared/app-background-image.ts(strict data-URL regex, size cap, opacity clamp, closed fit set).shell:pickAppBackgroundImageIPC (native dialog → size-capped data URL, 4MB, png/jpeg/webp/gif), modelled onshell:pickRepoIconImage. The web client mirror returnsnull, so the control is inert on web — remote/SSH workspaces are unaffected because this is purely client-side chrome.AppBackgroundImageLayerin the app shell — one fixed,pointer-events-none,aria-hiddendiv atz-[130]mounted beforeWindowControls(drag-region hit-testing is DOM-order-based). Rendersnullwhen no image is set, so the default path adds zero DOM.NumberFieldgrammar as the sidebar tint), Image Fit segmented control. Registered in settings search (background,image,wallpaper,texture).Why
#7714 asks for custom background images in the IDE. The open PRs cover the terminal panel (#15836, #8870) and the terminal + sidebars (#15525); this PR covers the remaining full-window slice with a deliberately small surface. Drawing a capped-opacity layer over the chrome (the approach VS Code's popular background extensions use) means no theme-token surgery and no per-surface transparency changes — dark/light themes, custom terminal themes, and every existing surface render exactly as before, with the texture washed uniformly on top. The 0.35 opacity cap guarantees the UI can never be made unreadable/unrecoverable from inside the app.
Linked Issue
Part of #7714 (full-window area; terminal/sidebar areas are covered by #15836 / #15525).
Visual Proof
Captured on macOS via the isolated e2e harness (fresh profile, seeded repo), texture strength 0.18 for visibility (default is a subtler 0.08).
The new settings row (found via settings search → "background image"):
Images live on an orphan
visual-proof/*branch of my fork, not in the PR diff.Testing
pnpm tc,pnpm test(new suites:src/shared/app-background-image.test.ts,src/renderer/src/lib/app-background-image-style.test.ts),pnpm lintquality gates, localization catalog synced.Manually verified on macOS (Apple Silicon) via the isolated e2e harness: fresh profile → default look unchanged → set image → texture renders across workspace + settings → Remove restores default.
Not run on Linux/Windows hardware; the change is platform-neutral (standard dialog/CSS, no paths, no shortcuts).
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Built with Claude Code (Claude Fable 5), driven and reviewed by the PR author.
Review
Self-review notes: cross-platform (no platform APIs beyond
dialog.showOpenDialog; no path handling in renderer), SSH/remote (setting lives in client-side global settings; web preload mirror inert), performance (layer rendersnullunless configured; data URL read once into settings like repo icons), security (main-process sanitization allows onlydata:image/(png|jpeg|webp|gif);base64,with strict base64 charset and size cap — no remote URLs, nofile:, no SVG; renderer resolver re-validates before painting), backwards compatibility (three optional fields; older profiles unaffected).Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
The opacity cap (0.35) is a safety choice, not a technical limit — happy to tune the cap, default, or move the section elsewhere if the team prefers a different shape.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code
https://claude.ai/code/session_01TgY8UxaixycxK78Tgg1uqe