feat(desktop): "Start minimized" setting under Launch on login (cinny-desktop #3)
CI / Build & Quality Checks (push) Successful in 5m19s
CI / Docker image build & smoke test (push) Skipped
CI / Secret scan (gitleaks) (push) Successful in 24s
CI / Trigger Desktop Build (push) Successful in 9s
CI / Playwright smoke (e2e) (push) Successful in 15m37s
CI / Build & Quality Checks (push) Successful in 5m19s
CI / Docker image build & smoke test (push) Skipped
CI / Secret scan (gitleaks) (push) Successful in 24s
CI / Trigger Desktop Build (push) Successful in 9s
CI / Playwright smoke (e2e) (push) Successful in 15m37s
Shown only while Launch on login is on, and only when the native side answers `get_start_minimized` (older desktop builds just don't show it). Toggling calls `set_start_minimized`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e80b170fd1
commit
4a9823890b
@@ -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<boolean | null>(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 (
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
@@ -181,6 +194,15 @@ function AutostartSetting() {
|
||||
description="Start Lotus Chat automatically when you sign in to your computer."
|
||||
after={<Switch variant="Primary" value={enabled} onChange={handleChange} />}
|
||||
/>
|
||||
{enabled && startMinimized !== null && (
|
||||
<SettingTile
|
||||
title="Start minimized"
|
||||
description="When it starts at login, keep Lotus Chat in the system tray instead of opening the window. Notifications still arrive; click the tray icon to open it."
|
||||
after={
|
||||
<Switch variant="Primary" value={startMinimized} onChange={handleStartMinimized} />
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</SequenceCard>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user