Session Restore#
Nash records restorable window layouts and writes them to disk. A later launch can put any of those windows or tabs back. Since 0.11.9, server-owned mux panes are excluded; reconnect to them instead.
Restoring is always your choice. Nash saves automatically, but it never reopens windows by itself. You open the restore dialog when you want your layout back.
Quick start#
- Work as usual. Quit Nash, log out, restart the machine, or update Nash.
- Start Nash.
- Open the command palette and run Restore Saved Session. The command is
also in the Shell menu, and the bundled configuration binds it to
ALT+r. - Choose a save. Press SUPER+Enter (Cmd+Enter on macOS) to restore all its windows, or press Enter to browse its windows and then their tabs. Enter on a tab restores just that tab. See The Restore Dialog for every key.
Session restore needs Nash 0.2.0 or newer. Nash 0.8.1 or newer also keeps the layout of windows you close one at a time. 0.9.4 adds a history of saves and a three-level restore picker.
What Nash saves#
| Level | What is saved |
|---|---|
| Window | The title, the session (workspace) name, the size, the order of its tabs, and the active tab. |
| Tab | The name, but only if you renamed the tab. The tab color, the Zen Mode state, and the active pane. |
| Pane | The split layout and proportions, the working directory, and the last command with its running state. |
| Pane | Which pane is active, which pane is zoomed, and which panes are folded. |
| Global | The global Zen Mode state, which Nash reads back at launch. |
Program-generated titles help identify panes in the picker, but a restored pane reports its own title after it starts. Explicit tab names are restored.
For what Nash does not save, and which commands run again after a restore, see Limits and Troubleshooting.
Where the saves live#
In Nash 0.9.4, each save has its own file in:
~/.config/nash/state/saved-sessions/
The directory moves with your configuration directory. If you set
NASH_CONFIG_DIR or XDG_CONFIG_HOME, state/saved-sessions/ is inside that
directory. Saves survive application updates. Keeping them below state/ also
avoids triggering a configuration reload each time Nash saves.
- Different layouts are kept separately. Starting Nash without restoring, then quitting its plain default window, no longer overwrites your old layout.
- The same layout is listed once, with the time and details of its newest save. Nash compares windows, workspaces, tab order, explicit tab names, colors, split trees, pane directories, running commands, and fold state. Sizes, focus, zoom, Zen Mode, generated titles, IDs, and timestamps do not make a layout distinct.
- The 50 newest saves are kept. Older saves are removed first.
- Unreadable files are preserved. The picker counts them without hiding saves it can read.
Each file is written through a temporary file and a rename, so a reader never sees half a save. Concurrent Nash processes write separate files.
Earlier versions used a single state/window-tab-state.json snapshot.
When Nash saves#
| Moment | Platforms |
|---|---|
| You run Save Window Session from the command palette or the Shell menu | All |
| You quit Nash from the menu, a key binding, or the command palette | All |
| You close the last window and Nash exits | All |
| You log out, or the machine shuts down or restarts | macOS, Windows |
Nash receives SIGTERM, SIGINT, SIGHUP, or SIGQUIT | macOS, Linux |
Despite its name, Save Window Session saves all restorable window
content, plus the closed windows retained during this run, not just the
current window. It has no default key binding; bind the SaveSession action if
you want one. An in-app notification reports the result.
Nash does not save on a timer. A kill -9, a crash, or a power loss skips the
save, so the snapshot then shows the layout from the last save. Run Save
Window Session after you build a layout that you cannot lose.
A snapshot with no windows is not saved. A new save with a different layout never overwrites an earlier one.
Windows you closed before quitting#
Closing windows one at a time is a normal way to quit. A snapshot taken after the last window closed would describe nothing, so Nash captures the final layout of each window at the moment it closes. These captured layouts stay in memory until Nash writes a snapshot on exit or you run Save Window Session. Closing one window while others stay open does not itself write a save to disk.
- Nash keeps the 8 most recent closed windows. It drops the oldest first.
- The dialog lists these windows after the windows that were still open, and it
marks each one with a
closedlabel. - A window whose last pane simply exited has nothing to restore, so Nash does not keep it. Nash also skips short-lived windows such as the configuration error window.
- The list covers one run of Nash. The next launch starts it empty, so the individual save describes one session rather than every window you ever had. Earlier sessions remain available in the save history.
Multiplexer panes in 0.11.9#
Since Nash 0.11.9, GUI saves leave out live windows owned entirely by
detachable mux domains, as well as closed windows that only detached. In mixed
layouts, only restorable local content is kept. Use nash mux connect to return
to the server's still-running panes. A saved GUI layout is not a mux-server
checkpoint: stopping or restarting the server ends its processes.
Explicitly closing a mux tab is different from closing its GUI window.
ReopenClosedTab can remember an explicitly closed tab while its spawnable
domain is attached, provided the window remains open. Reopening restores its
position, color, tab Zen flag, and split layout, but starts new processes.
It may replay commands that were running, requires shell integration to identify
them, and does not restore scrollback. This in-memory closed-tab list is
separate from the saved-session history. Closing a GUI window normally detaches
mux panes; it does not create a closed tab to reopen.
Version history#
| Nash version | Change |
|---|---|
| 0.2.0 | Nash saves and restores windows, tabs, panes, and working directories. |
| 0.5.7 | The snapshot moves to ~/.config/nash/state/ and survives application updates. |
| 0.7.0 | Folded panes and explicit tab names survive a restore. |
| 0.8.1 | Nash saves every window layout on quit, logout, and one-by-one closing. |
| 0.8.1 | The restore dialog shows tab and pane counts, programs, and closed windows. |
| 0.9.0 | nash update reminds you that Nash saves the session on exit. |
| 0.9.4 | Nash keeps up to 50 saves and offers a save → window → tab restore picker. |
| 0.11.9 | GUI saves exclude detachable mux content; closed mux tabs can reopen. |
Related pages#
- The Restore Dialog
- Limits and Troubleshooting
- Named Workspace Sessions, a separate feature with its own key bindings
- Multiplexer sessions, for panes that must keep running while Nash is closed
- Update Nash from the command line, which keeps your layout across a restart
- The blog post Your Layout Comes Back