references/panes-surfaces.md
561 tokens · o200k_base · 2,231 bytes
Source excerpt starting at line 1.# Panes and Surfaces ```bash# inspectcmux list-panescmux list-pane-surfaces --pane pane:1 # createcmux new-split right --panel pane:1cmux new-split down --command "npm run dev"cmux new-pane --type terminal --direction right --command "tail -f logs/dev.log"cmux new-surface --type terminal --pane pane:1cmux new-surface --type terminal --pane pane:1 --working-directory "$PWD" --command "npm test"cmux new-surface --type browser --pane pane:1 --url https://example.com # focus and closecmux focus-pane --pane pane:2cmux focus-panel --panel surface:7cmux close-surface --surface surface:7 # move and reordercmux move-surface --surface surface:7 --pane pane:2 --focus truecmux move-surface --surface surface:7 --workspace workspace:2 --window window:1 --after surface:4cmux split-off --surface surface:7 rightcmux reorder-surface --surface surface:7 --before surface:3``` Surface identity is stable across move, reorder, and split-off. Layout commands are focus-neutral by default; pass `--focus true` only when the moved or created surface should be selected. ## Initial command `--command <text>` on `new-split`, `new-pane`, `new-surface`, and `new-workspace` starts the new terminal's regular interactive shell and types the text plus one Enter into it at spawn time. Use it instead of create-then-`send`-then-`send-key enter` whenever the first command is known. - The text is delivered literally; quoting, `&&`, pipes, and `$VARS` are interpreted by the new shell. `--command=<text>` also works, and a value is required.- The shell stays alive after the command exits. This differs from the socket `initial_command` param, which replaces the shell with a one-shot process.- Terminal-only: combining it with `--type browser`, `simulator`, or `agent-session` is an error. Blank or whitespace-only text is ignored. `new-workspace --layout` ignores it; layout surfaces define their own commands.- Remote tmux mirrored workspaces reject it, so the request fails instead of silently dropping the command.- Socket: the same behavior is the `initial_input` param on `surface.split`, `pane.create`, `surface.create`, and `workspace.create`. It is delivered raw, so append the Enter keystroke (`\r`) yourself.
Referenced from SKILL.md
Source excerpt starting at line 42.`new-workspace`, `new-split`, `new-pane`, and `new-surface` accept `--command <text>`. cmux starts the terminal's normal interactive shell and delivers the text plus one Enter at spawn time, so the command runs immediately and the shell stays alive after it exits. No follow-up `send` or `send-key enter` is needed, and the text is passed literally (quoting, `&&`, pipes, and `$VARS` are interpreted by the new shell). The flag is terminal-only: it is rejected with `--type browser|simulator|agent-session`, blank text is ignored, and `new-workspace --layout` ignores it because layout surfaces define their own commands. Details: [references/panes-surfaces.md](references/panes-surfaces.md).
Source excerpt starting at line 68.| [references/windows-workspaces.md](references/windows-workspaces.md) | Window/workspace lifecycle, reorder/move, and context-menu actions (color, description, rename) || [references/panes-surfaces.md](references/panes-surfaces.md) | Splits, surfaces, move/reorder, focus routing || [references/trigger-flash-and-health.md](references/trigger-flash-and-health.md) | Flash cue and surface health checks |