Architecture

This page traces how a tmuxp command travels from the CLI down to libtmux, the library that does the actual tmux work. Each subcommand takes its own short path through one or two workspace modules:

How each tmuxp subcommand reaches libtmux.

Key Components

CLI Layer (tmuxp.cli)

The CLI uses Python’s argparse with a custom formatter (tmuxp.cli._formatter). Each subcommand lives in its own module under tmuxp.cli.

The entry point is tmuxp.cli.cli(), registered as a console script in pyproject.toml.

Workspace Layer (tmuxp.workspace)

The workspace layer handles configuration lifecycle:

  1. Finding: tmuxp.workspace.finders locates config files

  2. Loading: tmuxp.workspace.loader reads and validates configs

  3. Building: tmuxp.workspace.builder creates tmux sessions via libtmux

  4. Freezing: tmuxp.workspace.freezer exports running sessions

Library Layer (libtmux)

tmuxp delegates all tmux operations to libtmux. The ClassicWorkspaceBuilder creates libtmux Server, Session, Window, and Pane objects to construct the requested workspace.