tmux

package
v1.3.74 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAlivePanes = errors.New("no alive tmux panes to save")

Functions

func FormatCaptures

func FormatCaptures(captures []PaneCapture, lines int) string

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps tmux CLI operations. Use exec.Command args directly; do not shell-quote tmux args.

func NewClient

func NewClient() *Client

func (*Client) Capture

func (c *Client) Capture(ctx context.Context, paneID string, lines int) (string, error)

func (*Client) Detect

func (c *Client) Detect(ctx context.Context) (*Environment, error)

func (*Client) Focus

func (c *Client) Focus(ctx context.Context, paneID string) error

func (*Client) KillPane

func (c *Client) KillPane(ctx context.Context, paneID string) error

func (*Client) ListPaneIDs

func (c *Client) ListPaneIDs(ctx context.Context) (map[string]struct{}, error)

func (*Client) PaneExists

func (c *Client) PaneExists(ctx context.Context, paneID string) bool

func (*Client) Popup

func (c *Client) Popup(ctx context.Context, req PopupRequest) error

func (*Client) Split

func (c *Client) Split(ctx context.Context, req SplitRequest) (*Pane, error)

type Environment

type Environment struct {
	Available bool
	InTmux    bool
	Version   string
	Session   string
	Window    string
	WindowID  string
	PaneID    string
	PaneIndex string
	ClientTTY string
}

Environment describes the current tmux attachment.

func (*Environment) Label

func (e *Environment) Label() string

type LayoutPane

type LayoutPane struct {
	Purpose    string `json:"purpose"`
	Command    string `json:"command"`
	Horizontal bool   `json:"horizontal"`
	Size       string `json:"size"`
}

func InferDefaultLayout

func InferDefaultLayout(workspace string) []LayoutPane

InferDefaultLayout returns a reasonable first-run layout for a workspace. It is intentionally conservative and only uses local project files.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager tracks tmux panes created by ggcode for a workspace.

func NewManager

func NewManager(client *Client, workspace string) *Manager

func NewManagerWithStorePath

func NewManagerWithStorePath(client *Client, workspace, storePath string) *Manager

func SharedManager

func SharedManager(workspace string) *Manager

SharedManager returns the process-wide tmux pane manager for a workspace. TUI commands and LLM tools use this so they see the same managed panes.

func (*Manager) Capture

func (m *Manager) Capture(ctx context.Context, paneID string, lines int) (string, error)

func (*Manager) CaptureAll

func (m *Manager) CaptureAll(ctx context.Context, lines int) []PaneCapture

func (*Manager) Client

func (m *Manager) Client() *Client

func (*Manager) Close

func (m *Manager) Close(ctx context.Context, paneID string) error

func (*Manager) Count

func (m *Manager) Count() int

func (*Manager) DeleteLayout

func (m *Manager) DeleteLayout(name string) bool

func (*Manager) Detect

func (m *Manager) Detect(ctx context.Context) (*Environment, error)

func (*Manager) Focus

func (m *Manager) Focus(ctx context.Context, paneID string) error

func (*Manager) HasPanes

func (m *Manager) HasPanes() bool

func (*Manager) Layout

func (m *Manager) Layout(name string) []LayoutPane

func (*Manager) List

func (m *Manager) List() []Pane

func (*Manager) ListLayoutNames

func (m *Manager) ListLayoutNames() []string

func (*Manager) ListLayouts

func (m *Manager) ListLayouts() map[string][]LayoutPane

func (*Manager) Load

func (m *Manager) Load() error

func (*Manager) ManagedPaneText

func (m *Manager) ManagedPaneText() string

func (*Manager) MarkAlive

func (m *Manager) MarkAlive(paneID string, alive bool)

func (*Manager) Popup

func (m *Manager) Popup(ctx context.Context, req PopupRequest) error

func (*Manager) Prune

func (m *Manager) Prune(selector string) int

func (*Manager) Refresh

func (m *Manager) Refresh(ctx context.Context) (int, int, error)

func (*Manager) RenameLayout

func (m *Manager) RenameLayout(oldName, newName string) error

func (*Manager) RerunPane

func (m *Manager) RerunPane(ctx context.Context, selector string) (*RerunResult, error)

func (*Manager) ResolvePaneSelector

func (m *Manager) ResolvePaneSelector(selector string) (Pane, bool)

func (*Manager) Restore

func (m *Manager) Restore(ctx context.Context, selector string) ([]RestoreResult, error)

func (*Manager) Save

func (m *Manager) Save() error

func (*Manager) SaveLayout

func (m *Manager) SaveLayout(name string) error

func (*Manager) SetupLayout

func (m *Manager) SetupLayout(ctx context.Context, name string) ([]Pane, error)

func (*Manager) Split

func (m *Manager) Split(ctx context.Context, req SplitRequest) (*Pane, error)

func (*Manager) StopPane

func (m *Manager) StopPane(ctx context.Context, selector string) (Pane, error)

func (*Manager) UpdateAliveState

func (m *Manager) UpdateAliveState(aliveIDs map[string]struct{}) (int, int)

func (*Manager) Workspace

func (m *Manager) Workspace() string

type Pane

type Pane struct {
	ID         string    `json:"id"`
	Purpose    string    `json:"purpose"`
	Command    string    `json:"command"`
	Workspace  string    `json:"workspace"`
	Alive      bool      `json:"alive"`
	Horizontal bool      `json:"horizontal"`
	Size       string    `json:"size"`
	CreatedAt  time.Time `json:"created_at"`
}

Pane is a tmux pane known to ggcode.

type PaneCapture

type PaneCapture struct {
	Pane   Pane
	Output string
	Error  error
}

type PopupRequest

type PopupRequest struct {
	Workspace string
	Command   string
	Width     string
	Height    string
}

type RerunResult

type RerunResult struct {
	Old Pane
	New Pane
}

type RestoreResult

type RestoreResult struct {
	Old Pane
	New Pane
}

type SplitRequest

type SplitRequest struct {
	Workspace  string
	Command    string
	Purpose    string
	Horizontal bool
	Size       string
}

Jump to

Keyboard shortcuts

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