Documentation
¶
Index ¶
- type Direction
- type Pane
- type Server
- func (s *Server) AddSession(name string, path string) (Session, error)
- func (*Server) AddWindow(name string, path string) (string, error)
- func (s *Server) AttachSession(session Session) error
- func (s *Server) CurrentSession() (Session, error)
- func (s *Server) CurrentWindow() (Window, error)
- func (*Server) HasSession(name string) bool
- func (*Server) ListPanes(targetWindow string) ([]Pane, error)
- func (s *Server) ListSessions(detachedOnly bool) ([]Session, error)
- func (s *Server) ListWindows(sessionId string) ([]Window, error)
- func (*Server) RenameWindow(targetWindow string, newName string) error
- func (*Server) SelectLayout(targetWindow string, layoutType string) error
- func (*Server) SelectPane(targetPane string) error
- func (*Server) SelectWindow(targetWindow string) error
- func (*Server) SendKeys(targetPane string, keys string) error
- func (s *Server) SessionByName(name string) (*Session, error)
- func (*Server) SplitPane(targetPane string, direction Direction, startDirectory string) (string, error)
- type Session
- type TmuxContext
- type Window
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
}
Server represents a tmux server instance and provides methods to interact with it.
func (*Server) AddSession ¶
Add session
we should guard against session names containing - the separator `:` - the char `.`
but are problematic, but since we normalize before, we should be fine
func (*Server) AddWindow ¶
Creates a new window with the given name and starting directory Returns the unique window ID assigned by tmux
func (*Server) AttachSession ¶
AttachSession attaches to an existing session.
The behavior depends on the current tmux context:
- Attached: switches to the session using switch-session
- Detached: attaches to the session using attach-session
- Serverless: switches the client to the session using switch-client
func (*Server) CurrentSession ¶
func (*Server) CurrentWindow ¶
CurrentWindow returns the currently active window
func (*Server) HasSession ¶
HasSession checks if a tmux session with the given name exists. Returns true if the session exists, false otherwise.
func (*Server) ListSessions ¶
Lists all sessions managed by this server.
func (*Server) ListWindows ¶
Lists all Windows of the targeted session
func (*Server) RenameWindow ¶ added in v0.9.0
RenameWindow renames the specified window to the given name. The target can be a window ID, window index, or window name.
func (*Server) SelectLayout ¶ added in v0.9.0
SelectLayout applies a layout to the specified window. The target can be a window ID, window index, or window name. layoutType should be one of: even-horizontal, even-vertical, main-horizontal, main-vertical, tiled.
func (*Server) SelectPane ¶
SelectPane selects (focuses) the specified pane. The target can be a pane ID, or a pane index.
func (*Server) SelectWindow ¶
SelectWindow selects (switches to) the specified window. The target can be a window ID, window index, or window name.
func (*Server) SendKeys ¶
SendKeys sends keys/commands to the specified pane. Automatically sends Enter (C-m) after the keys.
func (*Server) SessionByName ¶
SessionByName retrieves a Session by name.
Returns nil pointer if session not found
type Session ¶
type Session struct {
Id string `json:"id"`
Name string `json:"name"`
Attached bool `json:"attached"`
Path string `json:"path"`
Windows []Window `json:"windows"`
}
Session represents a tmux session with its name, attachment status, and working directory.
type TmuxContext ¶
type TmuxContext int64
TmuxContext represents the current execution context relative to tmux.
const ( // Attached indicates the process is running inside a tmux session. Attached TmuxContext = iota // Detached indicates a tmux server is running but the process is outside any session. Detached // Serverless indicates no tmux server is currently running. Serverless )