tmux

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InitSessionName string

TODO: should define a sentinel tmux error to return from this?

Functions

func Cmd

func Cmd(args []string) (string, string, error)

Cmd runs a tmux command with given args; returns stdout and stderr

func GetDefaultSocket

func GetDefaultSocket() (string, string)

GetDefaultSocket returns default tmux socket name and path

func InsideTmux

func InsideTmux() bool

InsideTmux checks if $TMUX environment var is set, meaning running inside tmux

func IsValidPath

func IsValidPath(session string) bool

IsValidPath checks if a given session name is actually a valid path

Types

type Server

type Server struct {
	SocketName string // socket name
	SocketPath string // socket path
}

func GetCurrentServer

func GetCurrentServer() (*Server, error)

GetCurrentServer retrieves the server for the current session

func NewServer

func NewServer(socketName string, socketPath string) *Server

NewServer creates Server spec based on socket name or path or just the default.

func (*Server) Attach

func (server *Server) Attach(sessionName string) (string, string, error)

Attach attaches to session in the given server. If no target session is given, tmux will pref most recently used unattached session

func (*Server) CreateSession

func (server *Server) CreateSession(sessionName string, sessionPath string) (*Session, error)

CreateSession creates a tmux session based on name and working directory

func (*Server) GetSession

func (server *Server) GetSession(sessionName string) (*Session, error)

GetSession retrieves a tmux session by name

func (*Server) GetSessions

func (server *Server) GetSessions() ([]*Session, error)

GetSessions retrieves all tmux sessions

func (*Server) SessionExists

func (server *Server) SessionExists(sessionName string) bool

SessionExists checks if session exists based on its name

func (*Server) Start

func (server *Server) Start() (string, string, error)

Start starts a new tmux server with a single session using either the socket name or the socket path

type Session

type Session struct {
	Id      string // unique session ID
	Name    string // name of session
	Path    string // working directory of session
	Windows int    // number of windows in session
}

Jump to

Keyboard shortcuts

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