Save and restore tmux pane layouts per directory
Find a file
2026-01-29 22:03:05 +01:00
README.md feat(cli): improve layout workflows and discoverability for tmux helpers 2026-01-29 22:03:05 +01:00
tmsave.sh feat(tmre): add delete flag to remove saved layouts 2026-01-29 22:03:05 +01:00

tmsave

Save and restore tmux pane layouts per directory.

Installation

Source the script in your shell config:

source /path/to/tmsave.sh

Dependency: jq (for JSON parsing on restore)

Usage

Save layout

cd ~/myproject
# Set up your panes how you like them
tmsave

Restore layout

cd ~/myproject
tmre

Apply layout from another directory (git worktrees)

Pass a directory to load its layout and apply it to your current directory. Subdirectory panes are mapped relatively.

# You have a layout saved for your main worktree
cd ~/myproject-feature-branch
tmre ~/myproject

# Pane that was at ~/myproject/ui → opens at ~/myproject-feature-branch/ui

List saved layouts

tmlist          # Human-readable table
tmlist --json   # JSON array for scripting

Move layout to new path

When you relocate a project:

tmsavemv ~/old/path ~/new/path

Help

All commands support -h / --help:

tmsave --help
tmre --help
tmlist --help
tmsavemv --help

How it works

  • Layouts are stored in ~/.local/share/tmsave/layouts/
  • Indexed by base64-encoded directory path
  • Saves: pane geometry, subdirectory paths, active pane
  • Restores: recreates panes, applies layout, cds into subdirectories only where needed

Notes

  • Run tmsave from the project root directory
  • Panes in subdirectories are restored with relative cd
  • Panes outside the base directory stay at the base on restore (warning shown on save)