Session persistence
DropTerm saves the tab layout and reopens it on every launch.
Restore spawns one fresh shell per saved tab, in its saved working
directory, with its title. The tab focused when the session was saved is
focused again. A WSL tab restores the same way, in its saved Linux folder:
the folder rides the spawn's --cd, inside the same distribution the tab
names. You toggle the feature with session_persistence_enabled (default
true, the Tabs page of the Settings). Setting it to false
stops saves and skips restore at launch - the app starts with a single
fresh tab, and the existing session.ron is left untouched on disk, so
re-enabling picks the session back up.
What is saved - the same scope Guake and Yakuake settle on - is the session's ten schema fields:
| Field | What it holds |
|---|---|
version | a schema version |
active | the tab focused when the session was saved |
tabs | the tab list in tab-bar order |
per-tab title | the tab's title |
per-tab title_override | a user rename, if any |
per-tab shell | the shell recorded when the tab was spawned |
per-tab cwd | the tab's cwd at save time (the shell's own report on Windows - a shell that reports none saves none, and the tab restores with no folder, the accepted degrade) |
per-tab profile | the profile id a tab launched under (if any) |
per-tab pinned | whether the tab is pinned (pinned) |
per-tab label | the tab's label, a { text, color } pair, when it wears one (label) |
Scrollback, environment, and running processes are deliberately not saved: a restored
tab is a fresh spawn - your shell, or a profile's command - in a familiar
place, never a resumed program. Each tab's shell is recorded at spawn, so
changing the configured shell mid-run only affects newly opened tabs.
Profile tabs are the explicit opt-in that makes a command tab persistent
where a raw --cmd tab deliberately is not. The session saves the id beside
the cwd, and restore re-resolves it against the current config, so a
profile edited between save and relaunch launches the edited command. A
saved id the list no longer carries falls back to a plain shell in the
re-validated saved cwd - it never chains through default_profile.
A pinned tab restores pinned (the per-tab context menu's Pin/Unpin row):
after the restart it refuses user closes and stays put as before, in its
saved order. The pinned field rides the same additive rule as profile -
a session file written before pins existed loads with every tab unpinned,
and the schema version is unchanged.
A label restores with its tab, the same way. The label field rides that
additive rule too: a file written before labels existed loads with every tab
unlabelled, and the version is unchanged.
Saving happens on every layout change (open, close, reorder, rename, tab
switch, or a shell's cd), debounced so continuous changes coalesce into
one write within half a second. Each write is atomic - serialize to a temp
file next to the target, fsync, rename it over the file that was there - so
a crash mid-write leaves the previous session intact. Trade-off: a hard kill
can lose the last ~500 ms of layout changes.
The state lives in its own file, fully separate from the config (the directory is created on first save):
~/.local/state/io.github.l1br3_io.dropterm/session.ron
($XDG_STATE_HOME is honored when set to an absolute path. On macOS the file lives at ~/Library/Application Support/io.github.l1br3_io.dropterm/session.ron instead. On Windows it lives at %LOCALAPPDATA%\io.github.l1br3_io.dropterm\session.ron, with the engine's history.ron beside it. An absolute $XDG_STATE_HOME still wins.)
| On failure | What happens |
|---|---|
| First run (no state file) | silent - a single fresh tab, no warnings. |
| A corrupt, unreadable, or future-versioned file | moved to session.ron.bak (replacing any older backup), logged at warn, and the app starts fresh. Rename it back to session.ron to give it another chance. |
A saved cwd that no longer exists | that shell spawns in $HOME (a profile tab first tries the profile's current cwd, then $HOME). |
Where to read more: the session_persistence_enabled row in configuration and the Tabs page of Settings. The profile fields a session saves are in configuration.