This was generated by AI during triage.
Problem
If you accidentally close a session (e.g. via Ctrl+W, the sidebar ✕, or the terminal toolbar close button) and only afterwards realize you still needed it, there is currently no easy way to get it back. Once MainViewModel.OnSessionCloseRequested removes the session, SessionManager.RemoveSession() drops the ShellSession from state.json — and on the next save the prior state is gone. The user has to recreate the session from scratch and lose any captured terminal scrollback / FTS5 history that was associated with it.
Sleep/wake (💤) already solves the intentional "keep it around for later" case, but does not help when the close was a mistake.
Proposed direction (open to discussion)
Two complementary ideas, either or both:
- Undo last close — a short-lived buffer of the most recently closed sessions. Reachable via:
Ctrl+Shift+T (mirrors browsers / Windows Terminal)
- A "Reopen closed session" entry in the
+ button's dropdown (if there is one) or in a tray-icon / sidebar context menu
The reopened session would relaunch its PTY just like a wake-from-dormant.
- Suggestions in New Session dialog — when the user opens
NewSessionDialog, show a small "Recently closed" list (last N, e.g. 5) above the existing form. Clicking one pre-fills all fields (folder, command, SSH config, profile overrides, run commands) — or, more directly, recreates the session immediately with the same settings.
Open questions
- How long do we keep "recently closed" entries? Just for the current run, or persisted across app restarts (e.g. last 10 in
state.json)?
- Do we keep the underlying SQLite FTS5 output history when a session is closed so that a "reopen" can keep prior scrollback searchable? Today
OutputIndexer writes everything to a single DB — we'd need a way to mark rows as belonging to a closed session and either keep or evict them.
- Does "reopen" want to be exactly the same as wake-from-dormant (same
ShellSession, same Id) — meaning we essentially keep a tombstoned dormant entry for a while — or should it create a new session with copied settings?
- Should there be a confirmation prompt on
Ctrl+W (configurable in settings) as a complementary safety net, or do we lean entirely on the undo path?
Acceptance
Problem
If you accidentally close a session (e.g. via
Ctrl+W, the sidebar✕, or the terminal toolbar close button) and only afterwards realize you still needed it, there is currently no easy way to get it back. OnceMainViewModel.OnSessionCloseRequestedremoves the session,SessionManager.RemoveSession()drops theShellSessionfromstate.json— and on the next save the prior state is gone. The user has to recreate the session from scratch and lose any captured terminal scrollback / FTS5 history that was associated with it.Sleep/wake (💤) already solves the intentional "keep it around for later" case, but does not help when the close was a mistake.
Proposed direction (open to discussion)
Two complementary ideas, either or both:
Ctrl+Shift+T(mirrors browsers / Windows Terminal)+button's dropdown (if there is one) or in a tray-icon / sidebar context menuThe reopened session would relaunch its PTY just like a wake-from-dormant.
NewSessionDialog, show a small "Recently closed" list (last N, e.g. 5) above the existing form. Clicking one pre-fills all fields (folder, command, SSH config, profile overrides, run commands) — or, more directly, recreates the session immediately with the same settings.Open questions
state.json)?OutputIndexerwrites everything to a single DB — we'd need a way to mark rows as belonging to a closed session and either keep or evict them.ShellSession, same Id) — meaning we essentially keep a tombstoned dormant entry for a while — or should it create a new session with copied settings?Ctrl+W(configurable in settings) as a complementary safety net, or do we lean entirely on the undo path?Acceptance
CLAUDE.mdunder "Keyboard Shortcuts"