Skip to content

feat(appearance): window background image texture layer (#7714) - #17596

Closed
chris-albert wants to merge 2 commits into
stablyai:mainfrom
chris-albert:feat/app-background-image
Closed

chris-albert wants to merge 2 commits into
stablyai:mainfrom
chris-albert:feat/app-background-image

Conversation

@chris-albert

Copy link
Copy Markdown

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

  • Settings: appBackgroundImage (inline data:image/* URL), appBackgroundImageOpacity (0–0.35, default 0.08), appBackgroundImageFit (cover | contain | stretch | center) on GlobalSettings. Sanitized in the main settings IPC via one shared sanitizeAppBackgroundImageSettingsUpdate() in src/shared/app-background-image.ts (strict data-URL regex, size cap, opacity clamp, closed fit set).
  • Picker: new shell:pickAppBackgroundImage IPC (native dialog → size-capped data URL, 4MB, png/jpeg/webp/gif), modelled on shell:pickRepoIconImage. The web client mirror returns null, so the control is inert on web — remote/SSH workspaces are unaffected because this is purely client-side chrome.
  • Rendering: AppBackgroundImageLayer in the app shell — one fixed, pointer-events-none, aria-hidden div at z-[130] mounted before WindowControls (drag-region hit-testing is DOM-order-based). Renders null when no image is set, so the default path adds zero DOM.
  • UI: Appearance → Window & Sidebar → Window Background Image: Choose/Replace/Remove, Texture Strength (same NumberField grammar 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).

Before (default) After (image set)
before after

The new settings row (found via settings search → "background image"):

settings

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 lint quality 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 renders null unless configured; data URL read once into settings like repo icons), security (main-process sanitization allows only data:image/(png|jpeg|webp|gif);base64, with strict base64 charset and size cap — no remote URLs, no file:, no SVG; renderer resolver re-validates before painting), backwards compatibility (three optional fields; older profiles unaffected).

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and 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

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

🤖 Generated with Claude Code

https://claude.ai/code/session_01TgY8UxaixycxK78Tgg1uqe

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-apps

greptile-apps Bot commented Aug 31, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds a configurable full-window background texture with a native image picker, validated persistent settings, renderer styling, and Appearance settings controls.

  • Adds PNG, JPEG, WebP, and GIF selection through the Electron preload/IPC boundary.
  • Adds image, opacity, and fit settings with normalization and rendering defaults.
  • Adds a fixed application-shell texture layer plus localized and searchable settings UI.

Confidence Score: 4/5

The 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

Important Files Changed

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
Loading

Reviews (1): Last reviewed commit: "feat(appearance): window background imag..." | Re-trigger Greptile

Comment thread src/main/ipc/shell.ts Resolved
@coderabbitai

coderabbitai Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 3960b6d3-d587-4f3e-97f1-d67ddfd8e838

📥 Commits

Reviewing files that changed from the base of the PR and between 1f8082d and f165cdb.

📒 Files selected for processing (1)
  • src/main/ipc/shell.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Adds 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 f165c

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 16 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description includes the required sections, explains the change and rationale, links issue #7714, provides visual proof, documents testing, and completes the checklist. The linked issue uses "Part…
Title check ✅ Passed The title clearly and concisely identifies the main change: an appearance feature that adds a window background image texture layer.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes the required sections, explains the change and rationale, links issue #7714, provides visual proof, documents testing, and completes the checklist. The linked issue uses "Part of #7714" instead of the template's "Fixes #", but it still identifies the relevant issue.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch feat/app-background-image

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 68bb227 and 1f8082d.

📒 Files selected for processing (17)
  • src/main/ipc/settings.ts
  • src/main/ipc/shell.ts
  • src/preload/api/shell-api.ts
  • src/preload/index.ts
  • src/renderer/src/App.tsx
  • src/renderer/src/app-shell/AppBackgroundImageLayer.tsx
  • src/renderer/src/components/settings/AppBackgroundImageSetting.tsx
  • src/renderer/src/components/settings/AppearancePane.tsx
  • src/renderer/src/components/settings/AppearanceWindowSidebarSection.tsx
  • src/renderer/src/components/settings/appearance-search.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/app-background-image-style.test.ts
  • src/renderer/src/lib/app-background-image-style.ts
  • src/renderer/src/web/preload-api/web-shell-api.ts
  • src/shared/app-background-image.test.ts
  • src/shared/app-background-image.ts
  • src/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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 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) * 4

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ 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.ts centralizes the data-URL regex (only data: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:pickAppBackgroundImage mirrors pickRepoIconImage (4MB cap, mime-by-extension); settings:set sanitizes via sanitizeAppBackgroundImageSettingsUpdate.
  • Render layer — one pointer-events-none/aria-hidden fixed 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-dialog use !z-[140]/!z-[150]), and onboarding dialog content at z-[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).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using 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: [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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}`}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ 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:pickAppBackgroundImage throws if buffer.length > MAX_APP_BACKGROUND_IMAGE_UPLOAD_BYTES after readFile, complementing the existing stats.size early-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.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker

nwparker commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Closing as superseded by #36589: app themes can now set a background image with translucency, and #36796 shows it in native chat too. Thank you for this PR, it shaped the design.

@nwparker nwparker closed this Nov 2, 2026
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.

3 participants