perf(desktop): reduce CPU/GPU overhead in Tauri shell

- SSH monitor: adaptive polling 2s→10s after stabilization, cheap TCP
  probe before expensive SSH subprocess check
- SSH setup: exponential backoff in wait_for_master_ready and
  wait_local_forward_ready (250ms→2s cap)
- Health checks: exponential backoff (100ms→1s / 250ms→2s) instead of
  flat intervals
- Startup recovery poll: cap at 15 retries instead of infinite
- Remove webview log target in release builds (eliminates IPC overhead)
- Set global NO_PROXY env var at startup for all loopback addresses
- Remove reqwest::blocking feature; use raw TCP for sidecar shutdown and
  SSH health checks
- Disable pinch-to-zoom on macOS via WKWebView.setAllowsMagnification
- Add WebView2 browser args on Windows (proxy bypass + disable unused
  UI features)
- Add Cargo release profile: thin LTO, codegen-units=1, strip
- Extract apply_platform_window_config for consistent window setup
- Add vibrancy toggle in Appearance settings (macOS desktop only) with
  solid background fallback when disabled
This commit is contained in:
Bohdan Triapitsyn
2026-04-01 11:54:35 +03:00
parent 14fc741cc9
commit c38e00bd85
10 changed files with 355 additions and 76 deletions
@@ -19,7 +19,7 @@ import {
SelectTrigger,
SelectValue,
} from '@/components/ui/select';
import { isDesktopShell, isVSCodeRuntime, isWebRuntime } from '@/lib/desktop';
import { isDesktopShell, isVSCodeRuntime, isWebRuntime, desktopSetVibrancy } from '@/lib/desktop';
import { useDeviceInfo } from '@/lib/device';
import { usePwaDetection } from '@/hooks/usePwaDetection';
import { updateDesktopSettings } from '@/lib/persistence';
@@ -209,6 +209,7 @@ export const OpenChamberVisualSettings: React.FC<OpenChamberVisualSettingsProps>
} = useThemeSystem();
const [themesReloading, setThemesReloading] = React.useState(false);
const [vibrancyEnabled, setVibrancyEnabled] = React.useState(true);
const [chatRenderPreviewTick, setChatRenderPreviewTick] = React.useState(0);
const reportUsage = useUIStore(state => state.reportUsage);
const setReportUsage = useUIStore(state => state.setReportUsage);
@@ -219,6 +220,28 @@ export const OpenChamberVisualSettings: React.FC<OpenChamberVisualSettingsProps>
void updateDesktopSettings({ reportUsage: enabled });
}, [setReportUsage]);
const isMacDesktop = React.useMemo(() => {
if (!isDesktopShell()) return false;
if (typeof navigator === 'undefined') return false;
return /Macintosh|Mac OS X/.test(navigator.userAgent || '');
}, []);
React.useEffect(() => {
if (!isMacDesktop) return;
const stored = localStorage.getItem('desktopVibrancy');
if (stored !== null) {
setVibrancyEnabled(stored !== 'false');
}
}, [isMacDesktop]);
const handleVibrancyChange = React.useCallback((enabled: boolean) => {
setVibrancyEnabled(enabled);
localStorage.setItem('desktopVibrancy', String(enabled));
document.documentElement.classList.toggle('no-vibrancy', !enabled);
void desktopSetVibrancy(enabled);
void updateDesktopSettings({ desktopVibrancy: enabled });
}, []);
const shouldAnimateChatPreview = isSettingsDialogOpen
&& (visibleSettings ? visibleSettings.includes('chatRenderMode') : true);
@@ -503,6 +526,24 @@ export const OpenChamberVisualSettings: React.FC<OpenChamberVisualSettingsProps>
</Tooltip>
</div>
{isMacDesktop && (
<div className="flex items-center gap-2 py-1.5">
<Checkbox
checked={vibrancyEnabled}
onChange={handleVibrancyChange}
ariaLabel="Toggle window vibrancy"
/>
<div className="flex min-w-0 flex-col">
<span className="typography-ui-label text-foreground">
Window vibrancy
</span>
<span className="typography-meta text-muted-foreground">
Translucent window background. Disabling may reduce energy usage.
</span>
</div>
</div>
)}
{showPwaInstallNameSetting && (
<div className="py-1.5 space-y-1.5">
<div className="flex min-w-0 flex-col">