Skip to content

feat(sessions): optionally close the session when the shell exits - #16

Open
andreas-byfut wants to merge 1 commit into
LordOfPolls:masterfrom
andreas-byfut:fix/exit-closes-session
Open

andreas-byfut wants to merge 1 commit into
LordOfPolls:masterfrom
andreas-byfut:fix/exit-closes-session

Conversation

@andreas-byfut

Copy link
Copy Markdown
Contributor
  • New setting: "Close the tab when the shell exits", under a new Sessions section in Settings.
    It is off by default and included in config export and import.
    • Off keeps today's behaviour. A clean end leaves a DISCONNECTED tab with its output
      readable, and Reconnect is offered.
    • On closes the session on a clean exit. A clean exit is one where the shell ended without
      a connection error: exit, logout, or the server closing the session. Closing also
      disconnects the transport and any jump hosts, and lets the foreground service stop. The
      output is gone afterwards.
  • Last session closed: closing the last session now always returns to the menu, even with
    the SFTP browser open on top. This replaces the in-terminal "No open sessions" empty state.
  • Selection: closing the selected tab of several selects the first remaining one, instead of
    showing a blank pane.
  • Script runs: a script run that waits on a session which closes while still connecting now
    reports an error instead of waiting forever.

Tests: SessionManagerTest (clean drop with the setting on), ConfigImportTest.

Known limit: with the setting on, a script with "Close the session once the command finishes"
closes its tab, and its output with it.

Merge note: if this is merged after fix/terminal-mouse-and-clipboard, git reports one conflict in
the imports of SessionsScreen.kt. Keep the wheelNotches import and drop the EmptyState import.

Add a setting, "Close the tab when the shell exits", off by default and
included in config export/import. Off keeps the current behaviour: a
clean end leaves a DISCONNECTED tab with its output readable and
Reconnect available.

A clean exit is the shell ending without a connection error: exit or
logout, or the server closing the session. With the setting on, that
closes the session, which also disconnects the transport and any jump
hosts and lets the foreground service stop once nothing else is open.
The output is gone with the tab.

Closing the last session now always returns to the menu instead of an
empty terminal, including when another screen such as the SFTP browser
is open above it. This replaces the in-terminal "No open sessions"
empty state. Closing the selected tab of several selects the first
remaining one, and a script run waiting on a session that closes while
connecting now reports an error instead of waiting forever.
@LordOfPolls LordOfPolls added enhancement New feature or request needs-revision labels Nov 14, 2026
@LordOfPolls

Copy link
Copy Markdown
Owner

Hey, im fine with these changes as they stand, however this is currently failing on the CI lint test. Please can you revise?

For ref https://github.com/LordOfPolls/Shellwave/actions/runs/43396472401/job/132136598253?pr=16

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

Labels

enhancement New feature or request needs-revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants