mux

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package mux delegates external commands (editor, shell, any program) to tmux windows so bee keeps running live in its own window while the command runs independently in a tab. No terminal handoff: tmux new-window returns instantly and the caller's process is untouched.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EditorCommand

func EditorCommand(editor, file string, line int) string

EditorCommand builds the command line opening file in editor, jumping to line when >0. Empty file opens the directory (".").

func ExecCmd

func ExecCmd(cmdline, dir string) *exec.Cmd

ExecCmd builds a foreground *exec.Cmd running cmdline via the shell in dir. Used for the suspend fallback when not inside tmux (tea.ExecProcess). cmdline is operator-typed (same trust model as the inline ! shell), so the shell interpolation here is intended, not an injection surface.

func InTmux

func InTmux() bool

InTmux reports whether the current process runs inside a tmux client.

func JobSupported

func JobSupported() bool

JobSupported reports whether job-control launch is available (unix).

func OpenWindow

func OpenWindow(o Opts) error

OpenWindow opens (or focuses) a tmux window per o.

func ResolveEditor

func ResolveEditor(cfg string) string

ResolveEditor picks the editor: explicit cfg value, else $VISUAL, else $EDITOR, else vim.

func ResumeJob

func ResumeJob(pid int, ttyFd uintptr) (stopped bool, err error)

ResumeJob continues a previously stopped child: hand it the terminal, send SIGCONT, and wait again until it stops or exits.

func StartJob

func StartJob(cmd *exec.Cmd, ttyFd uintptr) (stopped bool, pid int, err error)

StartJob launches cmd in its own process group as the foreground job of the controlling terminal, then waits until it exits or is stopped (Ctrl-Z). Returns stopped=true with the child pid when it was suspended (still alive), stopped=false when it exited.

Types

type Opts

type Opts struct {
	Name string // tmux window name (also used to reuse an existing window)
	Dir  string // working directory (-c)
	Cmd  string // command line run in the window
}

Opts describes a window to open.

Jump to

Keyboard shortcuts

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