Skip to content

feat(desktop): confirm before quitting - #5508

Open
Bil0000 wants to merge 5 commits into
pingdotgg:mainfrom
Bil0000:t3code/quit-confirmation-dialog
Open

feat(desktop): confirm before quitting#5508
Bil0000 wants to merge 5 commits into
pingdotgg:mainfrom
Bil0000:t3code/quit-confirmation-dialog

Conversation

@Bil0000

@Bil0000 Bil0000 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What

Quitting the desktop app now asks for confirmation first. Cmd/Ctrl+Q, the Quit menu item, and any other app-level quit go through the same before-quit path, so one prompt covers all of them.

The prompt is on by default and can be turned off in Settings → General → Quit confirmation (desktop only).

Demo

https://drive.google.com/file/d/1eSI7tWxmCG3p4uLLZqkkSU8maycnBueu/view?usp=sharing

How

  • confirmQuit joins the existing client settings (confirmThreadArchive / confirmThreadDelete neighbours), defaulting to true. The desktop main process already persists client settings to disk, so it reads the flag directly at quit time.
  • DesktopLifecycle's before-quit handler asks before it sets quitting and starts the shutdown sequence. Declining leaves the app exactly as it was; accepting runs the unchanged shutdown-then-quit path.
  • The dialog is attached to the main window and reveals it first (restore, show, focus). An unowned app-modal dialog can end up behind a background window — or invisible entirely against a minimized one — which reads as a frozen app that refuses to quit.
  • A quit is only confirmed when a window is actually on screen. Quits nobody asked for — the updater's relaunch, a second instance handing over, the last window closing on Windows/Linux, SIGINT/SIGTERM, a failed startup — stay silent, so the app can never be stranded running with no UI to bring it back.
  • Quitting again while a confirmation is still pending quits without asking twice. Dropping the repeat request instead would strand the app for good if the prompt were never answered.
  • Dialog failures fall through to quitting rather than trapping the user, and each quit branch logs its decision so a hang can be traced from the log alone.
  • The settings row is desktop-only, so its search catalog entry is flagged desktopOnly and filtered out of browser search rather than linking to an anchor that isn't rendered.

Tests

apps/desktop/src/app/DesktopLifecycle.test.ts covers: dismissing keeps the app running (no shutdown, quitting still false), accepting shuts down and quits, the dialog is owned by the revealed main window, the setting off skips the prompt, no window skips the prompt, and a repeat quit mid-confirmation quits without asking again. The existing updater-quit test is unchanged. settingsSearch.test.ts covers the browser-search filtering.

pnpm --filter @t3tools/desktop test (452 passed), contracts/web/desktop/client-runtime typechecks and pnpm lint are clean. One pre-existing, unrelated web test (imageCompression canvas timeout) fails on this machine before and after the change.

Note

Add quit confirmation dialog to the desktop app with a toggle in General settings

  • Adds a confirmQuit boolean to ClientSettingsSchema (default true) and exposes a 'Quit confirmation' toggle in the General settings panel, desktop-only.
  • Before quitting, handleBeforeQuit now prevents the default quit, optionally shows a window-modal confirmation dialog via ElectronDialog.showMessageBox, and defers the actual quit until shutdown completes.
  • Repeated quit attempts while a confirmation is pending skip the dialog and proceed directly; updater-driven quits bypass confirmation entirely.
  • The settings search catalog gains a desktopOnly flag so the 'Quit confirmation' entry is hidden from browser search results.
  • Behavioral Change: on desktop, closing the app now shows a confirmation dialog by default unless confirmQuit is disabled or no windows are open.

Macroscope summarized c0a33cb.

Bil0000 added 3 commits August 6, 2026 13:03
Desktop clients read it before quitting; defaults to on.
Cmd/Ctrl+Q and the Quit menu item now prompt before the shutdown
sequence starts, unless the user turned the setting off. Quits with no
window on screen (updater relaunch, second instance, last window closed,
signals) stay silent so the app can never be stranded without UI.
Desktop-only General row, on by default, included in restore defaults.
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 6, 2026
Comment thread apps/web/src/components/settings/settingsSearch.ts
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f0014f0b-0b80-45e6-a81e-313338340e0d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Bil0000 added 2 commits August 6, 2026 13:25
The confirmation was app-modal with no owner, so a hidden or minimized
window could leave a prompt the user never sees, and the in-flight guard
then swallowed every later quit request — the app looked frozen and could
not be closed even with the setting turned off.

The dialog is now attached to the main window and reveals it first, and a
repeat quit request while a confirmation is pending quits instead of being
dropped. Logs the resolved quit path so a hang can be traced.
The quit confirmation row only renders in the desktop app, so a browser
search hit linked to an anchor that does not exist.
@Bil0000
Bil0000 marked this pull request as ready for review August 6, 2026 13:38
@macroscopeapp

macroscopeapp Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces a new user-facing feature (quit confirmation dialog) that changes the app's lifecycle behavior. New features with runtime behavior changes warrant human review to ensure the UX and implementation align with product expectations.

You can customize Macroscope's approvability policy. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant