feat(desktop): ask once what closing the window should do (cinny-desktop #5)
CI / Build & Quality Checks (push) Successful in 1m57s
CI / Docker image build & smoke test (push) Skipped
CI / Secret scan (gitleaks) (push) Successful in 15s
CI / Trigger Desktop Build (push) Successful in 9s
CI / Playwright smoke (e2e) (push) Canceled after 12m7s
CI / Build & Quality Checks (push) Successful in 1m57s
CI / Docker image build & smoke test (push) Skipped
CI / Secret scan (gitleaks) (push) Successful in 15s
CI / Trigger Desktop Build (push) Successful in 9s
CI / Playwright smoke (e2e) (push) Canceled after 12m7s
The first time the window is closed, a dialog asks "Keep Lotus Chat
running?" — Keep running in the tray (default, focused) / Quit when I
close the window — with an opt-in "Start Lotus Chat when I sign in"
checkbox in the same moment (per the approved design: one dialog, no
wizard). The choice is saved natively; Settings → General → "When I
close the window" changes it later (tray / quit / ask me).
The dialog is role="dialog" aria-modal, labelled and described, with
focus on the default button. Web-side flow verified with a stubbed
native side: event → dialog → checkbox + Quit sends autostart enable +
resolve_close_request("quit"); the Settings select saves "tray".
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
206a3e933a
commit
359c79a440
@@ -164,11 +164,18 @@ function AutostartSetting() {
|
||||
// [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);
|
||||
// [cinny-desktop #5] "ask" | "tray" | "quit"; null on builds without it.
|
||||
const [closeBehavior, setCloseBehavior] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
tauriInvoke()?.('plugin:autostart|is_enabled')
|
||||
.then((value) => setEnabled(value === true))
|
||||
.catch(() => undefined);
|
||||
tauriInvoke()?.('get_close_behavior')
|
||||
.then((value) => {
|
||||
if (typeof value === 'string') setCloseBehavior(value);
|
||||
})
|
||||
.catch(() => undefined);
|
||||
tauriInvoke()?.('get_start_minimized')
|
||||
.then((value) => {
|
||||
if (typeof value === 'boolean') setStartMinimized(value);
|
||||
@@ -181,6 +188,11 @@ function AutostartSetting() {
|
||||
setEnabled(value);
|
||||
};
|
||||
|
||||
const handleCloseBehavior = (value: string) => {
|
||||
invokeTauri('set_close_behavior', { value });
|
||||
setCloseBehavior(value);
|
||||
};
|
||||
|
||||
const handleStartMinimized = (value: boolean) => {
|
||||
invokeTauri('set_start_minimized', { value });
|
||||
setStartMinimized(value);
|
||||
@@ -194,6 +206,24 @@ function AutostartSetting() {
|
||||
description="Start Lotus Chat automatically when you sign in to your computer."
|
||||
after={<Switch variant="Primary" value={enabled} onChange={handleChange} />}
|
||||
/>
|
||||
{closeBehavior !== null && (
|
||||
<SettingTile
|
||||
title="When I close the window"
|
||||
description="Keep Lotus Chat running in the system tray (messages, notifications and calls keep arriving), or quit it. During a call, closing always keeps it running."
|
||||
after={
|
||||
<SettingsSelect
|
||||
value={closeBehavior}
|
||||
onChange={handleCloseBehavior}
|
||||
aria-label="When I close the window"
|
||||
options={[
|
||||
{ value: 'tray', label: 'Keep running in the tray' },
|
||||
{ value: 'quit', label: 'Quit Lotus Chat' },
|
||||
{ value: 'ask', label: 'Ask me' },
|
||||
]}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{enabled && startMinimized !== null && (
|
||||
<SettingTile
|
||||
title="Start minimized"
|
||||
|
||||
Reference in New Issue
Block a user