# Workspace environment

Source: https://libtmux.org/en/rs/latest/workspace/configuration/environment/

> Configure the loader process and the variables available to pane commands.

**Workspace Manager concept example** A working example of the core library. It can change without notice.



The CLI's process environment controls discovery and optional runtimes.
Configuration [`environment`](https://libtmux.org/en/rs/latest/workspace/configuration/session/#session-fields-environment) maps provide variables to the workspace's shells.

```yaml title="environment.yaml"
session_name: environment-example
environment:
  DOC_SESSION: session
windows:
  - window_name: shell
    environment:
      DOC_WINDOW: window
    panes:
      - environment:
          DOC_PANE: pane
        shell_command: 'printf "ENV=%s|%s|%s\n" "$DOC_SESSION" "$DOC_WINDOW" "$DOC_PANE"'
      - shell_command: 'printf "ENV=%s|%s|%s\n" "$DOC_SESSION" "$DOC_WINDOW" "$DOC_PANE"'
```

A pane map selects its launch environment in place of the window map. Session
variables still apply. Repeat a window variable in the pane map when that pane
needs it too. Avoid putting credentials in example files or diagnostic output.

## Variable expressions

Names, directories, options and environment values expand defined variables
from the loader process. Command and launch-shell text keep their expressions
for the pane shell; referenced loader variables are supplied to that pane unless
the document already sets them. Shell quoting therefore remains meaningful.

## Loader settings

| Variable | Use |
| --- | --- |
| `TMUXP_CONFIGDIR` | Preferred existing directory for saved workspaces |
| `XDG_CONFIG_HOME` | Base for the `tmuxp` configuration directory |
| [`EDITOR`](<https://libtmux.org/en/rs/latest/reference/options-generated-editor/>) | Editor used by [`edit`](https://libtmux.org/en/rs/latest/workspace/cli/edit/) |
| `TMUX_WORKSPACE_PYTHON` | Optional interpreter for [`shell`](<https://libtmux.org/en/rs/latest/workspace/reference/config-paneconfig-shell/>) and supported extensions |
| `NO_COLOR` | Disable terminal color when nonempty |

These are process settings, not workspace YAML keys. Read
[discovery](https://libtmux.org/en/rs/latest/workspace/guides/discovery/), [editing](https://libtmux.org/en/rs/latest/workspace/cli/edit/) and
[shell inspection](https://libtmux.org/en/rs/latest/workspace/cli/shell/) for their task-specific behavior.

[CLI source](https://github.com/libtmux/libtmux-rs/blob/e9be0b6f6d22cd2eb79b0ec08964f82e717e5fe4/crates/tmux-workspace/docs/cli.md).
