Documentation
¶
Overview ¶
Package tmux provides helpers for managing tmux sessions, windows, and input delivery.
It wraps the tmux CLI to create and kill sessions and windows, send literal text or raw control keys to panes, set session environment variables, and introspect the current session and window. Used by the daemon to route messages to agent sessions and by the worker spawner to launch new worker sessions.
Plane: shared
Index ¶
- func CurrentSession() (string, error)
- func CurrentWindow() (string, error)
- func FirstWindowExcept(session string, exclude ...string) (string, error)
- func KillSession(name string) error
- func KillWindow(session, window string) error
- func ListSessions() ([]string, error)
- func NewSession(session, window, workDir, command string) error
- func NewWindow(session, window, workDir, command string) error
- func Role() string
- func SendKeys(session, window, text string) error
- func SendRawKey(session, window, key string) error
- func SessionExists(name string) bool
- func SetEnv(session, key, value string) error
- func WindowExists(session, window string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentSession ¶
CurrentSession returns the name of the tmux session this process is running in. Returns ("", nil) if not inside tmux. Returns an error if tmux command fails.
func CurrentWindow ¶
CurrentWindow returns the name of the tmux window this process is running in. Uses TMUX_PANE to target the actual pane, not the active window — without -t, display-message returns whichever window the user is looking at. Returns ("", nil) if not inside tmux.
func FirstWindowExcept ¶
FirstWindowExcept returns the first window in a session whose name is not in the exclusion list. Returns "" with nil error if no matching window is found.
func KillWindow ¶
KillWindow kills a specific window in a session.
func ListSessions ¶
ListSessions returns names of all tmux sessions.
func NewSession ¶
NewSession creates a new detached tmux session. window is the name for the first window. command is run in that window.
func Role ¶
func Role() string
Role returns the TTAL_ROLE of this process ("coder", "reviewer", or ""). Set by worker spawn (TTAL_ROLE=coder) and reviewer spawn (TTAL_ROLE=reviewer). Avoids querying tmux for window names, which can return the active tab instead of the pane's actual window.
func SendKeys ¶
SendKeys sends text to a tmux pane, then sends Enter. target format: "session:window" or "session:window.pane" Text is sanitized before sending.
func SendRawKey ¶
SendRawKey sends a special key (e.g. "Escape", "C-c") to a tmux pane without the -l (literal) flag. Used for control keys that aren't text.
func SessionExists ¶
SessionExists checks if a tmux session exists (exact match).
func SetEnv ¶
SetEnv sets an environment variable on a tmux session. New processes spawned in the session will inherit this variable.
func WindowExists ¶
WindowExists checks if a named window exists in a session.
Types ¶
This section is empty.