| 1 | # Configuration |
| 2 | |
| 3 | You configure libtmux through Python: there are no config files, and you |
| 4 | set everything through method calls on {class}`~libtmux.Server`, |
| 5 | {class}`~libtmux.Session`, {class}`~libtmux.Window`, and |
| 6 | {class}`~libtmux.Pane` objects, with sensible defaults. If you're driving |
| 7 | tmux through the standard object API, you're already configured correctly |
| 8 | and can stop reading here. |
| 9 | |
| 10 | The rest of this page is for the rarer cases. It documents two lower |
| 11 | layers you can reach for when the defaults aren't enough: the tmux |
| 12 | environment variables that decide which server you connect to, and the |
| 13 | format-string system libtmux uses internally to read tmux state. |
| 14 | |
| 15 | ## Environment variables |
| 16 | |
| 17 | libtmux reads almost nothing from the environment, so in normal use |
| 18 | there's nothing to set here. The one knob it does read is |
| 19 | `LIBTMUX_TMUX_FORMAT_SEPARATOR`, an advanced override for the separator |
| 20 | (default `␞`) libtmux uses internally to parse tmux's format output — you'd |
| 21 | touch it only if that character ever collided with your own data. What more |
| 22 | often matters is the tmux *server* you connect to: the standard tmux |
| 23 | variables `TMUX` (the address of an |
| 24 | existing server) and `TMUX_TMPDIR` (where tmux keeps its socket) shape |
| 25 | which server a fresh {class}`~libtmux.Server` finds. If you run several |
| 26 | servers, or point tmux at a custom socket directory, those two variables |
| 27 | decide which one you land on — otherwise you can ignore them. |
| 28 | |
| 29 | ## Format strings |
| 30 | |
| 31 | When you read a typed attribute like {attr}`~libtmux.Window.window_name` |
| 32 | or {attr}`pane.pane_current_path <libtmux.Pane.pane_current_path>`, libtmux is |
| 33 | querying tmux behind the scenes through tmux's own format system. The format |
| 34 | constants that drive those |
| 35 | queries live in {mod}`libtmux.formats` and are used internally by every |
| 36 | object type, so in normal use you never write format strings yourself — |
| 37 | the typed attributes on each object hand you the values directly. |
| 38 | |
| 39 | For the rarer case where you want to know exactly which formats tmux |
| 40 | exposes, see the [tmux man page](http://man.openbsd.org/OpenBSD-current/man1/tmux.1) |
| 41 | for the full list. |