Skip to content

feat(desktop): add window opacity and blur settings to appearance - #931

Closed
kkjcheng wants to merge 3 commits into
ParadevAI:mainfrom
kkjcheng:feat/window-opacity-blur
Closed

kkjcheng wants to merge 3 commits into
ParadevAI:mainfrom
kkjcheng:feat/window-opacity-blur

Conversation

@kkjcheng

@kkjcheng kkjcheng commented Jan 24, 2026 •

Copy link
Copy Markdown
Contributor

This was one of my favorite feature of Warp's that I used to be able to configure. Would love to bring it to superset!

Summary

  • Add opacity slider (0-100%) for window transparency
  • Add vibrancy options for macOS (sidebar, under-window, etc.)
  • Add background material options for Windows 11 (mica, acrylic, etc.)
  • Settings persist across app restarts
  • Platform-specific UI shows only relevant options

Note: Window opacity only affects the window frame, not the text/content inside.

Summary by CodeRabbit

  • New Features
    • Added window appearance controls in Appearance preferences: opacity slider (0–100%) with live preview and platform-specific blur options (vibrancy on macOS, background materials on Windows).
    • Changes persist to settings and are applied on app start; adjustments can be applied live.
    • Appearance options are searchable in Settings.

✏️ Tip: You can customize this high-level summary in your review settings.

- Add opacity slider (20-100%) for window transparency
- Add vibrancy options for macOS (sidebar, under-window, etc.)
- Add background material options for Windows 11 (mica, acrylic, etc.)
- Settings persist across app restarts
- Platform-specific UI shows only relevant options
@coderabbitai

coderabbitai Bot commented Jan 24, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds persisted window appearance controls (opacity, macOS vibrancy, Windows background material) across schema, TRPC endpoints, Electron main process, and renderer settings UI with platform guards and defaults.

Changes

Cohort / File(s) Summary
Schema & enums
packages/local-db/src/schema/zod.ts, packages/local-db/src/schema/schema.ts
Add WINDOW_VIBRANCY_OPTIONS and WINDOW_BACKGROUND_MATERIALS plus types; extend settings table with windowOpacity, windowVibrancy, windowBackgroundMaterial.
TRPC settings API
apps/desktop/src/lib/trpc/routers/settings/index.ts
Add getWindowOpacity/setWindowOpacity, getWindowVibrancy/setWindowVibrancy, getWindowBackgroundMaterial/setWindowBackgroundMaterial with validation and upsert persistence (settings row id=1).
TRPC window control
apps/desktop/src/lib/trpc/routers/window.ts
Add setOpacity, setVibrancy, setBackgroundMaterial mutations; input validation and platform guards (vibrancy: macOS; backgroundMaterial: Windows); safe handling when no window.
Electron main window
apps/desktop/src/main/windows/main.ts
Load appearance settings from DB and apply to BrowserWindow on creation via new helpers (getWindowAppearanceSettings, applyWindowAppearance); platform-specific application.
Shared defaults
apps/desktop/src/shared/constants.ts
Export DEFAULT_WINDOW_OPACITY, DEFAULT_WINDOW_VIBRANCY, DEFAULT_WINDOW_BACKGROUND_MATERIAL.
Renderer UI & discovery
apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/AppearanceSettings.tsx, apps/desktop/src/renderer/routes/_authenticated/settings/utils/settings-search/settings-search.ts
Add Window Opacity slider and platform-aware Window Blur controls (vibrancy on macOS, material on Windows); wire queries/mutations (optimistic updates, rollback); add search IDs APPEARANCE_WINDOW_OPACITY, APPEARANCE_WINDOW_BLUR.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant UI as Renderer (UI)
    participant TRPCClient as TRPC Client
    participant TRPCServer as TRPC Server
    participant DB as Database
    participant Electron as Electron Window

    User->>UI: adjust opacity / vibrancy / material
    UI->>UI: optimistic update
    UI->>TRPCClient: call setOpacity / setVibrancy / setBackgroundMaterial
    TRPCClient->>TRPCServer: send mutation
    TRPCServer->>TRPCServer: validate input & platform
    TRPCServer->>Electron: apply appearance change
    Electron->>Electron: BrowserWindow applies appearance
    TRPCServer->>DB: upsert settings row (id=1)
    DB-->>TRPCServer: persist confirmation
    TRPCServer-->>TRPCClient: return result
    TRPCClient-->>UI: confirm or trigger rollback
    UI-->>User: reflect final state
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • PR #102: Adds the initial desktop TRPC window router and basic window controls; directly extended by the new appearance-specific mutations and wiring.

Poem

🐇✨ I hopped in, ears alight and cheery,
Opacity set soft, vibrancy not weary,
Materials gleam on Windows so bright,
The DB remembers through day and night,
A rabbit's nod — the window looks just right.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main feature addition: window opacity and blur settings to the appearance section.
Description check ✅ Passed The PR description provides a clear summary of changes and platform-specific behavior, though it doesn't follow the template structure with dedicated sections for Type of Change, Testing, and other template fields.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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 and usage tips.

@kkjcheng kkjcheng changed the title feat(desktop): Add window opacity and blur settings to appearance feat(desktop): add window opacity and blur settings to appearance Jan 24, 2026

@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: 2

🤖 Fix all issues with AI agents
In `@apps/desktop/src/main/windows/main.ts`:
- Around line 33-49: The catch in getWindowAppearanceSettings currently swallows
DB read errors; modify it to catch the error as a variable and call the module
logger (e.g., processLogger or the existing logger used in this file) to log a
prefixed message like "getWindowAppearanceSettings: failed to read appearance
settings" plus the error details when localDb.select().from(settings).get()
throws, then return the same default object; ensure you reference
getWindowAppearanceSettings and the localDb.select().from(settings).get() call
when adding the log.

In
`@apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/AppearanceSettings.tsx`:
- Around line 102-169: The mutation onError handlers (for setWindowOpacity,
setWindowVibrancy, and setWindowBackgroundMaterial) currently revert cache state
but swallow the error; update each onError to log the error with a clear prefix
(e.g., "AppearanceSettings:setWindowOpacity onError:",
"AppearanceSettings:setWindowVibrancy onError:",
"AppearanceSettings:setWindowBackgroundMaterial onError:") before performing the
existing revert logic—use console.error (or the app logging utility if
available) to include the error object and any relevant vars/context so failures
are diagnosable while keeping the current cache rollback and invalidate
behavior.
🧹 Nitpick comments (4)
apps/desktop/src/main/windows/main.ts (1)

57-60: Avoid hardcoded opacity constants.

Extract the 100 literal to a named constant to keep the opacity range centralized.

♻️ Suggested refactor
+const WINDOW_OPACITY_MAX = 100;
+
 function applyWindowAppearance(window: BrowserWindow) {
 	const { opacity, vibrancy, backgroundMaterial } =
 		getWindowAppearanceSettings();

 	// Apply opacity
-	if (opacity !== 100) {
-		window.setOpacity(opacity / 100);
+	if (opacity !== WINDOW_OPACITY_MAX) {
+		window.setOpacity(opacity / WINDOW_OPACITY_MAX);
 	}
As per coding guidelines, extract magic numbers to named constants.
apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/AppearanceSettings.tsx (1)

259-351: Extract opacity range literals into constants.

The min/max/step/default values are repeated magic numbers. Prefer a shared default and a named range constant.

♻️ Suggested refactor
 import {
 	WINDOW_BACKGROUND_MATERIALS,
 	WINDOW_VIBRANCY_OPTIONS,
 	type WindowBackgroundMaterial,
 	type WindowVibrancy,
 } from "@superset/local-db";
 import { electronTrpc } from "renderer/lib/electron-trpc";
+import { DEFAULT_WINDOW_OPACITY } from "shared/constants";
@@
 const MATERIAL_LABELS: Record<WindowBackgroundMaterial, string> = {
 	none: "None",
 	auto: "Auto",
 	mica: "Mica",
 	acrylic: "Acrylic",
 	tabbed: "Tabbed",
 };
+
+const WINDOW_OPACITY_RANGE = { MIN: 20, MAX: 100, STEP: 5 } as const;
@@
 								<Slider
-									value={[windowOpacity ?? 100]}
-									min={20}
-									max={100}
-									step={5}
+									value={[windowOpacity ?? DEFAULT_WINDOW_OPACITY]}
+									min={WINDOW_OPACITY_RANGE.MIN}
+									max={WINDOW_OPACITY_RANGE.MAX}
+									step={WINDOW_OPACITY_RANGE.STEP}
 									onValueChange={handleOpacityChange}
 									className="flex-1"
 								/>
 								<span className="text-sm text-muted-foreground w-12 text-right">
-									{windowOpacity ?? 100}%
+									{windowOpacity ?? DEFAULT_WINDOW_OPACITY}%
 								</span>
As per coding guidelines, extract magic numbers to named constants.
apps/desktop/src/lib/trpc/routers/settings/index.ts (1)

276-294: LGTM!

The opacity getter/setter procedures follow the established patterns in this file. The validation range (20-100) is correctly applied, and the upsert pattern is consistent.

Consider extracting the magic numbers 20 and 100 to named constants (e.g., MIN_WINDOW_OPACITY, MAX_WINDOW_OPACITY) in shared/constants to ensure consistency with the same validation in window.ts. As per coding guidelines, magic numbers should be extracted to named constants.

apps/desktop/src/lib/trpc/routers/window.ts (1)

103-114: LGTM!

The setVibrancy procedure correctly handles macOS-specific vibrancy with appropriate platform detection. The mapping of "none" to null correctly disables vibrancy via Electron's API.

Minor: The return type varies between { success: false } (line 107) and { success: false, reason: string } (line 109). For consistency and easier error handling by consumers, consider adding a reason field to the null-window case as well:

♻️ Suggested refinement
 		setVibrancy: publicProcedure
 			.input(z.object({ vibrancy: z.enum(WINDOW_VIBRANCY_OPTIONS) }))
 			.mutation(({ input }) => {
 				const window = getWindow();
-				if (!window) return { success: false };
+				if (!window) return { success: false, reason: "window not available" };
 				if (process.platform !== "darwin") {
 					return { success: false, reason: "vibrancy is only supported on macOS" };
 				}

Comment thread apps/desktop/src/main/windows/main.ts Resolved
Address CodeRabbit review feedback by logging errors instead of
silently swallowing them in the main process settings loader and
renderer mutation handlers.

@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

🤖 Fix all issues with AI agents
In
`@apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/AppearanceSettings.tsx`:
- Around line 123-124: The three mutations
(electronTrpc.window.setOpacity.useMutation(),
electronTrpc.window.setVibrancy.useMutation(),
electronTrpc.window.setBackgroundMaterial.useMutation()) currently swallow
errors; add onError handlers to each useMutation that call your logger (e.g.,
processLogger or the existing logger used in this file) with a clear prefixed
context like "AppearanceSettings: setOpacity failed", "AppearanceSettings:
setVibrancy failed", and "AppearanceSettings: setBackgroundMaterial failed" and
include the error object/details so failures are visible for debugging.
🧹 Nitpick comments (1)
apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/AppearanceSettings.tsx (1)

279-281: Extract window opacity slider constants
min/max/step/default are magic numbers. Please lift them into named constants at module top for clarity and reuse.

♻️ Suggested refactor
+const WINDOW_OPACITY_MIN = 0;
+const WINDOW_OPACITY_MAX = 100;
+const WINDOW_OPACITY_STEP = 5;
+const WINDOW_OPACITY_DEFAULT = 100;
-	value={[windowOpacity ?? 100]}
-	min={0}
-	max={100}
-	step={5}
+	value={[windowOpacity ?? WINDOW_OPACITY_DEFAULT]}
+	min={WINDOW_OPACITY_MIN}
+	max={WINDOW_OPACITY_MAX}
+	step={WINDOW_OPACITY_STEP}
-	{windowOpacity ?? 100}%
+	{windowOpacity ?? WINDOW_OPACITY_DEFAULT}%

As per coding guidelines, extract magic numbers to named constants.

Comment on lines +123 to +124
const applyWindowOpacity = electronTrpc.window.setOpacity.useMutation();

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.

⚠️ Potential issue | 🟡 Minor

Log failures when applying window effects
The apply mutations (setOpacity, setVibrancy, setBackgroundMaterial) have no onError logging, so failures are silent and hard to diagnose. Please log with a prefixed context.

🛠️ Suggested logging (apply to all three mutations)
-	const applyWindowOpacity = electronTrpc.window.setOpacity.useMutation();
+	const applyWindowOpacity = electronTrpc.window.setOpacity.useMutation({
+		onError: (err) => {
+			console.error("[appearance/apply-opacity] Failed to apply:", err);
+		},
+	});

-	const applyWindowVibrancy = electronTrpc.window.setVibrancy.useMutation();
+	const applyWindowVibrancy = electronTrpc.window.setVibrancy.useMutation({
+		onError: (err) => {
+			console.error("[appearance/apply-vibrancy] Failed to apply:", err);
+		},
+	});

-	const applyWindowBackgroundMaterial =
-		electronTrpc.window.setBackgroundMaterial.useMutation();
+	const applyWindowBackgroundMaterial =
+		electronTrpc.window.setBackgroundMaterial.useMutation({
+			onError: (err) => {
+				console.error("[appearance/apply-material] Failed to apply:", err);
+			},
+		});

Based on learnings, avoid swallowing errors silently.

Also applies to: 147-147, 173-174

🤖 Prompt for AI Agents
In
`@apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/AppearanceSettings.tsx`
around lines 123 - 124, The three mutations
(electronTrpc.window.setOpacity.useMutation(),
electronTrpc.window.setVibrancy.useMutation(),
electronTrpc.window.setBackgroundMaterial.useMutation()) currently swallow
errors; add onError handlers to each useMutation that call your logger (e.g.,
processLogger or the existing logger used in this file) with a clear prefixed
context like "AppearanceSettings: setOpacity failed", "AppearanceSettings:
setVibrancy failed", and "AppearanceSettings: setBackgroundMaterial failed" and
include the error object/details so failures are visible for debugging.

@kkjcheng
kkjcheng marked this pull request as draft January 24, 2026 04:07
@Kitenite

Copy link
Copy Markdown
Member

Closing: stale appearance feature PR from Jan 24 with no recent activity. Can be reopened if revisited.

@Kitenite Kitenite closed this Mar 13, 2026
@Kitenite

Copy link
Copy Markdown
Member

Hey — just a heads up, this was closed as part of an automated stale PR cleanup. If you think this was done in error, feel free to reopen it!

@Kitenite

Copy link
Copy Markdown
Member

Hey — this was closed by an automated cleanup of PRs with major merge conflicts that are 3+ weeks old. If you think this was done incorrectly, please feel free to reopen it. Sorry for any inconvenience!

sasha1107 added a commit to sasha1107/superset that referenced this pull request Jul 17, 2026
…#931)

Review surfaced the third macOS leak from microsoft/node-pty#907:
SetupExitCallback opens a kqueue per spawned pty to wait on NOTE_EXIT
and never closes it, leaking one fd per session against the daemon's
RLIMIT_NOFILE (distinct from the ptmx-cap leak). Extend the patch with
upstream's one-line fix (microsoft/node-pty#931, close(kq)).

Verified: 10 spawn/exit cycles leave kqueue fd count flat (was +1 per
session). New regression test mirrors upstream's, macOS-gated.
sasha1107 added a commit to sasha1107/superset that referenced this pull request Jul 20, 2026
…#931)

Review surfaced the third macOS leak from microsoft/node-pty#907:
SetupExitCallback opens a kqueue per spawned pty to wait on NOTE_EXIT
and never closes it, leaking one fd per session against the daemon's
RLIMIT_NOFILE (distinct from the ptmx-cap leak). Extend the patch with
upstream's one-line fix (microsoft/node-pty#931, close(kq)).

Verified: 10 spawn/exit cycles leave kqueue fd count flat (was +1 per
session). New regression test mirrors upstream's, macOS-gated.
sasha1107 added a commit to sasha1107/superset that referenced this pull request Jul 21, 2026
…#931)

Review surfaced the third macOS leak from microsoft/node-pty#907:
SetupExitCallback opens a kqueue per spawned pty to wait on NOTE_EXIT
and never closes it, leaking one fd per session against the daemon's
RLIMIT_NOFILE (distinct from the ptmx-cap leak). Extend the patch with
upstream's one-line fix (microsoft/node-pty#931, close(kq)).

Verified: 10 spawn/exit cycles leave kqueue fd count flat (was +1 per
session). New regression test mirrors upstream's, macOS-gated.
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.

2 participants