Skip to content

tmux

The tmux client module: a tmux plugin that makes each tmux session a PiFi client. Pi you start in it by hand shows up in PiFi, and, if you choose, the session mirrors PiFi as a window per active branch. tmux only shows things: Pi runs on whichever host owns the session.

PiFi tmux
Branch, while active Window with its primary session, named project · title
Extra session on a branch A window you open from the picker
Terminal session Pi’s own TUI in the window
RPC session Not shown; use the web app
Pi you started by hand in a pane Stays in your pane; PiFi opens no window for it here

See clients for what every client has in common.

What it mirrors

Nothing, until you choose: pifi clients bind tmux:<session> --all (every session), --scope <name> (one scope, recorded by id) or --none, or Settings > Clients in the web app. A tmux session named like a scope mirrors nothing until you bind it. A mirror opens a window for each branch’s primary while the branch is active: live or waiting for input, unread, or active in the last 48 hours. A window the mirror opened closes once its branch goes inactive, unless you are in it. Several tmux and herdr sessions can mirror one scope.

What you can do in a mirroring session

  • New window: prefix S opens a window with the picker: a session to open in the current window’s workspace (extras included), a new session, or another project. A window you open yourself with prefix c is a plain shell.
  • Rename a window to rename its session (keep the project · prefix or drop it).
  • Close a primary’s window (kill-window) to let its session go: it is archived, unless it is the primary of a worktree branch that has not landed (the branch keeps it; its window stays hidden). A running session is refused: tmux shows a message and the window comes back. Closing an extra’s window only hides it until the session is active again.
  • q in a session’s window closes it after you detach with Ctrl+]. Enter reattaches.
  • A crashed pane is respawned, never archived: mirror windows use remain-on-exit.

Sessions started anywhere else (the web app, herdr, your phone) appear here within a moment, and archived ones disappear. In every tmux session, mirroring or not, the session in the active window counts as read while you are attached.

Setup

  1. Sign this machine’s CLI in: pifi login --coordinator <url>.
  2. Load the plugin: with TPM, set -g @plugin '<repo>/modules/tmux'; otherwise run-shell <repo>/modules/tmux/pifi.tmux in .tmux.conf. It starts the daemon in every tmux session (quiet where the CLI is not signed in).
  3. Choose what a session mirrors: pifi clients bind tmux:work --scope work, or pifi tmux pair --session work --scope work, which also writes ~/.config/pifi-tmux/work.env (--cli and --client-config set PIFI_CLI and PIFI_CLIENT_CONFIG; the file is only needed for those).
  4. Start the session: tmux new-session -s work.

Upgrading from 0.20: the plugin moved from integrations/ to modules/; load it from the new path in .tmux.conf.

PIFI_VIEW in an env file is read once, from 0.19 setups, and recorded as the binding when none is recorded; see clients.

Files

State and logs live in ~/.local/state/pifi-tmux/ ($XDG_STATE_HOME): the stable launcher, and per session daemon.log, daemon.pid and windows.json.