Documentation
¶
Index ¶
- Constants
- func AttachSession() error
- func CalcRelativeSplitSizes(panes []int) []int
- func CapturePane(target string, lines int) (string, error)
- func HasSession() bool
- func InsideTmux() bool
- func KillWindow(target string) error
- func NewSession(startDir string) error
- func NewWindow(name string, startDir string, detached bool) error
- func NewWindowWithCmd(name string, startDir string, detached bool, cmd string) error
- func ParseSizePercent(s string) int
- func Run(args ...string) (string, error)
- func RunSilent(args ...string) error
- func SelectWindow(window string) error
- func SendKeys(target string, keys string) error
- func SendKeysLiteral(target string, text string) error
- func SetupLayoutTree(windowTarget string, node *config.LayoutNode, paneTarget string, ...) error
- func SplitWindow(target string, horizontal bool, size string, startDir string) error
- func SplitWindowWithCmd(target string, horizontal bool, size string, startDir string, cmd string, ...) error
- func SwitchClient() error
- type PaneInfo
- type WindowInfo
Constants ¶
const SessionName = "kage"
Variables ¶
This section is empty.
Functions ¶
func AttachSession ¶
func AttachSession() error
AttachSession replaces the current process with tmux attach-session. This uses syscall.Exec so the Go process is replaced entirely.
func CalcRelativeSplitSizes ¶
CalcRelativeSplitSizes computes the tmux split percentages needed to achieve the desired absolute layout. tmux splits are relative to the remaining space. For example, [60%, 20%, 20%] → the first pane gets 60%. The remaining 40% is split: 20/40 = 50% for the second, leaving 20/20 = 100% (no split needed). Returns the percentage for each split operation (first pane is the initial window, so we return n-1 values for n panes).
func CapturePane ¶
CapturePane captures visible content from a tmux pane. If lines > 0, only the last N lines are captured.
func InsideTmux ¶
func InsideTmux() bool
InsideTmux returns true if the current process is inside a tmux session.
func NewSession ¶
NewSession creates a new tmux session named "kage" in detached mode. The first window is named "dashboard". If startDir is non-empty, the session starts in that directory.
func NewWindow ¶
NewWindow creates a new window in the kage session. If detached is true, the window is created without switching to it.
func NewWindowWithCmd ¶
NewWindowWithCmd creates a new window and runs a command directly in it. Unlike NewWindow + SendKeys, this avoids the race condition where keystrokes arrive before the shell is ready.
func ParseSizePercent ¶
ParseSizePercent extracts the integer from a percentage string like "60%".
func SelectWindow ¶
SelectWindow switches to a specific window in the kage session.
func SendKeysLiteral ¶
SendKeysLiteral sends literal text to a tmux pane (no special key interpretation).
func SetupLayoutTree ¶
func SetupLayoutTree(windowTarget string, node *config.LayoutNode, paneTarget string, workDir string, initialCmdHandled bool) error
SetupLayoutTree creates panes according to a recursive layout tree. windowTarget is like "kage:1", paneTarget is like "kage:1.0". If initialCmdHandled is true, the first leaf pane's command was already started (e.g. via NewWindowWithCmd) and should not be sent again.
func SplitWindow ¶
SplitWindow splits a pane. If horizontal is true, splits top/bottom (-v flag in tmux). size is a percentage string like "20%".
func SplitWindowWithCmd ¶
func SplitWindowWithCmd(target string, horizontal bool, size string, startDir string, cmd string, detached bool) error
SplitWindowWithCmd splits a pane and runs a command directly in the new pane. Unlike SplitWindow + SendKeys, this avoids the race condition where keystrokes arrive before the shell is ready. The pane is set to remain-on-exit so it stays open if the command exits. If detached is true, the original pane retains focus.
func SwitchClient ¶
func SwitchClient() error
SwitchClient switches the current tmux client to the kage session.
Types ¶
type WindowInfo ¶
WindowInfo represents a tmux window.
func ListWindows ¶
func ListWindows() ([]WindowInfo, error)
ListWindows returns all windows in the kage session.