Documentation
¶
Overview ¶
Package termtitle formats and emits the terminal window/tab title.
Two titles carry a name, and terminals disagree about which one labels a tab: most (Ghostty, WezTerm, kitty, Alacritty, Terminal.app) follow the window title, while iTerm2 labels tabs from the icon name. Set writes OSC 0, which sets both at once.
Sidecar deliberately does not route this through charm.land/bubbletea/v2.View.WindowTitle. Bubble Tea clears a title it owns whenever the renderer stops — including for the length of every tea.ExecProcess child — which would blank the terminal title for as long as the user stays attached to a session. Owning the sequence here means the title simply persists across those handoffs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Render ¶
Render expands tmpl and sanitizes the result. An empty tmpl renders an empty title, which is how the feature is turned off.
{worktree} expands with its own leading space and brackets (" [branch]") so that the default template, "{project}{worktree}", collapses to just the project name when there is no linked worktree.
func Save ¶
func Save() string
Save pushes the current titles onto the terminal's title stack, and Restore pops them back.
The parameter is 0 — icon name *and* window title, matching what Set writes — rather than 2, which would cover only the window title and leave the iTerm2 tab label pointing at the wrong project after exit. Terminals that don't implement the XTWINOPS title stack ignore both, and keep the last title sidecar set.
Types ¶
type Vars ¶
type Vars struct {
Project string // repo name, e.g. "sidecar"
Worktree string // branch of a linked worktree, empty on the main worktree
Plugin string // active plugin/tab name, e.g. "workspaces"
Dir string // base name of the working directory
}
Vars holds the substitutions available to a title template.