From 37b3ae1ad74a36d86e5ceb7f2c4081f1cf789dcb Mon Sep 17 00:00:00 2001 From: Lotus CI Date: Sun, 18 Oct 2026 02:41:04 -0400 Subject: [PATCH] fix(desktop): without a tray, the first-close dialog defaults to Quit (cinny-desktop #37) On desktops with no tray host (stock GNOME), "Keep running in the tray" hid the window with no icon to bring it back. Ask the desktop app (has_tray_host); without a tray, say so, focus "Quit when I close the window", and offer "Keep running in the background" as the secondary choice. Older desktop builds keep the current dialog. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5 --- src/app/components/CloseBehaviorPrompt.tsx | 66 ++++++++++++++++++---- 1 file changed, 56 insertions(+), 10 deletions(-) diff --git a/src/app/components/CloseBehaviorPrompt.tsx b/src/app/components/CloseBehaviorPrompt.tsx index b1bc7bbf7..6983b2e06 100644 --- a/src/app/components/CloseBehaviorPrompt.tsx +++ b/src/app/components/CloseBehaviorPrompt.tsx @@ -26,6 +26,10 @@ import { useModalStyle } from '../hooks/useModalStyle'; export function CloseBehaviorPrompt() { const [open, setOpen] = useState(false); const [launchOnLogin, setLaunchOnLogin] = useState(false); + // [cinny-desktop #37] Stock GNOME has no tray host: "keep running in the + // tray" would hide the window with no icon to bring it back. Older desktop + // builds lack the command; assume a tray then (the old behaviour). + const [hasTray, setHasTray] = useState(true); const modalStyle = useModalStyle(420); // Tells the native side we're listening (see get_close_behavior). @@ -34,7 +38,17 @@ export function CloseBehaviorPrompt() { tauriInvoke()?.('get_close_behavior').catch(() => undefined); }, []); - useTauriEvent('lotus-close-requested', () => setOpen(true)); + useTauriEvent('lotus-close-requested', () => { + const ask = tauriInvoke()?.('has_tray_host'); + if (!ask) { + setOpen(true); + return; + } + ask + .then((v) => setHasTray(v !== false)) + .catch(() => setHasTray(true)) + .finally(() => setOpen(true)); + }); const choose = useCallback( (value: 'tray' | 'quit') => { @@ -51,7 +65,7 @@ export function CloseBehaviorPrompt() { setOpen(false), @@ -80,8 +94,9 @@ export function CloseBehaviorPrompt() { - Lotus Chat can keep running in the system tray when you close this window, so - messages, notifications and calls still reach you. Open it again from the tray icon. + {hasTray + ? 'Lotus Chat can keep running in the system tray when you close this window, so messages, notifications and calls still reach you. Open it again from the tray icon.' + : "Your desktop doesn't show tray icons, so if Lotus Chat keeps running after you close this window, the only way back is to launch it again."} Start Lotus Chat when I sign in to my computer - - + {hasTray ? ( + <> + + + + ) : ( + <> + + + + )} You can change this in Settings → General.