feat(desktop): confirm before quitting - #5508
Conversation
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.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
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.
ApprovabilityVerdict: 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. |
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-quitpath, 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
confirmQuitjoins the existing client settings (confirmThreadArchive/confirmThreadDeleteneighbours), defaulting totrue. The desktop main process already persists client settings to disk, so it reads the flag directly at quit time.DesktopLifecycle'sbefore-quithandler asks before it setsquittingand starts the shutdown sequence. Declining leaves the app exactly as it was; accepting runs the unchanged shutdown-then-quit path.desktopOnlyand filtered out of browser search rather than linking to an anchor that isn't rendered.Tests
apps/desktop/src/app/DesktopLifecycle.test.tscovers: dismissing keeps the app running (no shutdown,quittingstill 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.tscovers the browser-search filtering.pnpm --filter @t3tools/desktop test(452 passed), contracts/web/desktop/client-runtime typechecks andpnpm lintare clean. One pre-existing, unrelated web test (imageCompressioncanvas 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
confirmQuitboolean toClientSettingsSchema(defaulttrue) and exposes a 'Quit confirmation' toggle in the General settings panel, desktop-only.handleBeforeQuitnow prevents the default quit, optionally shows a window-modal confirmation dialog viaElectronDialog.showMessageBox, and defers the actual quit until shutdown completes.desktopOnlyflag so the 'Quit confirmation' entry is hidden from browser search results.confirmQuitis disabled or no windows are open.Macroscope summarized c0a33cb.