Documentation
¶
Overview ¶
Package workspacelist is the presentation component shared by the project Workspaces sidebar and the global Workspaces browser.
It owns the parts of a workspace list that both consumers must agree on — stable-ID selection, the filter input and its pure multi-field matcher, sort modes and their stable ordering, activity grouping, the viewport and its scrollbar, and the empty/no-match rows. It owns none of the parts that belong to a data owner: it cannot inspect tmux, read Git, switch projects, create worktrees, or attach to a terminal. Callers project their own records into Item and hand back a row renderer for source-specific metadata.
The rule that keeps this honest: nothing in this package imports a plugin, the app, or the inventory. It receives resolved display fields only.
Both consumers render through RenderSidebar. Global Model supplies sort sections and a sort action; project Workspaces supplies Shells/Workspaces sections and optional creation actions. The component lays out both without learning what those actions do.
Index ¶
- Constants
- Variables
- func ApplySelection(content string, width int, selected, focused bool) string
- func BlendColor(low, high color.Color, amount float64) color.Color
- func IsScrollbarRegion(kind RegionKind) bool
- func KindGlyph(kind string) string
- func Match(item Item, query string) bool
- func MatchFields(query string, fields ...string) bool
- func MoveIndex(index, delta, count int) int
- func NoMatchRow(width int, query string) string
- func PulseCircle(level float64) string
- func PulseDiamond(level float64) string
- func PulseLane(lane string) bool
- func PulseLevel(levels []float64, frame int) float64
- func PulseMarker(lane string, frame int) (icon string, style lipgloss.Style, ok bool)
- func PulseStyle(base color.Color, level float64, bold bool) lipgloss.Style
- func RelativeAge(changedAt, now time.Time) string
- func RenderRow(row RowPresentation, width int, selected, focused bool) []string
- func ResizePercent(start, deltaColumns, viewportWidth int) int
- func SectionTitle(name string, count int) string
- func SortActionID(mode Sort) string
- func SortIndex(mode Sort, modes []Sort) int
- func SortPillLabel(mode Sort) string
- type Filter
- func (f *Filter) Active() bool
- func (f *Filter) Blur()
- func (f *Filter) Focus()
- func (f *Filter) Focused() bool
- func (f *Filter) HandleKey(key, text string) KeyResult
- func (f *Filter) Insert(text string)
- func (f *Filter) Query() string
- func (f *Filter) RenderRow(width, matched, total int) string
- func (f *Filter) Reset()
- func (f *Filter) SetQuery(query string)
- type Group
- type Item
- type KeyResult
- type MarkerTone
- type Model
- func (m *Model) Bottom() bool
- func (m *Model) Counts() (matched, total int)
- func (m *Model) CycleSort()
- func (m *Model) Filter() *Filter
- func (m *Model) FilterKey(key, text string) KeyResult
- func (m *Model) FocusFilter()
- func (m *Model) IsPinned(id string) bool
- func (m *Model) Items() []Item
- func (m *Model) Move(delta int) bool
- func (m *Model) NeedsPulse() bool
- func (m *Model) PinnedIDs() []string
- func (m *Model) Render(opts RenderOptions) Rendered
- func (m *Model) Reproject()
- func (m *Model) Scroll(delta int)
- func (m *Model) ScrollAtBoundary(delta int) bool
- func (m *Model) ScrollOffset() int
- func (m *Model) SelectID(id string) bool
- func (m *Model) Selected() (Item, bool)
- func (m *Model) SelectedID() string
- func (m *Model) SetCreateActions(header *SidebarAction, sections map[string]*SidebarAction)
- func (m *Model) SetEmptyState(lines []string, actionID string, actionLine int)
- func (m *Model) SetEmptyText(text string)
- func (m *Model) SetFailures(failures []string)
- func (m *Model) SetItems(items []Item)
- func (m *Model) SetLoading(loading bool)
- func (m *Model) SetPinned(ids []string)
- func (m *Model) SetPulseFrame(frame int)
- func (m *Model) SetScrollViewport(offset int)
- func (m *Model) SetSort(mode Sort)
- func (m *Model) Sort() Sort
- func (m *Model) TogglePin(id string) []string
- func (m *Model) Top() bool
- func (m *Model) Visible() []Item
- type Region
- type RegionKind
- type RenderOptions
- type Rendered
- type RowField
- type RowMarker
- type RowPresentation
- type ScrollGesture
- type Section
- type SidebarAction
- type SidebarOptions
- type SidebarRendered
- type SidebarRow
- type SidebarScrollbar
- type SidebarSection
- type Sort
Constants ¶
const ( RecentNew = "New" RecentToday = "Today" RecentThisWeek = "This week" RecentOlder = "Older" )
Recent time-bucket headings. Empty buckets are omitted.
const ( KindWorktree = "worktree" KindShell = "shell" )
Kind is a presentation identity for a row. These strings match the catalog kinds the caller already resolved; this package never imports inventory.
const PulseInterval = 175 * time.Millisecond
PulseInterval is the frame period every surface that breathes a working or blocked marker advances on. Sharing it keeps the project sidebar and the global Workspaces list visually in step rather than beating against each other at different rates.
const SortGlyph = "⇅"
SortGlyph marks the header control as a sort rather than a caption. A bare "Activity" in the corner of a panel says nothing about why it is there; the same word behind ⇅ says the list is ordered by it and that the control is worth pressing.
It is ⇅ rather than the word "Sort:" because the control shares its row with the create button and, on a narrow sidebar, six columns of label is the difference between both controls fitting and neither. It is ⇅ rather than a single arrow because the list offers no direction to point in — a ↓ would be answering a question nobody asked. U+21C5 is ordinary Unicode, not a Nerd Font glyph, so it survives a plain terminal font.
Variables ¶
var ( WorkingPulse = []float64{1.00, 0.96, 0.87, 0.75, 0.62, 0.50, 0.42, 0.38, 0.42, 0.50, 0.62, 0.75, 0.87, 0.96} BlockedPulse = []float64{1.00, 0.78, 0.52, 0.88, 1.00, 0.68, 0.43, 0.38, 0.38, 0.38, 0.38, 0.38, 0.43, 0.52, 0.68, 0.84} )
Working breathes evenly. Blocked uses two brighter beats followed by a longer rest so it attracts attention without making the whole row blink.
var SortModes = []Sort{SortActivity, SortProject, SortRecent, SortName}
SortModes is the cycle order behind the global list's sort control. Manual is absent: it means something only to a consumer that owns its input order.
Functions ¶
func ApplySelection ¶
ApplySelection gives both consumers the same focused and unfocused cursor treatment while leaving their row text and icons caller-owned. Do not wrap a pre-rendered marker: lipgloss.Render resets all attributes, and the name after the icon will lose the fill. Use RenderRow, which paints the marker and the name as sibling spans.
func BlendColor ¶ added in v1.0.0
func IsScrollbarRegion ¶ added in v1.4.0
func IsScrollbarRegion(kind RegionKind) bool
IsScrollbarRegion reports whether kind belongs to the list's bar rather than to its content.
func KindGlyph ¶
KindGlyph is the Agents-board pair: worktree ⑂, shell ❯. Unknown or empty kinds render nothing so a project-plugin row can omit them.
func Match ¶
Match reports whether an item satisfies a query. Matching is case-insensitive and space-separated: every token must appear somewhere in the item's promised fields, so "sidecar modal" narrows rather than widens. An empty or whitespace-only query matches everything.
func MatchFields ¶
MatchFields is the same matcher for callers that have not built an Item — the project sidebar filters its own worktree and shell records this way, so both consumers share one definition of "matches".
func MoveIndex ¶
MoveIndex applies the shared clamped selection semantics used by keyboard and wheel navigation in both workspace sidebars.
func NoMatchRow ¶
NoMatchRow is the honest empty state for a query that matches nothing. A blank list would read as "nothing exists" rather than "nothing matches".
func PulseCircle ¶ added in v1.0.0
func PulseDiamond ¶ added in v1.0.0
func PulseLane ¶ added in v1.0.0
PulseLane reports whether a lane is one of the two live states that breathe.
func PulseLevel ¶ added in v1.0.0
func PulseMarker ¶ added in v1.0.0
PulseMarker is the animated form of a working or blocked marker at a given frame. ok is false for every other lane, so callers can fall back to the static marker they already resolved.
func PulseStyle ¶ added in v1.0.0
func RelativeAge ¶
RelativeAge formats freshness in the same small units the Agents board uses, so one item does not read "3m" on one tab and "3 minutes" on the other.
Everything under a minute reads "now". A second-level countdown is a claim to precision this data cannot back: last-interaction time is inferred from tmux and session files and is routinely off by more than the digits it is showing. It also churned — every row that had just moved redrew its number once a second, so the weakest number on the surface was also the one drawing the eye. "now" is the honest form of the same fact and it holds still.
func RenderRow ¶
func RenderRow(row RowPresentation, width int, selected, focused bool) []string
RenderRow renders one or two physical lines. Line one carries the row's whole identity — kind glyph, project, name, and its age — so a reader can scan shells and worktrees apart without dropping to the second line. Line two is agent detail alone and collapses to nothing when there is none. Narrow rows retain the status marker and name first, then add secondary identity only while space remains.
func ResizePercent ¶
ResizePercent applies the shared percentage delta and bounds used by both workspace dividers.
func SectionTitle ¶
SectionTitle words a list section's heading. Both the project sidebar and the global browser render through it so a heading cannot gain a count on one surface and lose it on the other.
The Kanban board words its lane headers itself: a column is as narrow as 17 columns there, which "Needs Attention (0)" overruns, and its label and count carry different colours rather than one string.
func SortActionID ¶ added in v1.0.0
SortActionID names the choice a View surface reports when a sort is picked. Both surfaces build their own sections — they offer different modes and different extra toggles — but they must not invent two names for the same choice, or a shared handler would answer to one and ignore the other.
func SortIndex ¶ added in v1.0.0
SortIndex is a mode's position in the offered set, for a list cursor.
func SortPillLabel ¶ added in v1.0.0
SortPillLabel is what the header control reads.
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter is the inline `/` query and its focus state. It is deliberately a plain value: filter state is in-memory per consumer and is never written to config or project state.
func (*Filter) Active ¶
Active reports that the filter still affects the list. A query survives losing focus so a user can filter, press enter, and keep working inside the narrowed list.
func (*Filter) Focus ¶
func (f *Filter) Focus()
Focus enters filtering. `/` is the explicit entry precisely so printable project commands (n, D, p) keep working when it is not focused.
func (*Filter) HandleKey ¶
HandleKey applies one key while the filter has focus. It returns KeyIgnored for anything the list should handle itself.
func (*Filter) Insert ¶
Insert appends typed or pasted text. Pastes go through the same path as keystrokes so a pasted branch name filters exactly like a typed one.
func (*Filter) RenderRow ¶
RenderRow draws the one-line filter affordance both consumers show. It is shared so the project sidebar and the global browser cannot drift on what filtering looks like or on how counts are phrased.
type Group ¶
type Group string
Group is an item's presentation bucket. The buckets are a vertical projection of the shared Kanban semantics — they are assigned by the caller from resolved agentstatus, not derived here, so this package never becomes a second status reducer.
func GroupForLane ¶ added in v1.0.0
GroupForLane is the vertical projection of a resolved agent lane, shared by every consumer that groups by activity.
It takes the lane as a string rather than an agentstatus.LaneID so this package keeps its promise not to import a status reducer: it does not decide what "blocked" means, only where a row already resolved as blocked belongs in a list. An unrecognised lane lands in Paused, which is the bucket for "something is here and its state is not legible" — a row this does not recognise is still a row someone has to see.
type Item ¶
type Item struct {
ID string
Name string
NameMeta []RowField
Project string
ProjectKey string
ProjectOrder int
Branch string
Task string
Provider string
// TmuxName is an identity key, never rendered. It is searchable so two
// shells sharing a display name inside one project can be told apart.
TmuxName string
Status string
Detail string
// Kind is a presentation string ("worktree" / "shell"), not a catalog type.
Kind string
Marker RowMarker
Group Group
ChangedAt time.Time
Data any
}
Item is one row's resolved display identity. Every field is presentation input: the component matches, sorts, groups, and renders from these values and reads nothing behind them. Data carries the caller's own record so a selection can be resolved back to its owner without this package knowing the type.
type KeyResult ¶
type KeyResult uint8
KeyResult tells a consumer what a key did to the filter, so the list keeps its own navigation while the filter owns the text.
const ( // KeyIgnored: the filter did not want this key. Navigation keys land here // on purpose — arrows and ctrl+n/ctrl+p must stay live while filtering. KeyIgnored KeyResult = iota // KeyHandled: the query changed (or a first escape cleared it). KeyHandled // KeyAccept: enter — leave the focused item selected, return to the list. KeyAccept // KeyExit: escape on an empty query — filter focus is released. KeyExit )
type MarkerTone ¶
type MarkerTone string
MarkerTone describes non-semantic row identities and health states. Agent activity should use Lane instead; the caller has already resolved that lane and this renderer only gives the resolved marker its shared visual treatment.
const ( MarkerMuted MarkerTone = "muted" MarkerLive MarkerTone = "live" MarkerMain MarkerTone = "main" MarkerWarning MarkerTone = "warning" MarkerError MarkerTone = "error" )
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the list state a consumer owns: the catalog projection, the chosen sort, the filter, and the selection/viewport. Selection is by stable ID, so a refresh, a filter keystroke, or a sort change moves the cursor with the item rather than with the row number.
func (*Model) CycleSort ¶
func (m *Model) CycleSort()
CycleSort advances `s` through Activity → Project → Recent → Name.
func (*Model) FilterKey ¶
FilterKey applies a key while the filter owns focus and reprojects when the query changed.
func (*Model) NeedsPulse ¶ added in v1.0.0
NeedsPulse reports whether any currently visible row carries a lane that breathes, so a consumer can keep its animation clock off when nothing on screen would move.
func (*Model) PinnedIDs ¶
PinnedIDs returns the configured pin order, including IDs that are not currently visible.
func (*Model) Render ¶
func (m *Model) Render(opts RenderOptions) Rendered
Render draws the list: header with the active sort, filter row, section headings, rows, and a scrollbar. Headings scroll with their rows so the heading a row sits under is always the heading above it.
func (*Model) Reproject ¶
func (m *Model) Reproject()
Reproject re-runs filter and sort after a caller changed the query directly (a paste, a programmatic clear). Selection is preserved by identity.
func (*Model) Scroll ¶
Scroll follows the selected row. It remains as the compatibility entry point for callers that previously moved only the viewport; workspace wheel input must have the same selection-following semantics everywhere.
func (*Model) ScrollAtBoundary ¶ added in v1.0.0
ScrollAtBoundary reports whether moving the selection by delta would leave this list unchanged. Wheel navigation follows selection, so its boundary is the first or last visible item rather than the viewport offset alone.
func (*Model) ScrollOffset ¶
ScrollOffset is the first visible row index. Consumers read it to prove the viewport survived a refresh; nothing else depends on it.
func (*Model) SelectedID ¶
func (*Model) SetCreateActions ¶ added in v1.0.0
func (m *Model) SetCreateActions(header *SidebarAction, sections map[string]*SidebarAction)
SetCreateActions supplies presentation-only create affordances. Section actions are keyed by Section.Key, which is a stable project identity under Project sort. Nil removes the corresponding affordance and hit region.
func (*Model) SetEmptyState ¶ added in v1.3.0
SetEmptyState replaces the catalog-empty copy with already-styled lines and an optional pressable row. SetEmptyText is the one-line form.
func (*Model) SetEmptyText ¶
func (*Model) SetFailures ¶
SetFailures records per-project unavailability rows. They are presentation only; the list never retries or repairs anything.
func (*Model) SetItems ¶
SetItems replaces the catalog projection, preserving the selected identity.
func (*Model) SetLoading ¶
SetLoading marks that inventory is still arriving. Rows already collected stay on screen: incremental results are the point.
func (*Model) SetPinned ¶
SetPinned replaces the pin order. IDs that are not in the current catalog are kept until the next reproject so a later SetItems can restore them; display only includes pins that still have a matching item.
func (*Model) SetPulseFrame ¶ added in v1.0.0
SetPulseFrame advances the working/blocked marker animation. Consumers that never tick leave it at zero and get the steady first frame.
func (*Model) SetScrollViewport ¶ added in v1.4.0
SetScrollViewport pins the list's viewport to an offset a scrollbar gesture chose, latching free-scroll mode: renders keep the chosen position even when the selected row sits outside it. Any selection move — keyboard, wheel, or a click on a row — clears the latch, and following resumes.
type Region ¶
type RegionKind ¶
type RegionKind string
RegionKind names a mouse target the list drew. Regions are reported from the same layout that rendered the rows, so a hit test can never disagree with what is on screen.
const ( RegionRow RegionKind = "workspacelist-row" RegionSort RegionKind = "workspacelist-sort" RegionFilter RegionKind = "workspacelist-filter" )
const ( RegionHeaderAction RegionKind = "workspacelist-header-action" RegionSectionAction RegionKind = "workspacelist-section-action" RegionEmptyAction RegionKind = "workspacelist-empty-action" )
const ( RegionScrollbarTrack RegionKind = RegionKind(ui.RegionScrollbarTrack) RegionScrollbarThumb RegionKind = RegionKind(ui.RegionScrollbarThumb) )
The scrollbar's region kinds are the shared core's IDs, so every surface's hit map names a scrollbar identically and the shared gesture contract reads the same everywhere.
type RenderOptions ¶
type RenderOptions struct {
Width, Height int
Title string
Focused bool
Now time.Time
// ScrollbarHover / ScrollbarDrag carry the list bar's pointer emphasis
// from the surface's mouse state into the draw.
ScrollbarHover bool
ScrollbarDrag bool
}
RenderOptions describes the box the list is drawn into.
type Rendered ¶
type Rendered struct {
View string
Regions []Region
// Scrollbar reports the interactive bar this pass drew, for surfaces
// answering presses on its thumb/track regions.
Scrollbar SidebarScrollbar
}
Rendered is the drawn list plus the regions it registered.
type RowField ¶
RowField carries both the semantic text used under selection and an optional styled form used on an unselected row. This lets project-only badges remain project-owned without moving their layout into the plugin.
func PlainField ¶
type RowMarker ¶
type RowMarker struct {
Icon string
Lane string
Tone MarkerTone
Style lipgloss.Style
HasStyle bool
}
RowMarker is a caller-resolved status symbol. Style is reserved for the project sidebar's animated working/blocked frames; ordinary callers provide Lane or Tone and get the same colour vocabulary everywhere.
type RowPresentation ¶
type RowPresentation struct {
Marker RowMarker
Kind string
Name string
NamePrefix RowField
Age string
NameMeta []RowField
BeforeProvider []RowField
Provider string
AfterProvider []RowField
Pinned bool
}
RowPresentation is the neutral two-line workspace row contract shared by the project and global Workspaces surfaces. Callers resolve all state and supply display fields; this package owns layout, marker placement, provider treatment, ANSI-safe fitting, and selection.
Kind is a presentation field, not a status marker. Marker stays the outdented gutter icon (working/live/idle/ambiguous/main).
type ScrollGesture ¶ added in v1.4.0
type ScrollGesture struct {
// contains filtered or unexported fields
}
ScrollGesture is one surface's in-flight pointer gesture on the shared sidebar bar, following docs/plans/active/mouse-draggable-scrollbars.md: a thumb press grabs where it landed, a track press jumps so the grabbed point becomes the thumb anchor and the same gesture continues from there, and dragging maps the pointer back through the shared inverse mapping — clamped at both ends without ever ending the gesture.
It is state-free about the list itself: the surface owns its offset and applies what Press and DragTo return through its own viewport setter, which is what keeps the math adoptable by a headless caller unchanged.
func (*ScrollGesture) Active ¶ added in v1.4.0
func (g *ScrollGesture) Active() bool
Active reports that a gesture is in flight.
func (*ScrollGesture) DragTo ¶ added in v1.4.0
func (g *ScrollGesture) DragTo(pointerRow int) int
DragTo maps the pointer's absolute row back onto the dragged offset, preserving where within the thumb the gesture grabbed. OffsetAtRow clamps past both ends of the track without ending anything.
func (*ScrollGesture) End ¶ added in v1.4.0
func (g *ScrollGesture) End()
End settles the gesture — on a release anywhere, or on the first button-less motion after a release was lost outside the window. Nothing is persisted; a scroll offset is ephemeral view state.
func (*ScrollGesture) Press ¶ added in v1.4.0
func (g *ScrollGesture) Press(bar SidebarScrollbar, trackY, pointerRow int, thumb bool, offset int) int
Press begins a gesture from a press on one of the bar's regions and returns the offset to scroll to now. bar is the last render's snapshot, trackY the absolute screen row of the track top, pointerRow the pressed absolute row, thumb whether the thumb rather than the track was pressed, and offset the view's current scroll offset — the anchor a thumb press grabs at.
type Section ¶
type Section struct {
Title string
// Key is the stable grouping identity when a section represents a project.
// Presentation callers can hang an action from it without decoding Title.
Key string
Group Group
Items []Item
}
Section is a rendered group of items with its heading. Title is the heading without a count; empty Title means an unheaded run. Group is the Activity bucket when that sort is in play.
func Grouped ¶
Grouped splits sorted items into headed sections. Activity uses the Kanban projection; Project one heading per project; Recent the time buckets; Name stays a single unheaded run.
type SidebarAction ¶
SidebarAction is an optional action painted in a header. Omitting it paints and registers nothing, which lets read-only consumers use the same sidebar without inheriting project workspace mutations.
type SidebarOptions ¶
type SidebarOptions struct {
Width, Height int
Title string
Focused bool
SelectedID string
ScrollOffset int
HeaderAction *SidebarAction
HeaderMeta *SidebarAction
PrefixLines []string
FilterLine string
FilterActive bool
Sections []SidebarSection
EmptyLines []string
// EmptyActionID names one of EmptyLines as a pressable control and gives
// it a hit region. An empty state that offers an action has to be
// clickable for the same reason its key has to be advertised: the two
// interaction models say the same thing or neither is trustworthy.
EmptyActionID string
EmptyActionLine int
// InteractiveScrollbar opts the bar into the pointer contract: thumb and
// track Regions are appended after every content region — reverse-scan
// priority, so a press on the bar is answered by the bar and never by a
// row beneath its column — and the drawn geometry is reported for hit
// registration. Nothing is registered when everything fits. Surfaces that
// have not adopted pointer scrolling leave it false and get exactly the
// draw-only bar of before.
InteractiveScrollbar bool
// FreeScroll reports that ScrollOffset was chosen by a pointer gesture
// rather than derived from the selection, so the render clamps it without
// dragging the selected row back into view — a drag past the selection
// would otherwise be pulled straight back. Any selection move clears it.
FreeScroll bool
// ScrollbarHover / ScrollbarDrag feed the bar's pointer emphasis back into
// the draw, following the divider's HandleState convention. Idle output
// stays byte-identical to plain RenderScrollbar.
ScrollbarHover bool
ScrollbarDrag bool
}
SidebarOptions contains only resolved presentation state. Collection, selection side effects, preview loading and mutations stay with the caller.
type SidebarRendered ¶
type SidebarRendered struct {
View string
Regions []Region
ScrollOffset int
VisibleRows int
// Scrollbar reports the bar this pass drew at the list's right edge, for
// surfaces answering presses on its regions. Has is false whenever no
// thumb exists — everything fits, or no body was drawn.
Scrollbar SidebarScrollbar
}
SidebarRendered is the exact view, geometry and viewport produced by one layout pass. Regions use content-local coordinates; callers add their panel border/padding origin once when registering them.
func RenderSidebar ¶
func RenderSidebar(opts SidebarOptions) SidebarRendered
RenderSidebar is the single row/section/viewport/scrollbar/hit-region renderer used by project and global Workspaces.
type SidebarRow ¶
type SidebarRow struct {
ID string
Data any
Render func(width int, selected, focused bool) []string
}
SidebarRow is one caller-owned record projected into the shared list. Data is returned unchanged in the row's Region so consumers never decode display text or a volatile visible index to recover their record.
type SidebarScrollbar ¶ added in v1.4.0
type SidebarScrollbar struct {
Params ui.ScrollbarParams
TrackTop int // first row of the track, content-local
ThumbTop int // thumb's offset within the track, in rows
ThumbH int // thumb height in rows
Has bool
}
SidebarScrollbar is what one render pass learned about the list's bar: the params it was drawn with and where its track and thumb landed, in content coordinates (the same space as Regions). A bar that was not drawn can never register regions or answer a press.
type SidebarSection ¶
type SidebarSection struct {
Title string
Count int
Action *SidebarAction
Rows []SidebarRow
}
SidebarSection is a headed run of rows. The optional action is commonly the project's create-shell/create-worktree affordance; global sections omit it.
Title is the bare name ("Shells", "Needs Attention") and Count is rendered beside it. They are kept apart rather than pre-joined so a narrow heading can drop the count and still name its rows. An empty Title means an unheaded run.
type Sort ¶
type Sort uint8
Sort is an explicit user-chosen ordering. Sorting is presentation only: it never changes identities, and it never triggers collection.
const ( SortActivity Sort = iota SortProject SortRecent SortName // SortManual is the caller's own order, left exactly as handed in. It is // offered only where a durable order actually exists — the project // sidebar's fixed Shells/Worktrees structure, and later its drag order. // Global inventory does not pretend to own Git or tmux ordering, so it // does not offer this. SortManual )
func SortFromAction ¶ added in v1.0.0
SortFromAction resolves an action ID back to a mode within the offered set.
func SortFromLabel ¶ added in v1.0.0
SortFromLabel resolves a persisted label back to a mode within the offered set, case-insensitively. Labels are what surfaces persist: they read plainly in a state file and survive the enum being reordered. A label this set does not offer reports false so the caller can fall back to its own default rather than land on an arbitrary mode.