tmux

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateConfig

func GenerateConfig(path string, scrollbackLines int) error

GenerateConfig writes a mobile-optimized tmux.conf to path.

func IsInsideTmux

func IsInsideTmux() bool

IsInsideTmux returns true if the current process is running inside a tmux session.

Types

type Client

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

Client wraps tmux CLI commands.

func NewClient

func NewClient(confPath string) *Client

NewClient creates a new Client using the given tmux config path.

func (*Client) Attach

func (c *Client) Attach(name string) error

Attach attaches to an existing tmux session, connecting stdin/stdout/stderr.

func (*Client) ChooseSession

func (c *Client) ChooseSession() error

ChooseSession opens the tmux session chooser, connecting stdin/stdout/stderr.

func (*Client) CurrentSession

func (c *Client) CurrentSession() (string, error)

CurrentSession returns the name of the current tmux session.

func (*Client) Detach

func (c *Client) Detach() error

Detach detaches the current tmux client.

func (*Client) Go

func (c *Client) Go(name string) error

Go navigates to the named session, switching if inside tmux or attaching otherwise.

func (*Client) HasSession

func (c *Client) HasSession(name string) bool

HasSession returns true if a tmux session with the given name exists.

func (*Client) KillServer

func (c *Client) KillServer() error

KillServer kills the tmux server. Returns nil if there is no server running.

func (*Client) KillSession

func (c *Client) KillSession(name string) error

KillSession kills the named tmux session.

func (*Client) ListSessions

func (c *Client) ListSessions() (string, error)

ListSessions returns a newline-separated list of sessions, or empty string if none.

func (*Client) NewSession

func (c *Client) NewSession(name, workdir, shellCmd string) error

NewSession creates a new detached tmux session.

func (*Client) PaneCommand

func (c *Client) PaneCommand(name string) (string, error)

PaneCommand returns the start command of the first pane in the named session.

func (*Client) PaneCurrentPath

func (c *Client) PaneCurrentPath(name string) (string, error)

PaneCurrentPath returns the current working directory of the pane in the named session.

func (*Client) PanePID

func (c *Client) PanePID(name string) (string, error)

PanePID returns the PID of the first pane in the named session.

func (*Client) RenameSession

func (c *Client) RenameSession(oldName, newName string) error

RenameSession renames a tmux session.

func (*Client) RespawnPane

func (c *Client) RespawnPane(name, shellCmd string) error

RespawnPane respawns the pane in the named session with the given shell command. The command is wrapped in /bin/sh -c so shell operators (||, &&) are interpreted. Unlike new-session, respawn-pane does not invoke $SHELL -c automatically.

func (*Client) SourceConfig

func (c *Client) SourceConfig() error

SourceConfig loads the tmux config into the running server. This is needed because tmux -f only applies when starting a new server.

func (*Client) SwitchClient

func (c *Client) SwitchClient(name string) error

SwitchClient switches the tmux client to the named session.

Jump to

Keyboard shortcuts

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