tmux

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentSession

func CurrentSession() (string, error)

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

func CurrentWindow() (string, error)

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

func FirstWindowExcept(session string, exclude ...string) (string, error)

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 KillSession

func KillSession(name string) error

KillSession kills a tmux session.

func KillWindow

func KillWindow(session, window string) error

KillWindow kills a specific window in a session.

func ListSessions

func ListSessions() ([]string, error)

ListSessions returns names of all tmux sessions.

func NewSession

func NewSession(session, window, workDir, command string) error

NewSession creates a new detached tmux session. window is the name for the first window. command is run in that window.

func NewWindow

func NewWindow(session, window, workDir, command string) error

NewWindow adds a window to an existing session.

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

func SendKeys(session, window, text string) error

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

func SendRawKey(session, window, key string) error

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

func SessionExists(name string) bool

SessionExists checks if a tmux session exists (exact match).

func SetEnv

func SetEnv(session, key, value string) error

SetEnv sets an environment variable on a tmux session. New processes spawned in the session will inherit this variable.

func WindowExists

func WindowExists(session, window string) bool

WindowExists checks if a named window exists in a session.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL