Skip to main content

A python executable that saves and restores tmux sessions across reboots

Project description

tmux-restore

Overview

Works with tmux to save and restore sessions across reboots. Sessions are stored at ~/.tmux-restore.

Features

  • Save session windows, panes, and layouts automatically on detach/exit
  • Automatically restore sessions on reboot
    • Restores windows, panes, and layout
    • Restores running processes for select programs:
      • emacs/vi/
      • vim/nvim
        • Restores cursor location
      • man
      • less/more
      • tail
      • top/htop
      • irssi/weechat/mutt
      • ssh
      • psql/mysql/sqlite3

To Do

  • Save environment variables
  • Add configuration option for session file
  • Add configuration option for adding running programs to save

Set Up

To install tmux-restore, run the following:

pip install tmux-restore

Then, to restore your saved sessions on reboot, edit your .bashrc file with the following content:

# colors...

# tmux-restore trigger
if ! tmux info &> /dev/null; then
    if ! tmux ls &> /dev/null; then
        (python3 -m tmux-restore &)
    fi
fi

# aliases...

It is important that this is done above alias definition to avoid conflicts. Finally, add the following content to either where the other aliases are defined in your .bashrc file or to your .bash_aliases file:

tmux() {
    command tmux $*
    (python3 -m tmux-restore save &)
}

This will ensure that your sessions save after you exit or detach from a tmux session. Restart your shell to apply the effects. Your tmux sessions will now restore themselves across reboots!

Usage

If you would like to save or restore your tmux sessions manually:

# Save
python3 -m tmux-restore save

# Restore
python3 -m tmux-restore
# OR
python3 -m tmux-restore restore

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tmux_restore-0.0.7.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tmux_restore-0.0.7-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file tmux_restore-0.0.7.tar.gz.

File metadata

  • Download URL: tmux_restore-0.0.7.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0rc1

File hashes

Hashes for tmux_restore-0.0.7.tar.gz
Algorithm Hash digest
SHA256 dfd6ac41d44dd77afa2f459d846b9131f445a4f44e9a713dbd3eddc2367584ae
MD5 221b952547a2e11b17f16a547fc60a30
BLAKE2b-256 67ae48aa7acb6487b1e59fb8ae89a079b67f690d2bd35c1e08c745d9c671d6dd

See more details on using hashes here.

File details

Details for the file tmux_restore-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: tmux_restore-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0rc1

File hashes

Hashes for tmux_restore-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 537643cb33be43fc32e751052cc50a54b551db6f8d572bb7529c3c4ed76f834c
MD5 7f7fe7a4e1ba3f30f225cac4c9c0e329
BLAKE2b-256 7446f472dc01622831232831ca35a2ad1b7de96eb59b971ed46b2063f02be16b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page