Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix: drop the backdrop blurs that still cost CPU on Linux (#2505)

voide46a7a8dcd2e
diff --git a/CLAUDE.md b/CLAUDE.md
index 26c5767da..67ff65fbe 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -955,7 +955,10 @@ UI icons come from `src/components/icons/` (vendored Nucleo core outline compone
- Privacy settings button hidden in UI (not applicable on Linux)
- Recommend `pavucontrol` for audio device management
- **GPU compositing**: on, as on Windows, except whenever an NVIDIA kernel module (proprietary or open, any version) is loaded (`linuxGpuCompositing.js`, `/proc/driver/nvidia/version`): it flickered transparent windows in #203, Chromium's blocklist doesn't catch it, and explicit sync (driver 555+, Xwayland 24.1+, compositor support) can't be checked before app ready. Anyone else can turn it off with `--disable-gpu-compositing` in `open-whispr-flags.conf`, read by the packaged launcher (`scripts/lib/linux-launcher.js`). The mode is logged at startup, which only reaches the log file at `--log-level=debug`
-- **Dialog overlays**: the full-window dialog overlays (shared `Dialog`, Settings, Ctrl+K, referral) skip their default backdrop blur on Linux (`ui/overlayBlur.ts`), since Linux can still composite on the CPU, where a full-window blur is redrawn on every repaint inside the dialog (#2298); a blur passed through `overlayClassName` still applies
+- **Backdrop blurs**: Linux can still composite on the CPU, where a large blur is redrawn on every repaint above it (#2298):
+ - On Linux (`ui/overlayBlur.ts`), the full-window dialog overlays (shared `Dialog`, Settings, Ctrl+K, referral) skip their default backdrop blur; a blur passed through `overlayClassName` still applies
+ - On Linux, the note action overlay (`ActionProcessingOverlay`), whose scanner animation never stops, uses a denser scrim and an opaque card, so the scanner line passes behind the label
+ - Settings cards (`SettingsPanel`), the Settings selects and the `LanguageSelector` trigger sit on an opaque pane, so they carry no blur on any platform
- **Launch at login**: XDG autostart entry at `~/.config/autostart/open-whispr.desktop` (see `linuxAutostart.js`), since Electron's `setLoginItemSettings()` does nothing on Linux
- Disabling it from GNOME Tweaks or KDE's autostart editor is reflected in the Settings toggle
- "Start minimized" is handled app-side by the `startMinimized` setting, not by the desktop entry
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx
index 47c72cff5..0a8f8ce1c 100644
--- a/src/components/SettingsPage.tsx
+++ b/src/components/SettingsPage.tsx
@@ -108,7 +108,12 @@ import type {
InferenceMode,
} from "../types/electron";
import logger from "../utils/logger";
-import { SettingsRow, InferenceModeSelector } from "./ui/SettingsSection";
+import {
+ SettingsRow,
+ SettingsPanel,
+ SettingsPanelRow,
+ InferenceModeSelector,
+} from "./ui/SettingsSection";
import type { InferenceModeOption } from "./ui/SettingsSection";
import { useSettingsLayout } from "./ui/useSettingsLayout";
import { useUsage } from "../hooks/useUsage";
@@ -194,40 +199,10 @@ const UI_LANGUAGE_OPTIONS: import("./ui/LanguageSelector").LanguageOption[] = [
const RETENTION_DAY_OPTIONS = [1, 7, 14, 30, 60, 90];
const RETENTION_SELECT_CLASS =
- "h-7 rounded border border-border/70 bg-surface-1/80 px-2.5 text-xs font-medium text-foreground shadow-sm backdrop-blur-sm hover:border-border-hover hover:bg-surface-2/70 focus:outline-none focus:ring-2 focus:ring-ring/30 focus:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50 transition-colors duration-200";
+ "h-7 rounded border border-border/70 bg-surface-1/80 px-2.5 text-xs font-medium text-foreground shadow-sm hover:border-border-hover hover:bg-surface-2/70 focus:outline-none focus:ring-2 focus:ring-ring/30 focus:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50 transition-colors duration-200";
const noop = () => {};
-function SettingsPanel({
- children,
- className = "",
-}: {
- children: React.ReactNode;
- className?: string;
-}) {
- return (
- <div
- className={`rounded-lg border border-border/70 dark:border-border-subtle/70 bg-card/50 dark:bg-surface-2/50 backdrop-blur-sm divide-y divide-border/60 dark:divide-border-subtle/50 ${className}`}
- >
- {children}
- </div>
- );
-}
-
-function SettingsPanelRow({
- children,
- className = "",
-}: {
- children: React.ReactNode;
- className?: string;
-}) {
- const { isCompact } = useSettingsLayout();
-
- return (
- <div className={`${isCompact ? "px-3 py-2.5" : "px-4 py-3"} ${className}`}>{children}</div>
- );
-}
-
function SectionHeader({
title,
description,
@@ -3324,7 +3299,7 @@ export default function SettingsPage({
e.target.value as "bottom-right" | "center" | "bottom-left"
)
}
- className="h-7 rounded border border-border/70 bg-surface-1/80 px-2.5 text-xs font-medium text-foreground shadow-sm backdrop-blur-sm hover:border-border-hover hover:bg-surface-2/70 focus:outline-none focus:ring-2 focus:ring-ring/30 focus:ring-offset-1 transition-colors duration-200"
+ className="h-7 rounded border border-border/70 bg-surface-1/80 px-2.5 text-xs font-medium text-foreground shadow-sm hover:border-border-hover hover:bg-surface-2/70 focus:outline-none focus:ring-2 focus:ring-ring/30 focus:ring-offset-1 transition-colors duration-200"
>
<option value="bottom-right">
{t("settingsPage.general.floatingIcon.bottomRight")}
diff --git a/src/components/notes/ActionProcessingOverlay.tsx b/src/components/notes/ActionProcessingOverlay.tsx
index b35a805df..afca4d3ba 100644
--- a/src/components/notes/ActionProcessingOverlay.tsx
+++ b/src/components/notes/ActionProcessingOverlay.tsx
@@ -3,9 +3,17 @@ import { useTranslation } from "react-i18next";
import { Check } from "../icons";
import { cn } from "../lib/utils";
import { Button } from "../ui/button";
+import { blurBehindOverlays } from "../ui/overlayBlur";
import type { ActionProcessingState } from "../../hooks/useActionProcessing";
import type { NoteActionProgress } from "../../stores/actionProcessingStore";
+// The card's tint mixed into the background rather than laid over it: opaque, so on Linux, with
+// no blur, the scanner line passes behind the label instead of through it.
+const OPAQUE_ACCENT_CARD =
+ "bg-[color-mix(in_oklab,var(--color-accent)_6%,var(--color-background))] dark:bg-[color-mix(in_oklab,var(--color-accent)_8%,var(--color-background))]";
+const OPAQUE_SUCCESS_CARD =
+ "bg-[color-mix(in_oklab,var(--color-success)_6%,var(--color-background))] dark:bg-[color-mix(in_oklab,var(--color-success)_8%,var(--color-background))]";
+
interface ActionProcessingOverlayProps {
state: ActionProcessingState;
actionName: string | null;
@@ -46,10 +54,14 @@ export default function ActionProcessingOverlay({
const isFadingOut = state === "idle";
return (
+ // No blur on Linux: Linux can composite on the CPU, which would redraw it on every frame
+ // of the scanner animation for as long as an action runs (#2298). A denser tint stands in.
<div
className={cn(
"absolute inset-0 z-[5] flex items-center justify-center",
- "bg-background/60 dark:bg-background/70 backdrop-blur-md",
+ blurBehindOverlays
+ ? "bg-background/60 dark:bg-background/70 backdrop-blur-md"
+ : "bg-background/90",
"transition-opacity duration-300",
isFadingOut && "opacity-0 pointer-events-none"
)}
@@ -81,9 +93,17 @@ export default function ActionProcessingOverlay({
className={cn(
"relative flex flex-col items-center gap-2.5",
isSuccess
- ? "bg-success/6 dark:bg-success/8 border-success/12 dark:border-success/15"
- : "bg-accent/6 dark:bg-accent/8 border-accent/12 dark:border-accent/15",
- "backdrop-blur-xl border rounded-xl px-6 py-3 shadow-elevated",
+ ? "border-success/12 dark:border-success/15"
+ : "border-accent/12 dark:border-accent/15",
+ blurBehindOverlays
+ ? cn(
+ isSuccess ? "bg-success/6 dark:bg-success/8" : "bg-accent/6 dark:bg-accent/8",
+ "backdrop-blur-xl"
+ )
+ : isSuccess
+ ? OPAQUE_SUCCESS_CARD
+ : OPAQUE_ACCENT_CARD,
+ "border rounded-xl px-6 py-3 shadow-elevated",
"transition-colors duration-300"
)}
>
diff --git a/src/components/ui/LanguageSelector.tsx b/src/components/ui/LanguageSelector.tsx
index 4849e7d05..ab9798c3a 100644
--- a/src/components/ui/LanguageSelector.tsx
+++ b/src/components/ui/LanguageSelector.tsx
@@ -170,7 +170,7 @@ export default function LanguageSelector({
group relative w-full flex items-center justify-between gap-2
h-7 px-2.5 text-start
rounded text-xs font-medium
- border shadow-sm backdrop-blur-sm
+ border shadow-sm
transition-[background-color,border-color,transform] duration-200 ease-out
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-1
${
diff --git a/src/components/ui/SettingsSection.tsx b/src/components/ui/SettingsSection.tsx
index d661adefd..0367b5e7f 100644
--- a/src/components/ui/SettingsSection.tsx
+++ b/src/components/ui/SettingsSection.tsx
@@ -100,7 +100,7 @@ export function SettingsPanel({
}) {
return (
<Element
- className={`rounded-lg border border-border/70 dark:border-border-subtle/70 bg-card/50 dark:bg-surface-2/50 backdrop-blur-sm divide-y divide-border/60 dark:divide-border-subtle/50 ${className}`}
+ className={`rounded-lg border border-border/70 dark:border-border-subtle/70 bg-card/50 dark:bg-surface-2/50 divide-y divide-border/60 dark:divide-border-subtle/50 ${className}`}
>
{children}
</Element>
diff --git a/src/components/ui/overlayBlur.ts b/src/components/ui/overlayBlur.ts
index ca5157630..141c5e523 100644
--- a/src/components/ui/overlayBlur.ts
+++ b/src/components/ui/overlayBlur.ts
@@ -1,7 +1,8 @@
import { getCachedPlatform } from "../../utils/platform";
// Linux can still composite on the CPU (any NVIDIA driver, blocklisted drivers, or
-// --disable-gpu-compositing in the launcher's flags file), where a blur behind a full-window
-// overlay is redrawn on every repaint inside the dialog: hover lags and the GPU process pins
-// a core (#2298). The scrim alone dims the page there.
+// --disable-gpu-compositing in the launcher's flags file), where a blur behind a large overlay
+// is redrawn on every repaint above it: hover inside a dialog lags, and the note action
+// overlay's endless scanner animation keeps the GPU process at a full core (#2298). The scrim
+// alone dims the page there.
export const blurBehindOverlays = getCachedPlatform() !== "linux";
diff --git a/test/components/backdropBlurCost.test.js b/test/components/backdropBlurCost.test.js
new file mode 100644
index 000000000..01c42a491
--- /dev/null
+++ b/test/components/backdropBlurCost.test.js
@@ -0,0 +1,79 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+const { createElement } = require("react");
+const { renderToStaticMarkup } = require("react-dom/server");
+const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");
+
+// Linux can composite on the CPU, where a backdrop blur is redrawn on every repaint above it
+// (#2298). The harness renders i18n keys verbatim; the assertions only read classes.
+async function loadModule(t, file, platform) {
+ installBrowserGlobals(t);
+ const vite = await createRendererServer(t, {
+ cachePrefix: `openwhispr-backdrop-blur-${platform}-test-`,
+ mockModules: { "/utils/platform": `export const getCachedPlatform = () => "${platform}";` },
+ });
+ return vite.ssrLoadModule(file);
+}
+
+async function renderActionOverlay(t, platform, state) {
+ const mod = await loadModule(t, "/components/notes/ActionProcessingOverlay.tsx", platform);
+ return renderToStaticMarkup(createElement(mod.default, { state, actionName: "Generate Notes" }));
+}
+
+function cardClass(html) {
+ const match = html.match(/class="(relative flex flex-col[^"]*)"/);
+ assert.ok(match, "the overlay renders its card");
+ return match[1];
+}
+
+for (const [state, tint] of [
+ ["processing", "accent"],
+ ["success", "success"],
+]) {
+ test(`on Linux the ${state} overlay draws no backdrop blur and an opaque ${tint} card`, async (t) => {
+ const html = await renderActionOverlay(t, "linux", state);
+ const card = cardClass(html);
+
+ assert.doesNotMatch(html, /backdrop-blur/);
+ assert.match(html, /bg-background\/90/);
+ // The tint is mixed into the background, so the unblurred scanner line can't run through
+ // the label.
+ assert.match(card, new RegExp(`bg-\\[color-mix\\(in_oklab,var\\(--color-${tint}\\)_6%`));
+ assert.match(card, new RegExp(`dark:bg-\\[color-mix\\(in_oklab,var\\(--color-${tint}\\)_8%`));
+ assert.doesNotMatch(card, new RegExp(`bg-${tint}/\\d`));
+ });
+}
+
+test("on macOS a running action keeps its blur and translucent tints", async (t) => {
+ const html = await renderActionOverlay(t, "darwin", "processing");
+ const card = cardClass(html);
+
+ assert.match(html, /bg-background\/60/);
+ assert.match(html, /backdrop-blur-md/);
+ assert.match(card, /bg-accent\/6(?!\d)/);
+ assert.match(card, /backdrop-blur-xl/);
+ assert.doesNotMatch(card, /color-mix/);
+});
+
+test("a settings panel draws no backdrop blur on any platform", async (t) => {
+ // It sits on a solid pane, so the blur showed nothing, and scrolling Settings redrew it
+ // under every card on each frame.
+ const mod = await loadModule(t, "/components/ui/SettingsSection.tsx", "darwin");
+ const html = renderToStaticMarkup(createElement(mod.SettingsPanel, null, "row"));
+
+ assert.doesNotMatch(html, /backdrop-blur/);
+});
+
+test("the language picker's trigger draws no backdrop blur on any platform", async (t) => {
+ const mod = await loadModule(t, "/components/ui/LanguageSelector.tsx", "darwin");
+ const html = renderToStaticMarkup(
+ createElement(mod.default, {
+ value: "en",
+ onChange: () => {},
+ options: [{ value: "en", label: "English", flag: "🇺🇸" }],
+ })
+ );
+
+ assert.match(html, /English/);
+ assert.doesNotMatch(html, /backdrop-blur/);
+});