feat(desktop): add a setting to turn the running-terminal close warning back on

Merged
KI
20d ago
+172-0

Summary

  • Add a Warn before closing a running terminal switch to Settings → Terminal. Once someone ticks "Don't ask again", this is the only UI that can turn the close warning back on.
  • Add a settings-search entry (close, delete, tab, port, warn, confirm…) and translations for all 16 locales.

Why / Context

The close-terminal confirm (#5517), which the close-port confirm (#6007) reuses, has a "Don't ask again" checkbox. Ticking it sets suppressed: true in the persisted terminal-close-confirm-v1 store. The store has a reset() action, but nothing calls it and no settings page reads the store. Users who ticked the box lost the warning for good, and only clearing localStorage brought it back.

How It Works

  • CloseConfirmSetting reads the existing useTerminalCloseConfirmStore: the switch is !suppressed, on calls reset(), off calls suppress().
  • The dialog checkbox and the switch share one flag, so they stay in sync. The flag covers both terminal/tab close and port close, and the description says so.
  • No new persisted key (terminal-close-confirm-v1 is already registered) and no tRPC change.

Manual QA Checklist

  • Settings → Terminal shows the switch, on by default
  • Close a terminal running sleep 100, tick "Don't ask again" → the switch now shows off
  • Turn the switch back on → closing a running terminal prompts again
  • Turn it off → closing a running terminal, a tab with one, or an in-use port closes without a prompt
  • Searching "close" or "warn" in settings finds the item

Testing

  • bun test src/renderer/routes/_authenticated/settings/utils/settings-search (18 pass)
  • bun run check:i18n (passes, all locales translated)
  • biome check on the settings directory
  • bun run typecheck in apps/desktop: 27 errors, none in changed files. All are better-auth type errors in packages/auth, packages/trpc and some desktop route files.
  • Not yet verified in the running app: no dev build was available in this session. The QA checklist above is still open.

Summary by cubic

Adds a Settings → Terminal switch to turn the running-terminal close warning back on. Ticking "Don't ask again" in the close-terminal or close-port dialog previously suppressed the warning with no UI to restore it.

  • The switch reads and writes the same persisted store as the dialog checkbox, so they stay in sync.
  • Adds a settings-search entry and translations for all 16 locales. No new persisted key or tRPC changes.

Summary by CodeRabbit

  • New Features

    • Added a terminal setting to warn before closing terminals, tabs, or ports with running processes.
    • Added an option to warn before closing a running terminal.
    • Confirmation warnings can be enabled or disabled from Terminal Settings.
  • Localization

    • Added translated setting labels and warning messages across supported languages.