tmux session generator
Project description
matemux
matemux is a simple tmux session generator: it generates a session with customized window and pane layouts from a yaml file, called a recipe.
usage
$ matemux [RECIPE-FILE-NAME] [--args] [ARGS]...
create the session based on .matemux/RECIPE-FILE-NAME.yml with ARGS following --args flag. $MATEMUX_DIR is ~/.matemux by default. You could change it by setting $MATEMU_DIR in your environment.
examples
$ matemux example --args --command runserver --port 8000
create a session based on ~/.matemux/example.yml and pass command=runserver and port=8000 to example.yml commands.
recipes
each session is generated from a .yml file called a recipe. a sample recipe is shown below:
~/.matemux/example.yml
---
session: example
root: ~/projects/example
defaults:
command: runserver
port: 8000
commands:
- source activate venv/bin/activate
- C-l
focus: sql
windows:
- window: main
focus: 2
panes:
- pane: 0
commands:
- htop
- pane: 1
commands:
- neofetch
next-split-vertical: true
- pane: 2
root: ~/projects/example/server
commands:
- "{{command}} {{port}}"
- window: home
root: ~/
At the top level of a .yml file, the following keys could be defined:
sessionis the name of the session to be created. It accepts strings and integer values.rootdefines the default directory for all virtual terminals in the session. It must be a valid path. By default, it's set to '~/'.defaultsis the default arguments to be passed to commands, we'll cover them later on. they should be an object of key-value pairs. It could be omitted.commandsare a list of commands that are executed in all virtual terminals in the session. it could be omitted.focusdefines the window to focus on at the initial state of the session. By default, it's the first window. It accepts strings (name of the window) or integers (window number (0, 1, ...))windowsis a list of window configuration, with the following keys:windowis the name of the window. It could be omitted, in that case, it's set by default to its index.rootdefines the default directory for all panes in the window. It must be a valid path. By default, it's set to the session's root.focusdefines the pane to focus on at the initial state of the window. By default, it's the first pane (index 0)panesis a list of pane configuration, with the following keys:paneit's completely optional and has no effect. It could be set to the pane index to make the .yml file more readable, especially in regards to window focus.rootdefines the default directory for the pane. It must be a valid path. By default, it's set to the parent window's root.commandsare a list of commands to be executed in the pane.next-split-verticalis a boolean that defines whether or not the split for the next pane should be vertical. By default, it's set tofalse. Imagine the current layout is like this:
if it's false, when if we define another pane, the new layout would be:---------------- | | | 0 | | | | | ----------------
but if it's true, the new layout would be:---------------- | | | | 0 | 1 | | | | | | | -------------------------------- | 0 | |______________| | 1 | | | ----------------
running $ matemux example creates a session with two windows:
first window is called main and has the following layout:
---------------
| | 1 |
| 0 |______|
| | 2 |
| | |
---------------
htop is running in pane 0, neofetch is running in pane 1, and runserver 8000 is running in in pane 2.
second window is called home and has a single pane.
Notes about commands and defaults:
-
commands are propagated: If you set some commands for a session, some commands for a window, and some commands for a pane, they're all executed in the pane's virtual terminal, in that order.
-
You could use custom arguments in commands, in the form
{{arg}}and pass the arguments through commandline. For example, if you have a commandmysql -u {{user}}you could pass user like this:$ matemux example --args --user myuserif you want a default value for user, you should set it in session's defaults like:
defaults:
user: myuser
- It's important to note argument names should only contain characters from the English alphabet and they're case-sensitive.
Author
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file matemux-0.1.3.tar.gz.
File metadata
- Download URL: matemux-0.1.3.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.7 CPython/3.9.6 Linux/5.13.5-arch1-1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddc078a221f717f85e9803b7795e1e52981663fe8b63e2c2ee7a027483d1be5a
|
|
| MD5 |
10a1df4aaa62e91d71613eca0d2502e7
|
|
| BLAKE2b-256 |
38f9f1279beb2c2a488a5fe3a2ff4d9745fc1beed608bab0f84a736c69ad2c41
|
File details
Details for the file matemux-0.1.3-py3-none-any.whl.
File metadata
- Download URL: matemux-0.1.3-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.7 CPython/3.9.6 Linux/5.13.5-arch1-1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0631e92a62d6192c728ed65332bb4fd522b80129608e7e2a9f4d0a0f29fcd65d
|
|
| MD5 |
4df76daa45a800cb048cf1de0c7acc16
|
|
| BLAKE2b-256 |
e4312496a0f08909d5a3fb25c2f9ca3c2f3d8b2f280e8c79375275e656062e22
|