multiplexer

package
v1.37.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OnExistsAttach = "attach"
	OnExistsKill   = "kill"
	OnExistsNew    = "new"
	OnExistsSwitch = "switch"
)

OnExists constants define how to handle existing sessions.

Variables

This section is empty.

Functions

func BuildTmuxScript

func BuildTmuxScript(sessionName string, tmuxCfg *config.TmuxCommand, windows []ResolvedWindow, env map[string]string) string

BuildTmuxScript generates a shell script that creates or attaches to a tmux session. The script handles session existence based on tmuxCfg.OnExists and optionally attaches if tmuxCfg.Attach is true.

func BuildTmuxWindowCommand

func BuildTmuxWindowCommand(command string, env map[string]string) string

BuildTmuxWindowCommand builds the command string for a tmux window with environment exports.

func BuildZellijScript

func BuildZellijScript(sessionName string, zellijCfg *config.TmuxCommand, layoutPaths []string) string

BuildZellijScript generates a shell script that creates or attaches to a zellij session. The script handles session existence based on zellijCfg.OnExists and creates tabs from layoutPaths.

func BuildZellijTabLayout

func BuildZellijTabLayout(window ResolvedWindow) string

BuildZellijTabLayout generates a KDL layout for a single zellij tab.

func CleanupZellijLayouts

func CleanupZellijLayouts(paths []string)

CleanupZellijLayouts removes temporary layout files.

func ExportEnvCommand

func ExportEnvCommand(env map[string]string) string

ExportEnvCommand builds a shell command string that exports environment variables. Returns empty string if env is empty.

func KdlQuote

func KdlQuote(input string) string

KdlQuote quotes a string for use in KDL (Zellij layout format).

func ReadSessionFile

func ReadSessionFile(path, fallback string) string

ReadSessionFile reads the session name from a file, returning fallback if the file cannot be read or is empty.

func SanitizeTmuxSessionName

func SanitizeTmuxSessionName(name string) string

SanitizeTmuxSessionName removes invalid characters from a tmux session name.

func SanitizeZellijSessionName

func SanitizeZellijSessionName(name string) string

SanitizeZellijSessionName removes invalid characters from a zellij session name.

func ShellQuote

func ShellQuote(input string) string

ShellQuote quotes a string for use in a shell command. Returns an empty quoted string for empty input.

func WriteZellijLayouts

func WriteZellijLayouts(windows []ResolvedWindow) ([]string, error)

WriteZellijLayouts creates temporary layout files for each window. Returns the list of created file paths and an error if any operation failed. Caller is responsible for cleanup using CleanupZellijLayouts.

Types

type ResolvedWindow

type ResolvedWindow struct {
	Name    string
	Command string
	Cwd     string
}

ResolvedWindow represents a window/tab configuration after environment variable expansion.

func ResolveTmuxWindows

func ResolveTmuxWindows(windows []config.TmuxWindow, env map[string]string, defaultCwd string) ([]ResolvedWindow, bool)

ResolveTmuxWindows resolves window configurations by expanding environment variables. Returns the resolved windows and a boolean indicating success.

Jump to

Keyboard shortcuts

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