diff --git a/src/app/features/settings/general/General.tsx b/src/app/features/settings/general/General.tsx index 9cafa1a8c..cfdedc137 100644 --- a/src/app/features/settings/general/General.tsx +++ b/src/app/features/settings/general/General.tsx @@ -161,11 +161,19 @@ function DesktopChromeSetting() { */ function AutostartSetting() { const [enabled, setEnabled] = useState(false); + // [cinny-desktop #3] null until the native side answers (older builds don't + // have the command, so the switch just stays hidden there). + const [startMinimized, setStartMinimized] = useState(null); useEffect(() => { tauriInvoke()?.('plugin:autostart|is_enabled') .then((value) => setEnabled(value === true)) .catch(() => undefined); + tauriInvoke()?.('get_start_minimized') + .then((value) => { + if (typeof value === 'boolean') setStartMinimized(value); + }) + .catch(() => undefined); }, []); const handleChange = (value: boolean) => { @@ -173,6 +181,11 @@ function AutostartSetting() { setEnabled(value); }; + const handleStartMinimized = (value: boolean) => { + invokeTauri('set_start_minimized', { value }); + setStartMinimized(value); + }; + if (!isTauriEnv()) return null; return ( @@ -181,6 +194,15 @@ function AutostartSetting() { description="Start Lotus Chat automatically when you sign in to your computer." after={} /> + {enabled && startMinimized !== null && ( + + } + /> + )} ); }