Documentation
¶
Overview ¶
Package terminal provides a thin abstraction for spawning a new terminal window that attaches to an existing tmux session.
This is used by the TUI's Shift+Enter binding to "pop out" an agent-deck session into its own native terminal window (e.g. a fresh iTerm2 window on macOS), leaving agent-deck running undisturbed in the original window.
The cross-platform surface is intentionally tiny: callers pass the destination tmux session name (and optional `-L <socket>` selector) plus a hint at which terminal program they would like, and the platform-specific implementation does the rest. When a platform has no implementation, the stub returns ErrUnsupported so callers can show a friendly fallback.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupported = errors.New("terminal: opening a new window is not yet supported on this platform")
ErrUnsupported is returned by OpenSessionInNewWindow on platforms that have no native implementation yet. Callers should surface a non-fatal message rather than treating this as an error condition.
Functions ¶
func BuildAttachCommand ¶ added in v1.9.21
func BuildAttachCommand(req AttachRequest) string
BuildAttachCommand returns the shell command string that, when executed inside a fresh terminal window, attaches to the requested tmux session.
It is exported (and pure) so platform implementations and tests can share the exact same string-building logic without depending on os/exec.
func OpenSessionInNewWindow ¶ added in v1.9.21
func OpenSessionInNewWindow(_ AttachRequest) error
OpenSessionInNewWindow is a no-op on non-macOS platforms. It returns ErrUnsupported so the TUI can render a friendly "not yet supported" message instead of treating the case as a hard failure. A future implementation for Linux (`gnome-terminal --`, `kitty`, ...) or Windows (`wt.exe new-tab`) can replace this stub without changing call sites.
Types ¶
type AttachRequest ¶ added in v1.9.21
type AttachRequest struct {
// Name is the tmux session name (the `-t` argument of `tmux attach`).
Name string
// SocketName is the optional `-L <socket>` selector. Empty means the
// default server.
SocketName string
// Terminal is an optional hint for which native terminal to use
// (e.g. "iterm2"). Empty means "use the platform default".
Terminal string
}
AttachRequest describes the tmux session a new terminal window should attach to once spawned.
Name is required. SocketName may be empty (meaning the default tmux server), matching the semantics of tmux.Session.SocketName.