Session Restore
Nash records the layout of every window and writes it to disk. A later launch can put any of those windows or tabs back.
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 every open window, 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.
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. |
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