# Workspace commands

Source: https://libtmux.org/en/csharp/latest/workspace/configuration/commands/

> Order pane setup and command delivery, Enter handling and delays.

`shell_command_before` adds setup for every affected pane. Setup is ordered from
session to window to pane, followed by that pane's `shell_command` entries.

```yaml title="commands.yaml"
session_name: commands-example
shell_command_before:
  - printf session-setup
windows:
  - window_name: shell
    shell_command_before:
      - printf window-setup
    panes:
      - shell_command_before:
          - printf pane-setup
        shell_command:
          - cmd: printf ready
            sleep_after: 0.01
          - cmd: printf waiting
            enter: false
            sleep_after: 0
```

The final command is typed without Enter. Delays are measured in seconds and
pause delivery; they do not verify that an application is ready or that an
earlier shell command succeeded.

## Enter and timing

Pane-level `enter`, `sleep_before` and `sleep_after` establish defaults.

Command mappings can change those defaults. An override carries to following
commands in that pane until another override. Set an explicit value when later
commands need to restore Enter or remove a delay.

## History and readiness

History suppression prefixes sent commands with a space. The shell still needs
its own setting to ignore leading-space commands, such as Bash's
`HISTCONTROL=ignorespace` or zsh's `HIST_IGNORE_SPACE`.

Prompt readiness delays initial input while a shell draws its prompt. It is
separate from application readiness and command completion. Use a checked
[before script](https://libtmux.org/en/csharp/latest/workspace/configuration/hooks/) for bootstrap work whose exit status must stop the
load on failure.

See [environment](https://libtmux.org/en/csharp/latest/workspace/configuration/environment/) before putting variable expressions in
commands.

[CLI source](https://github.com/libtmux/libtmux-dotnet/blob/f77fe776ba67a04abb20ddbbc26cf4a000d63b74/src/LibTmux.Workspace.Cli/README.md).
