tmuxctx

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoTmuxContext is returned when no tmux environment is available.
	ErrNoTmuxContext = errors.New("not inside tmux")
	// ErrInvalidFieldCount is returned when tmux output does not match the requested format.
	ErrInvalidFieldCount = errors.New("invalid tmux field count")
)

Functions

func ContextFromEnv

func ContextFromEnv(env Env) registry.TmuxContext

func Current

func Current(ctx context.Context) (registry.TmuxContext, error)

func CurrentWithEnv

func CurrentWithEnv(ctx context.Context, env Env) (registry.TmuxContext, error)

func ParseCurrent

func ParseCurrent(output string) (registry.TmuxContext, error)

func SendInterrupt

func SendInterrupt(ctx context.Context, paneID string) error

func SendInterruptTo

func SendInterruptTo(ctx context.Context, serverIdentity, paneID string) error

SendInterruptTo sends an interrupt to a pane on the identified tmux server.

Types

type CaptureOptions

type CaptureOptions struct {
	Env   Env
	Run   CommandRunner
	Lines int
}

type CommandRunner

type CommandRunner func(context.Context, Env, ...string) (string, error)

CommandRunner executes tmux with an explicit argv. Implementations must not invoke a shell.

type Env

type Env struct {
	TMUX     string
	TMUXPane string
}

type ListOptions

type ListOptions struct {
	Env             Env
	Run             CommandRunner
	ServerProcesses ServerProcessLister
}

ListOptions controls pane discovery and is primarily useful for observer injection and deterministic tests.

type Pane

type Pane struct {
	Tmux           registry.TmuxContext
	ServerIdentity string
	PanePID        int
	PaneTTY        string
}

func ListPanes

func ListPanes(ctx context.Context) ([]Pane, error)

func ListPanesWithEnv

func ListPanesWithEnv(ctx context.Context, env Env) ([]Pane, error)

func ListPanesWithOptions

func ListPanesWithOptions(ctx context.Context, options ListOptions) ([]Pane, error)

func ParseListPanes

func ParseListPanes(output string) ([]Pane, error)

type ScreenSnapshot

type ScreenSnapshot struct {
	Text  string
	Title string
}

func CapturePane

func CapturePane(ctx context.Context, pane Pane) (ScreenSnapshot, error)

func CapturePaneWithOptions

func CapturePaneWithOptions(ctx context.Context, pane Pane, options CaptureOptions) (ScreenSnapshot, error)

type ServerProcess

type ServerProcess struct {
	PID  int
	Args []string
}

ServerProcess is the current-user process snapshot used to discover custom tmux servers.

type ServerProcessLister

type ServerProcessLister func(context.Context) ([]ServerProcess, error)

ServerProcessLister supplies current-user tmux server processes.

Jump to

Keyboard shortcuts

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