Documentation
¶
Overview ¶
Package tmux provides a Go-native tmux session client that creates sessions from declarative window definitions.
Index ¶
- type Client
- func (c *Client) AddWindows(ctx context.Context, name, workDir string, windows []RenderedWindow) error
- func (c *Client) AttachOrSwitch(ctx context.Context, name string) error
- func (c *Client) CreateSession(ctx context.Context, name, workDir string, windows []RenderedWindow, ...) error
- func (c *Client) HasSession(ctx context.Context, name string) bool
- func (c *Client) OpenSession(ctx context.Context, name, workDir string, windows []RenderedWindow, ...) error
- type RenderedWindow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client creates and manages tmux sessions from window definitions.
func (*Client) AddWindows ¶
func (c *Client) AddWindows(ctx context.Context, name, workDir string, windows []RenderedWindow) error
AddWindows adds windows to an existing tmux session. If any window has Focus set, that window is selected after all windows are created.
func (*Client) AttachOrSwitch ¶
AttachOrSwitch connects to an existing tmux session. Inside tmux it uses switch-client; outside it uses attach-session.
func (*Client) CreateSession ¶
func (c *Client) CreateSession(ctx context.Context, name, workDir string, windows []RenderedWindow, background bool) error
CreateSession creates a tmux session with the given windows. The first window is created via new-session; additional windows via new-window. If background is true, the session is created detached.
func (*Client) HasSession ¶
HasSession checks whether a tmux session with the given name exists.
func (*Client) OpenSession ¶
func (c *Client) OpenSession(ctx context.Context, name, workDir string, windows []RenderedWindow, background bool, targetWindow string) error
OpenSession creates a session if it doesn't exist, or attaches to it. If targetWindow is non-empty and the session already exists, select that window before attaching.
type RenderedWindow ¶
type RenderedWindow struct {
Name string // Window name
Command string // Command to run (empty = default shell)
Dir string // Working directory (empty = session default)
Focus bool // Select this window after creation
}
RenderedWindow is a fully-resolved tmux window definition (no templates).