# tmuxp
Session manager for tmux, which allows users to save and load tmux sessions through simple configuration files. Powered by [libtmux](https://github.com/tmux-python/libtmux).
[![Python Package](https://img.shields.io/pypi/v/tmuxp.svg)](https://pypi.org/project/tmuxp/)
[![Docs](https://github.com/tmux-python/tmuxp/workflows/docs/badge.svg)](https://tmuxp.git-pull.com/)
[![Build status](https://github.com/tmux-python/tmuxp/workflows/tests/badge.svg)](https://github.com/tmux-python/tmuxp/actions?query=workflow%3A%22tests%22)
[![Code Coverage](https://codecov.io/gh/tmux-python/tmuxp/branch/master/graph/badge.svg)](https://codecov.io/gh/tmux-python/tmuxp)
[![License](https://img.shields.io/github/license/tmux-python/tmuxp.svg)](https://github.com/tmux-python/tmuxp/blob/master/LICENSE)
**New to tmux?** [The Tao of tmux](https://leanpub.com/the-tao-of-tmux)
is available on Leanpub and [Amazon Kindle](http://amzn.to/2gPfRhC).
Read and browse the book for free [on the
web](https://leanpub.com/the-tao-of-tmux/read).
**Have some spare time?** Help us triage and code review and the tracker. See [issue
#290](https://github.com/tmux-python/tmuxp/discussions/290)!
# Installation
pip:
```console
$ pip install --user tmuxp
```
Homebrew:
```console
$ brew install tmuxp
```
Debian / ubuntu:
```console
$ sudo apt install tmuxp
```
Nix:
```console
$ [[ -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:
- [pip](https://pip.pypa.io/en/stable/):
```console
$ pip install --user --upgrade --pre tmuxp
```
- [pipx](https://pypa.github.io/pipx/docs/):
```console
$ 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](https://github.com/aziz/tmuxinator) and
[teamocil](https://github.com/remiprev/teamocil) style.
```yaml
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:
```console
$ tmuxp load ./mysession.yaml
```
Projects with _.tmuxp.yaml_ or _.tmuxp.json_ load via directory:
```console
$ tmuxp load path/to/my/project/
```
Load multiple at once (in bg, offer to attach last):
```console
$ tmuxp load mysession ./another/project/
```
Name a session:
```console
$ tmuxp load -s session_name ./mysession.yaml
```
[simple](http://tmuxp.git-pull.com/examples.html#short-hand-inline) and
[very
elaborate](http://tmuxp.git-pull.com/examples.html#super-advanced-dev-environment)
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_):
```console
$ tmuxp load mysession
```
See [author's tmuxp configs](https://github.com/tony/tmuxp-config) and
the projects'
[tmuxp.yaml](https://github.com/tmux-python/tmuxp/blob/master/.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](https://github.com/tmux-python/libtmux) objects.
```console
$ 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](https://www.python.org/dev/peps/pep-0553/) `breakpoint()`
(including `PYTHONBREAKPOINT`). Also supports direct commands via `-c`:
```console
$ tmuxp shell -c 'print(window.name)'
my_window
$ tmuxp shell -c 'print(window.name.upper())'
MY_WINDOW
```
Read more on [tmuxp shell](https://tmuxp.git-pull.com/cli/shell.html) in
the CLI docs.
# Pre-load hook
Run custom startup scripts (such as installing project dependencies
before loading tmux. See the
[bootstrap_env.py](https://github.com/tmux-python/tmuxp/blob/master/bootstrap_env.py)
and
[before_script](http://tmuxp.git-pull.com/examples.html#bootstrap-project-before-launch)
example
# Load in detached state
You can also load sessions in the background by passing `-d` flag
# Screenshot
<img src="https://raw.githubusercontent.com/tmux-python/tmuxp/master/docs/_static/tmuxp-demo.gif" class="align-center" style="width:45.0%" alt="image" />
# Freeze a tmux session
Snapshot your tmux layout, pane paths, and window/session names.
```console
$ tmuxp freeze session-name
```
See more about [freezing
tmux](https://tmuxp.git-pull.com/cli/freeze.html) sessions.
# Convert a session file
Convert a session file from yaml to json and vice versa.
```console
$ 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.
```console
$ 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](http://tmuxp.git-pull.com/plugin_system.html).
# Debugging Helpers
The `load` command provides a way to log output to a log file for
debugging purposes.
```console
$ tmuxp load --log-file <log-file-name> .
```
Collect system info to submit with a Github issue:
```console
$ tmuxp debug-info
------------------
environment:
system: Linux
arch: x86_64
# ... so on
```
# Docs / Reading material
See the [Quickstart](http://tmuxp.git-pull.com/quickstart.html).
[Documentation](http://tmuxp.git-pull.com) homepage (also in
[中文](http://tmuxp-zh.rtfd.org/))
Want to learn more about tmux itself? [Read The Tao of Tmux
online](http://tmuxp.git-pull.com/about_tmux.html).
# 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
- tmux support: 1.8+
- python support: >= 3.8, pypy, pypy3
- Source: <https://github.com/tmux-python/tmuxp>
- Docs: <https://tmuxp.git-pull.com>
- API: <https://tmuxp.git-pull.com/api.html>
- Changelog: <https://tmuxp.git-pull.com/history.html>
- Issues: <https://github.com/tmux-python/tmuxp/issues>
- Test Coverage: <https://codecov.io/gh/tmux-python/tmuxp>
- pypi: <https://pypi.python.org/pypi/tmuxp>
- Open Hub: <https://www.openhub.net/p/tmuxp-python>
- Repology: <https://repology.org/project/tmuxp/versions>
- License: [MIT](http://opensource.org/licenses/MIT).
Raw data
{
"_id": null,
"home_page": "http://github.com/tmux-python/tmuxp/",
"name": "tmuxp",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": "tmux, session manager, terminal, ncurses",
"author": "Tony Narlock",
"author_email": "tony@git-pull.com",
"download_url": "https://files.pythonhosted.org/packages/2e/5b/66ceb26459b9324bbd425c673170172066f08a6c180c8da166de6a44cf45/tmuxp-1.47.0.tar.gz",
"platform": null,
"description": "# tmuxp\n\nSession manager for tmux, which allows users to save and load tmux sessions through simple configuration files. Powered by [libtmux](https://github.com/tmux-python/libtmux).\n\n[![Python Package](https://img.shields.io/pypi/v/tmuxp.svg)](https://pypi.org/project/tmuxp/)\n[![Docs](https://github.com/tmux-python/tmuxp/workflows/docs/badge.svg)](https://tmuxp.git-pull.com/)\n[![Build status](https://github.com/tmux-python/tmuxp/workflows/tests/badge.svg)](https://github.com/tmux-python/tmuxp/actions?query=workflow%3A%22tests%22)\n[![Code Coverage](https://codecov.io/gh/tmux-python/tmuxp/branch/master/graph/badge.svg)](https://codecov.io/gh/tmux-python/tmuxp)\n[![License](https://img.shields.io/github/license/tmux-python/tmuxp.svg)](https://github.com/tmux-python/tmuxp/blob/master/LICENSE)\n\n**New to tmux?** [The Tao of tmux](https://leanpub.com/the-tao-of-tmux)\nis available on Leanpub and [Amazon Kindle](http://amzn.to/2gPfRhC).\nRead and browse the book for free [on the\nweb](https://leanpub.com/the-tao-of-tmux/read).\n\n**Have some spare time?** Help us triage and code review and the tracker. See [issue\n#290](https://github.com/tmux-python/tmuxp/discussions/290)!\n\n# Installation\n\npip:\n\n```console\n$ pip install --user tmuxp\n```\n\nHomebrew:\n\n```console\n$ brew install tmuxp\n```\n\nDebian / ubuntu:\n\n```console\n$ sudo apt install tmuxp\n```\n\nNix:\n\n```console\n$ [[ -z $(which tmux) ]] && (nix-env -i tmux && nix-env -i tmuxp) || nix-env -i tmuxp\n```\n\nFind the package for your distro on repology: <https://repology.org/project/tmuxp/versions>\n\nDevelopmental releases:\n\n- [pip](https://pip.pypa.io/en/stable/):\n\n ```console\n $ pip install --user --upgrade --pre tmuxp\n ```\n\n- [pipx](https://pypa.github.io/pipx/docs/):\n\n ```console\n $ pipx install --suffix=@next 'tmuxp' --pip-args '\\--pre' --force\n ```\n\n Then use `tmuxp@next load [session]`.\n\n# Load a tmux session\n\nLoad tmux sessions via json and YAML,\n[tmuxinator](https://github.com/aziz/tmuxinator) and\n[teamocil](https://github.com/remiprev/teamocil) style.\n\n```yaml\nsession_name: 4-pane-split\nwindows:\n - window_name: dev window\n layout: tiled\n shell_command_before:\n - cd ~/ # run as a first command in all panes\n panes:\n - shell_command: # pane no. 1\n - cd /var/log # run multiple commands in this pane\n - ls -al | grep \\.log\n - echo second pane # pane no. 2\n - echo third pane # pane no. 3\n - echo forth pane # pane no. 4\n```\n\nSave as _mysession.yaml_, and load:\n\n```console\n$ tmuxp load ./mysession.yaml\n```\n\nProjects with _.tmuxp.yaml_ or _.tmuxp.json_ load via directory:\n\n```console\n$ tmuxp load path/to/my/project/\n```\n\nLoad multiple at once (in bg, offer to attach last):\n\n```console\n$ tmuxp load mysession ./another/project/\n```\n\nName a session:\n\n```console\n$ tmuxp load -s session_name ./mysession.yaml\n```\n\n[simple](http://tmuxp.git-pull.com/examples.html#short-hand-inline) and\n[very\nelaborate](http://tmuxp.git-pull.com/examples.html#super-advanced-dev-environment)\nconfig examples\n\n# User-level configurations\n\ntmuxp checks for configs in user directories:\n\n- `$TMUXP_CONFIGDIR`, if set\n- `$XDG_CONFIG_HOME`, usually _$HOME/.config/tmuxp/_\n- `$HOME/.tmuxp/`\n\nLoad your tmuxp config from anywhere by using the filename, assuming\n_\\~/.config/tmuxp/mysession.yaml_ (or _.json_):\n\n```console\n$ tmuxp load mysession\n```\n\nSee [author's tmuxp configs](https://github.com/tony/tmuxp-config) and\nthe projects'\n[tmuxp.yaml](https://github.com/tmux-python/tmuxp/blob/master/.tmuxp.yaml).\n\n# Shell\n\n_New in 1.6.0_:\n\n`tmuxp shell` launches into a python console preloaded with the attached\nserver, session, and window in\n[libtmux](https://github.com/tmux-python/libtmux) objects.\n\n```console\n$ tmuxp shell\n\n(Pdb) server\n<libtmux.server.Server object at 0x7f7dc8e69d10>\n(Pdb) server.sessions\n[Session($1 your_project)]\n(Pdb) session\nSession($1 your_project)\n(Pdb) session.name\n'your_project'\n(Pdb) window\nWindow(@3 1:your_window, Session($1 your_project))\n(Pdb) window.name\n'your_window'\n(Pdb) window.panes\n[Pane(%6 Window(@3 1:your_window, Session($1 your_project)))\n(Pdb) pane\nPane(%6 Window(@3 1:your_window, Session($1 your_project))\n```\n\nSupports [PEP\n553](https://www.python.org/dev/peps/pep-0553/) `breakpoint()`\n(including `PYTHONBREAKPOINT`). Also supports direct commands via `-c`:\n\n```console\n$ tmuxp shell -c 'print(window.name)'\nmy_window\n\n$ tmuxp shell -c 'print(window.name.upper())'\nMY_WINDOW\n```\n\nRead more on [tmuxp shell](https://tmuxp.git-pull.com/cli/shell.html) in\nthe CLI docs.\n\n# Pre-load hook\n\nRun custom startup scripts (such as installing project dependencies\nbefore loading tmux. See the\n[bootstrap_env.py](https://github.com/tmux-python/tmuxp/blob/master/bootstrap_env.py)\nand\n[before_script](http://tmuxp.git-pull.com/examples.html#bootstrap-project-before-launch)\nexample\n\n# Load in detached state\n\nYou can also load sessions in the background by passing `-d` flag\n\n# Screenshot\n\n<img src=\"https://raw.githubusercontent.com/tmux-python/tmuxp/master/docs/_static/tmuxp-demo.gif\" class=\"align-center\" style=\"width:45.0%\" alt=\"image\" />\n\n# Freeze a tmux session\n\nSnapshot your tmux layout, pane paths, and window/session names.\n\n```console\n$ tmuxp freeze session-name\n```\n\nSee more about [freezing\ntmux](https://tmuxp.git-pull.com/cli/freeze.html) sessions.\n\n# Convert a session file\n\nConvert a session file from yaml to json and vice versa.\n\n```console\n$ tmuxp convert filename\n```\n\nThis will prompt you for confirmation and shows you the new file that is\ngoing to be written.\n\nYou can auto confirm the prompt. In this case no preview will be shown.\n\n```console\n$ tmuxp convert -y filename\n$ tmuxp convert --yes filename\n```\n\n# Plugin System\n\ntmuxp has a plugin system to allow for custom behavior. See more about\nthe [Plugin System](http://tmuxp.git-pull.com/plugin_system.html).\n\n# Debugging Helpers\n\nThe `load` command provides a way to log output to a log file for\ndebugging purposes.\n\n```console\n$ tmuxp load --log-file <log-file-name> .\n```\n\nCollect system info to submit with a Github issue:\n\n```console\n$ tmuxp debug-info\n------------------\nenvironment:\n system: Linux\n arch: x86_64\n\n# ... so on\n```\n\n# Docs / Reading material\n\nSee the [Quickstart](http://tmuxp.git-pull.com/quickstart.html).\n\n[Documentation](http://tmuxp.git-pull.com) homepage (also in\n[\u4e2d\u6587](http://tmuxp-zh.rtfd.org/))\n\nWant to learn more about tmux itself? [Read The Tao of Tmux\nonline](http://tmuxp.git-pull.com/about_tmux.html).\n\n# Donations\n\nYour donations fund development of new features, testing and support.\nYour money will go directly to maintenance and development of the\nproject. If you are an individual, feel free to give whatever feels\nright for the value you get out of the project.\n\nSee donation options at <https://git-pull.com/support.html>.\n\n# Project details\n\n- tmux support: 1.8+\n- python support: >= 3.8, pypy, pypy3\n- Source: <https://github.com/tmux-python/tmuxp>\n- Docs: <https://tmuxp.git-pull.com>\n- API: <https://tmuxp.git-pull.com/api.html>\n- Changelog: <https://tmuxp.git-pull.com/history.html>\n- Issues: <https://github.com/tmux-python/tmuxp/issues>\n- Test Coverage: <https://codecov.io/gh/tmux-python/tmuxp>\n- pypi: <https://pypi.python.org/pypi/tmuxp>\n- Open Hub: <https://www.openhub.net/p/tmuxp-python>\n- Repology: <https://repology.org/project/tmuxp/versions>\n- License: [MIT](http://opensource.org/licenses/MIT).\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Session manager for tmux, which allows users to save and load tmux sessions through simple configuration files.",
"version": "1.47.0",
"project_urls": {
"Bug Tracker": "https://github.com/tmux-python/tmuxp/issues",
"Changes": "https://github.com/tmux-python/tmuxp/blob/master/CHANGES",
"Documentation": "https://tmuxp.git-pull.com",
"Homepage": "http://github.com/tmux-python/tmuxp/",
"Repository": "https://github.com/tmux-python/tmuxp"
},
"split_keywords": [
"tmux",
" session manager",
" terminal",
" ncurses"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ddd5e08dd15a49f983b23ae5443e2e07d192ec39853a2288bfabac8aa2e0e558",
"md5": "5ca920c5fa6ae81683e557c6b90bc184",
"sha256": "879afb04590b06f27ebd2e6f7d66e01456041876a655f7cdf2e29b871f3b03b6"
},
"downloads": -1,
"filename": "tmuxp-1.47.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5ca920c5fa6ae81683e557c6b90bc184",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 51024,
"upload_time": "2024-04-21T12:02:02",
"upload_time_iso_8601": "2024-04-21T12:02:02.222155Z",
"url": "https://files.pythonhosted.org/packages/dd/d5/e08dd15a49f983b23ae5443e2e07d192ec39853a2288bfabac8aa2e0e558/tmuxp-1.47.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2e5b66ceb26459b9324bbd425c673170172066f08a6c180c8da166de6a44cf45",
"md5": "5b2ad66c75e18de5396388b7b5c57413",
"sha256": "1d863a08450fa5956f54af64578121c38c0693961f2154a4674faaa9fe8dcf87"
},
"downloads": -1,
"filename": "tmuxp-1.47.0.tar.gz",
"has_sig": false,
"md5_digest": "5b2ad66c75e18de5396388b7b5c57413",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 836310,
"upload_time": "2024-04-21T12:02:06",
"upload_time_iso_8601": "2024-04-21T12:02:06.942882Z",
"url": "https://files.pythonhosted.org/packages/2e/5b/66ceb26459b9324bbd425c673170172066f08a6c180c8da166de6a44cf45/tmuxp-1.47.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-21 12:02:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tmux-python",
"github_project": "tmuxp",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "tmuxp"
}