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

To Do

  • Save pane command/state for more commands
  • Add configuration option for session file

Set Up

To install tmux-restore, run the following:

pip install tmux-restore

Then, 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.2.tar.gz (4.6 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.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tmux_restore-0.0.2.tar.gz
  • Upload date:
  • Size: 4.6 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.2.tar.gz
Algorithm Hash digest
SHA256 9fe88a9df48f2102f249c9872358a0fb5ae24320616a5814fa709adf524fd6a0
MD5 d6c5a34a09a3cdbb32b2a4cec0922765
BLAKE2b-256 b963e39b69b6360a77a3cb3714c4c4ea81b3dcfd9414952c0c3c5b96722a0361

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tmux_restore-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 20f2fcd86a13d2183eed1b5b21bf20984ca4f10e7fe5d7538e5c274e284acd88
MD5 5fee0a3ef0c9131932d37e804b44d58a
BLAKE2b-256 efcb2a3eff4331d338a5dbc0efc88124e4811dc9cad944d2d6e4e9d2fd98d990

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