GitHub - tmux-python/tmuxp: 🖥️ Session manager for tmux, build on libtmux. (original) (raw)

tmuxp

Session manager for tmux, which allows users to save and load tmux sessions through simple configuration files. Powered by libtmux.

Python Package Docs Build status Code Coverage License

New to tmux? The Tao of tmuxis available on Leanpub and Amazon Kindle. Read and browse the book for free on the web.

Have some spare time? Help us triage and code review and the tracker. See issue #290!

Installation

pip:

$ pip install --user tmuxp

Homebrew:

Debian / ubuntu:

Nix:

$ [[ -z $(which tmux) ]] && (nix-env -i tmux && nix-env -i tmuxp) || nix-env -i tmuxp

Find the package for your distro on repology: https://repology.org/project/tmuxp/versions

Developmental releases:

Load a tmux session

Load tmux sessions via json and YAML,tmuxinator andteamocil style.

session_name: 4-pane-split windows:

Save as mysession.yaml, and load:

tmuxp load ./mysession.yaml

Projects with .tmuxp.yaml or .tmuxp.json load via directory:

tmuxp load path/to/my/project/

Load multiple at once (in bg, offer to attach last):

tmuxp load mysession ./another/project/

Name a session:

tmuxp load -s session_name ./mysession.yaml

simple andvery elaborateconfig examples

User-level configurations

tmuxp checks for configs in user directories:

Load your tmuxp config from anywhere by using the filename, assuming_~/.config/tmuxp/mysession.yaml_ (or .json):

See author's tmuxp configs and the projects'tmuxp.yaml.

Shell

New in 1.6.0:

tmuxp shell launches into a python console preloaded with the attached server, session, and window inlibtmux objects.

$ tmuxp shell

(Pdb) server <libtmux.server.Server object at 0x7f7dc8e69d10> (Pdb) server.sessions [Session($1 your_project)] (Pdb) session Session($1 your_project) (Pdb) session.name 'your_project' (Pdb) window Window(@3 1:your_window, Session($1 your_project)) (Pdb) window.name 'your_window' (Pdb) window.panes [Pane(%6 Window(@3 1:your_window, Session($1 your_project))) (Pdb) pane Pane(%6 Window(@3 1:your_window, Session($1 your_project))

Supports PEP 553 breakpoint()(including PYTHONBREAKPOINT). Also supports direct commands via -c:

$ tmuxp shell -c 'print(window.name)' my_window

$ tmuxp shell -c 'print(window.name.upper())' MY_WINDOW

Read more on tmuxp shell in the CLI docs.

Pre-load hook

Run custom startup scripts (such as installing project dependencies before loading tmux. See thebootstrap_env.pyandbefore_scriptexample

Load in detached state

You can also load sessions in the background by passing -d flag

Screenshot

image

Freeze a tmux session

Snapshot your tmux layout, pane paths, and window/session names.

$ tmuxp freeze session-name

See more about freezing tmux sessions.

Convert a session file

Convert a session file from yaml to json and vice versa.

This will prompt you for confirmation and shows you the new file that is going to be written.

You can auto confirm the prompt. In this case no preview will be shown.

$ tmuxp convert -y filename $ tmuxp convert --yes filename

Plugin System

tmuxp has a plugin system to allow for custom behavior. See more about the Plugin System.

Debugging Helpers

The load command provides a way to log output to a log file for debugging purposes.

$ tmuxp load --log-file .

Collect system info to submit with a Github issue:

$ tmuxp debug-info

environment: system: Linux arch: x86_64

... so on

Docs / Reading material

See the Quickstart.

Documentation homepage (also in中文)

Want to learn more about tmux itself? Read The Tao of Tmux online.

Donations

Your donations fund development of new features, testing and support. Your money will go directly to maintenance and development of the project. If you are an individual, feel free to give whatever feels right for the value you get out of the project.

See donation options at https://tony.sh/support.html.

Project details