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.