File: index.md

package info (click to toggle)
tmuxp 1.55.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,688 kB
  • sloc: python: 8,049; makefile: 202; sh: 14
file content (176 lines) | stat: -rw-r--r-- 3,095 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
(config)=

(configuration)=

(workspace)=

# Workspace files

tmuxp loads your terminal workspace into tmux using workspace files.

The workspace file can be JSON or YAML. It's declarative style resembles tmux's object hierarchy: session, window and panes.

## Launching your session

Once you have `tmuxp` installed alongside tmux, you can load a workspace with:

```console
$ tmuxp load ./path/to/file
```

tmuxp will offer to assist when:

- _Session already exists_: tmuxp will prompt you to re-attach. It does this
  by checking if the workspace's `session_name` matches a session already
  running on the same server.
- _When inside a tmux client_, `tmuxp` will let you create a new session and switch to it, or append the windows to your existing
  session.

## What's in a workspace file?

1. A session name
2. A list of _windows_
3. A list of _panes_ for each window
4. A list of _commands_ for each pane

````{tab} Basics

```yaml
session_name: My session
windows:
- window_name: Window 1
  panes:
  - shell_command:
    - cmd: echo "pane 1"
  - shell_command:
    - cmd: echo "pane 2"
```

````

````{tab} Smallest possible

```{literalinclude} ../../examples/minimal.yaml
:language: yaml

```

As of 1.11.x.

````

Breaking down the basic workspace into sections:

1. A session name

   ```yaml
   session_name: My session
   ```

2. A list of _windows_

   ```yaml
   windows:
     - window_name: Window 1
       panes: ...
       # window settings
     - window_name: Window 2
       panes: ...
       # window settings
   ```

3. A list of _panes_ for each window

   ```yaml
   windows:
     panes:
       -  # pane settings
       -  # pane settings
   ```

4. A list of _commands_ for each pane

   ```yaml
   windows:
     panes:
       - shell_command:
           - cmd: echo "pane 1 - cmd 1"
             # command options
           - cmd: echo "pane 1 - cmd 2"
             # command options
   ```

## Where do I store workspace files?

### Direct

You can create a workspace and load it from anywhere in your file system.

```console
$ tmuxp load [workspace-file]
```

````{tab} Relative
```console
$ tmuxp load ./favorites.yaml
```
````

````{tab} Absolute
```console
$ tmuxp load /opt/myapp/favorites.yaml
```
````

### User-based workspaces

tmuxp uses the [XDG Base Directory] specification.

Often on POSIX machines, you will store them in `~/.config/tmuxp`.

Assume you store `apple.yaml` in `$XDG_CONFIG_HOME/tmuxp/apple.yaml`, you can
then use:

```console
$ tmuxp load apple
```

:::{seealso}

This path can be overridden by {ref}`TMUXP_CONFIGDIR`

:::

[xdg base directory]: https://specifications.freedesktop.org/basedir-spec/latest/

### Project-specific

You can store a workspace in your project's root directory as `.tmuxp.yaml` or `.tmuxp.json`, then:

Assume `.tmuxp.yaml` inside `/opt/myapp`

```console
$ tmuxp load [workspace-file]
```

````{tab} In project root
```console
$ tmuxp load ./
```
````

````{tab} Absolute
```console
$ tmuxp load /opt/myapp
```
````

## Reference and usage

```{toctree}

top-level
environmental-variables
examples

```