Documentation
¶
Overview ¶
Package layout keeps SSHYard's workspace: tabs, each a tree of split panes, each pane showing one item. An item is of a kind: a terminal session, a files (SFTP) browser, an editor of a remote file, an AI assistant, or a tool on the sessions (the broadcast, the session logs, the snippets, the command history, the system monitor, the process usage, the host's details, Docker, tmux). All are panes alike, so any of them can sit in any split cell, be dragged onto another pane's edge, be focused and closed. An item lives in exactly one pane; moving it (by drag and drop) takes it out of its old pane. Item IDs are unique across kinds.
Index ¶
- type Axis
- type Edge
- type Item
- type Kind
- type Node
- type Tab
- type Workspace
- func (w *Workspace) Activate(id int) bool
- func (w *Workspace) ActiveTab() *Tab
- func (w *Workspace) AddTab(root *Node, focus int)
- func (w *Workspace) Close(id int) bool
- func (w *Workspace) CloseTab(tabID int) []Item
- func (w *Workspace) Detach(id int) bool
- func (w *Workspace) FreshID() int
- func (w *Workspace) Items() []Item
- func (w *Workspace) Locate(id int) (*Tab, *Node)
- func (w *Workspace) Move(id, targetPane int, edge Edge) bool
- func (w *Workspace) MoveTab(tabID, target int, after bool) bool
- func (w *Workspace) Open(item Item) *Tab
- func (w *Workspace) Place(item Item, targetPane int, edge Edge) bool
- func (w *Workspace) Replace(old int, item Item) bool
- func (w *Workspace) SplitFocused(axis Axis, item Item) *Node
- func (w *Workspace) TabOf(pane int) *Tab
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Kind ¶
type Kind int
Kind is what a pane shows.
const ( // Terminal is a terminal session. Terminal Kind = iota // Files is a files (SFTP) browser. Files // Editor edits a remote file. Editor // AI is an assistant bound to one host. It does not open a connection. AI // Broadcast sends a command to several terminals; Logs keeps their // session logs; Snippets and History send saved and past commands to // the focused terminal; Monitor, Usage, HostInfo, Docker and Tmux show // and work on the focused session's host. None is bound to a host. Broadcast Logs Snippets History Monitor Usage HostInfo Docker Tmux )
type Tab ¶
type Tab struct {
ID int
Root *Node
Focus int // the focused pane
// Title is the name the user gave the tab, "" for its host's.
Title string
}
Tab is one tab of the workspace.
type Workspace ¶
type Workspace struct {
Tabs []*Tab
Active int // index into Tabs, -1 when empty
// contains filtered or unexported fields
}
Workspace is the set of tabs.
func (*Workspace) AddTab ¶
AddTab appends a tab whose root the caller built with FreshID, and shows it. focus is a pane id in root; an unknown focus lands on the first pane.
func (*Workspace) Move ¶
Move drops an item on a pane: at the Center the two items swap places; at an edge the target pane splits and the item takes the new half. The item leaves its old pane, and a tab left empty closes. Kinds mix freely.
func (*Workspace) MoveTab ¶ added in v0.0.18
MoveTab puts the tab of ID tabID before the tab of ID target, or after it, and keeps the shown tab shown. It reports whether the order changed.
func (*Workspace) Place ¶
Place puts an item that is in no pane yet on a pane: at an edge the pane splits and the item takes the new half; at the Center it takes the pane, and the item it showed moves out to a tab of its own, so that nothing is lost.
func (*Workspace) Replace ¶
Replace shows item, which is in no pane yet, in the pane showing the item with ID old, which leaves the workspace. The pane is focused.
func (*Workspace) SplitFocused ¶
SplitFocused splits the active tab's focused pane, showing item in the new pane (right of or below it), and focuses the new pane. With no tab it opens one.