Skip to main content

tmux session manager

Project description

tmuxp

A session manager for tmux. Built on libtmux.

Python Package Docs Build status Code Coverage License

New to tmux? The Tao of tmux is 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:

$ brew install tmuxp

Debian / ubuntu:

$ sudo apt install tmuxp

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

Developmental releases:

  • pip:

    $ pip install --user --upgrade --pre tmuxp
    
  • pipx:

    $ pipx install --suffix=@next 'tmuxp' --pip-args '\--pre' --force
    

    Then use tmuxp@next load [session].

Load a tmux session

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

session_name: 4-pane-split
windows:
  - window_name: dev window
    layout: tiled
    shell_command_before:
      - cd ~/ # run as a first command in all panes
    panes:
      - shell_command: # pane no. 1
          - cd /var/log # run multiple commands in this pane
          - ls -al | grep \.log
      - echo second pane # pane no. 2
      - echo third pane # pane no. 3
      - echo forth pane # pane no. 4

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 and very elaborate config examples

User-level configurations

tmuxp checks for configs in user directories:

  • $TMUXP_CONFIGDIR, if set
  • $XDG_CONFIG_HOME, usually $HOME/.config/tmuxp/
  • $HOME/.tmuxp/

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

$ tmuxp load mysession

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 in libtmux 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))

Python 3.7+ 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 the bootstrap_env.py and before_script example

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.

$ tmuxp convert filename

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 <log-file-name> .

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://git-pull.com/support.html.

Project details

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

tmuxp-1.15.1a1.tar.gz (814.5 kB view details)

Uploaded Source

Built Distribution

tmuxp-1.15.1a1-py3-none-any.whl (39.8 kB view details)

Uploaded Python 3

File details

Details for the file tmuxp-1.15.1a1.tar.gz.

File metadata

  • Download URL: tmuxp-1.15.1a1.tar.gz
  • Upload date:
  • Size: 814.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for tmuxp-1.15.1a1.tar.gz
Algorithm Hash digest
SHA256 48624eea9a5247f65562baf64790b23abe181d74d2367aba4a40507b7691972d
MD5 499ee1359b5629ad10b67d5d5a1e6d0c
BLAKE2b-256 e226426c72a81f386134e02a22b782ba817bb75716bc8366be529a00613524b6

See more details on using hashes here.

Provenance

File details

Details for the file tmuxp-1.15.1a1-py3-none-any.whl.

File metadata

  • Download URL: tmuxp-1.15.1a1-py3-none-any.whl
  • Upload date:
  • Size: 39.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for tmuxp-1.15.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 8ff3821ae3ce33d89502a017bda96d2be07769728847204bf678cfa4452be674
MD5 baff5b33f91d915fbff371ed35f3af33
BLAKE2b-256 2003fb14f26df9f2cee1509c81bc47dd54ebc7f7f063f99e3d3b977082cb1284

See more details on using hashes here.

Provenance

Supported by

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