fix(desktop): show the Lotus titlebar only when the native frame is really gone
CI / Build & Quality Checks (push) Skipped
CI / Secret scan (gitleaks) (push) Skipped
CI / Playwright smoke (e2e) (push) Skipped
CI / Secret scan (gitleaks) (pull_request) Successful in 23s
CI / Build & Quality Checks (pull_request) Successful in 6m38s
CI / Trigger Desktop Build (pull_request) Skipped
CI / Docker image build & smoke test (pull_request) Skipped
CI / Playwright smoke (e2e) (pull_request) Successful in 30m5s

On Linux / Wayland the desktop can't strip the window frame at runtime,
so turning on custom window chrome drew the Lotus titlebar inside KDE's
frame (two sets of window buttons). The desktop's `set_custom_chrome`
now answers whether the frame is stripped right now; the titlebar and
layout follow that answer (falling back to the setting for older
desktop builds), so there's never two titlebars or none. The setting
says it applies on next start on Linux / Wayland.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
This commit is contained in:
2026-11-09 21:42:27 -05:00
co-authored by Claude Opus 5.5
parent 30b5a7d6af
commit 38871d3e56
5 changed files with 46 additions and 11 deletions
+23 -6
View File
@@ -1,7 +1,7 @@
import { useEffect } from 'react';
import { useAtomValue } from 'jotai';
import { customWindowChromeAtom } from '../state/customWindowChrome';
import { invokeTauri, isTauri } from './useTauri';
import { useAtomValue, useSetAtom } from 'jotai';
import { customWindowChromeAtom, nativeChromeActiveAtom } from '../state/customWindowChrome';
import { isTauri, tauriInvoke } from './useTauri';
/**
* P5-47 — drive the native window frame from the `customWindowChromeAtom`.
@@ -11,12 +11,29 @@ import { invokeTauri, isTauri } from './useTauri';
* web `<TitleBar/>` can take over, `enabled = false` restores the native frame.
* No-op in the browser (`isTauri()` guard), so it's safe to call unconditionally
* from the app shell.
*
* The command answers whether the native frame is stripped *now* (on Linux /
* Wayland the frame only changes at the next launch); that drives whether the
* Lotus titlebar is shown. Older desktop builds answer nothing, so the setting
* is used as before.
*/
export function useTauriWindowChrome(): void {
const enabled = useAtomValue(customWindowChromeAtom);
const setNativeActive = useSetAtom(nativeChromeActiveAtom);
useEffect(() => {
if (!isTauri()) return;
invokeTauri('set_custom_chrome', { enabled });
}, [enabled]);
const invoke = isTauri() ? tauriInvoke() : undefined;
if (!invoke) return undefined;
let cancelled = false;
invoke('set_custom_chrome', { enabled })
.then((active) => {
if (!cancelled) setNativeActive(typeof active === 'boolean' ? active : enabled);
})
.catch(() => {
if (!cancelled) setNativeActive(enabled);
});
return () => {
cancelled = true;
};
}, [enabled, setNativeActive]);
}