Help us shape the future of Go! Take the 2026 Go Developer Survey

terminal

package
v1.2.14 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TerminalComponent

type TerminalComponent interface {
	tea.Model
	layout.Sizeable
	layout.Bindings
	IsRunning() bool
	Close() error
}

TerminalComponent wraps a PTY + vt emulator as a Bubble Tea v1 model.

func New

func New(width, height int, shellPath string, shellArgs []string) (TerminalComponent, error)

New creates a new TerminalComponent, launches the configured shell inside a PTY.

type TerminalOpenedMsg added in v0.5.0

type TerminalOpenedMsg struct {
	InitCmd tea.Cmd
}

TerminalOpenedMsg is sent after a new terminal is successfully opened. It carries the init command so the caller can properly update the model's focus state.

type TerminalPanel

type TerminalPanel struct {
	// contains filtered or unexported fields
}

TerminalPanel is the bottom-anchored panel containing the tab bar and the active terminal's output.

func NewTerminalPanel

func NewTerminalPanel() *TerminalPanel

NewTerminalPanel creates an empty, hidden terminal panel.

func (*TerminalPanel) BindingKeys

func (p *TerminalPanel) BindingKeys() []key.Binding

BindingKeys returns the keybindings handled by the panel / tab bar.

func (*TerminalPanel) Blur

func (p *TerminalPanel) Blur()

Blur removes keyboard focus from the terminal panel.

func (*TerminalPanel) CloseTabAt added in v0.26.2

func (p *TerminalPanel) CloseTabAt(idx int)

CloseTabAt closes the terminal tab at the given index.

func (*TerminalPanel) Focus

func (p *TerminalPanel) Focus()

Focus gives keyboard focus to the active terminal.

func (*TerminalPanel) HasTerminals

func (p *TerminalPanel) HasTerminals() bool

HasTerminals returns true when at least one terminal tab is open.

func (*TerminalPanel) IsFocused

func (p *TerminalPanel) IsFocused() bool

IsFocused returns whether the terminal panel currently has focus.

func (*TerminalPanel) IsVisible

func (p *TerminalPanel) IsVisible() bool

IsVisible returns whether the panel is currently shown.

func (*TerminalPanel) NextTab added in v0.26.2

func (p *TerminalPanel) NextTab()

NextTab switches to the next terminal tab.

func (*TerminalPanel) OpenNewTerminal

func (p *TerminalPanel) OpenNewTerminal() tea.Cmd

OpenNewTerminal creates a new terminal session and adds it to the panel. It also makes the panel visible if it was hidden. The shell is read from config.Shell; falls back to $SHELL / /bin/bash.

func (*TerminalPanel) PanelHeight

func (p *TerminalPanel) PanelHeight() int

PanelHeight returns the height this panel occupies (tab bar + body).

func (*TerminalPanel) SetActiveTab added in v0.26.2

func (p *TerminalPanel) SetActiveTab(idx int)

SetActiveTab switches directly to the tab at the given index.

func (*TerminalPanel) SetSize

func (p *TerminalPanel) SetSize(totalWidth, totalHeight int) tea.Cmd

SetSize sets the total available width and the full-screen height so the panel can compute its own height as ~40 % of the screen. All open terminals are resized, not just the active one.

func (*TerminalPanel) Show added in v0.14.0

func (p *TerminalPanel) Show()

Show makes the panel visible without toggling.

func (*TerminalPanel) TabCount added in v0.26.2

func (p *TerminalPanel) TabCount() int

TabCount returns the number of open terminal tabs.

func (*TerminalPanel) Toggle

func (p *TerminalPanel) Toggle()

Toggle hides or shows the panel.

func (*TerminalPanel) Update

func (p *TerminalPanel) Update(msg tea.Msg) (*TerminalPanel, tea.Cmd)

Update propagates Bubble Tea messages to the active terminal and the tab bar.

func (*TerminalPanel) View

func (p *TerminalPanel) View() string

View renders the tab bar and terminal content.

type TerminalTab

type TerminalTab struct {
	Title    string
	Terminal TerminalComponent
	Running  bool
}

TerminalTab represents one terminal session in the tab bar.

type TerminalTabBar

type TerminalTabBar struct {
	// contains filtered or unexported fields
}

TerminalTabBar manages multiple terminal tabs.

func NewTerminalTabBar

func NewTerminalTabBar() *TerminalTabBar

NewTerminalTabBar creates a new tab bar for terminals.

func (*TerminalTabBar) ActiveTerminal

func (t *TerminalTabBar) ActiveTerminal() TerminalComponent

ActiveTerminal returns the active terminal component, or nil if none.

func (*TerminalTabBar) BindingKeys

func (t *TerminalTabBar) BindingKeys() []key.Binding

BindingKeys implements layout.Bindings.

func (*TerminalTabBar) CloseActiveTab

func (t *TerminalTabBar) CloseActiveTab()

CloseActiveTab closes the currently focused tab.

func (*TerminalTabBar) CloseTab

func (t *TerminalTabBar) CloseTab(index int)

CloseTab closes the tab at the given index, cleaning up the terminal.

func (*TerminalTabBar) Count

func (t *TerminalTabBar) Count() int

Count returns the number of open tabs.

func (*TerminalTabBar) NextTab

func (t *TerminalTabBar) NextTab()

NextTab switches to the next tab.

func (*TerminalTabBar) OpenTab

func (t *TerminalTabBar) OpenTab(term TerminalComponent) int

OpenTab adds a new terminal tab and returns its index.

func (*TerminalTabBar) PrevTab

func (t *TerminalTabBar) PrevTab()

PrevTab switches to the previous tab.

func (*TerminalTabBar) SetWidth

func (t *TerminalTabBar) SetWidth(width int)

SetWidth sets the available render width.

func (*TerminalTabBar) Update

func (t *TerminalTabBar) Update(msg tea.Msg) (*TerminalTabBar, tea.Cmd)

Update handles tab keybindings.

func (*TerminalTabBar) View

func (t *TerminalTabBar) View() string

View renders the one-line tab bar.

type ToggleTerminalMsg

type ToggleTerminalMsg struct{}

ToggleTerminalMsg is broadcast to show/hide the terminal panel.

Jump to

Keyboard shortcuts

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