wm

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 20 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Tiling window manager for terminal cards with workspaces, floating dialogs, a command palette and spring motion

Index

Constants

View Source
const DefaultToastTTL = 4 * time.Second

Default life of a toast

Variables

View Source
var HiddenText = func(above, below int) string {
	var parts []string
	if above > 0 {
		parts = append(parts, lang.T(txt.KitWmMoreAbove, above))
	}
	if below > 0 {
		parts = append(parts, lang.T(txt.KitWmMoreBelow, below))
	}
	return strings.Join(parts, " · ")
}

Words for the rows a scrolled picker or table hides above and below, replaced by an app that speaks its own language

Functions

func Notify

func Notify(text string, level Level) tea.Cmd

Asks the manager to show a toast for the default life

func RequestAttention

func RequestAttention(from Card, u Urgency) tea.Cmd

Asks the manager to glow the card with the urgency until it is focused, Calm clearing it

func RequestClose

func RequestClose(from Card) tea.Cmd

Asks the manager to close the card

func RequestDismissOf

func RequestDismissOf(from Card) tea.Cmd

Asks the manager to drop the overlay while it is still the card asking

func RequestOverlay

func RequestOverlay(card Card) tea.Cmd

Asks the manager to show a card above everything with first claim on input

Types

type ActionMsg

type ActionMsg struct {
	ID string
}

Keymap action fired at the focused card

type Addressed added in v1.0.10

type Addressed interface {
	Addressee() Card
}

Message meant for one card alone, delivered to it instead of every card, even once it has closed

type Animator

type Animator interface {
	Animate(dt float64) bool
}

Card that moves on its own, given scaled seconds or zero to jump to rest, answering whether its view changed

type Backer

type Backer interface {
	Back() bool
}

Overlay with a step of its own behind the close key: Back takes the key for that step and reports true, false letting the overlay close

type Box

type Box struct {
	X int `json:"x"`
	Y int `json:"y"`
	W int `json:"w"`
	H int `json:"h"`
}

Rectangle of whole cells

type Card

type Card interface {
	Title() string
	Init() tea.Cmd
	Update(tea.Msg) (Card, tea.Cmd)
	View(width, height int) string
}

Panel the manager places, frames and feeds messages

type Closable

type Closable interface {
	Closable() bool
}

Card the close command leaves alone when it answers false

type ClosedMsg

type ClosedMsg struct{}

Sent to a card once it is closed, before its frame has left the stage

type Command

type Command struct {
	ID    string
	Title string
	// Title at the moment it is shown, for a title that follows the language of the application
	Text func() string
	// Reports whether the command applies right now, always when nil
	When func() bool
	Run  func() tea.Cmd
}

Action the palette lists and the keymap fires, the manager's own or one the app registers

func (Command) Ready

func (c Command) Ready() bool

Reports whether the command applies right now

func (Command) TitleText

func (c Command) TitleText() string

TitleText is the title of the command in the language of the application, the title it carries when the application has none

type Contexter

type Contexter interface {
	Contexts() []string
}

Card that names the keymap contexts in force while it holds the input, most specific first

type Cursorer

type Cursorer interface {
	Cursor() *tea.Cursor
}

Card that places the terminal cursor relative to its content origin

type Dir

type Dir int

Direction on the stage

const (
	Left Dir = iota
	Right
	Up
	Down
)

type FloatLayout

type FloatLayout struct {
	Key string `json:"key"`
	Box Box    `json:"box"`
}

Float by key with the box it rests in

type Floater

type Floater interface {
	Floating() bool
}

Card that opens as a floating dialog over the tiles

type FocusMsg

type FocusMsg struct {
	Focused bool
}

Sent to a card when it gains or loses the input focus

type Glypher

type Glypher interface {
	Glyph() string
}

Card with an icon shown before its title

type Grabber added in v1.0.11

type Grabber interface {
	Grabs(x, y int) bool
}

Card with controls a press takes hold of, such as a scrollbar, the drag then following the pointer instead of sweeping text

type Hint

type Hint struct {
	Action string
	// Second action shown with the first as a pair such as j/k
	Pair string
	// Word shown instead of the action label when set
	Label string
	// Every chord of the action the terminal can send, slash separated, instead of the first
	All bool
}

One action a card answers, painted in the bottom edge of the focused card with its bound key

type Hinter

type Hinter interface {
	Hints() []Hint
}

Card that names the actions it answers while focused

type Holder

type Holder interface {
	Holds(Card) bool
}

Card that wraps others and can say whether it holds one

type Intent

type Intent struct {
	From Card
	// contains filtered or unexported fields
}

Request a card makes of the manager, delivered as a message it handles on its own

type Item

type Item struct {
	ID     string
	Title  string
	Detail string
	Keys   string
	Run    func() tea.Cmd
	// Leaves the palette open when picked, for a row that changes what the palette shows
	Stay bool
}

One row the palette offers

type Keyed

type Keyed interface {
	Key() string
}

Card with a stable identity, so opening it twice focuses the one already open

type Lane

type Lane struct {
	Name   string
	Signal Signal
	// Text after the signal mark, such as the tool running and how long the run has taken
	Detail string
}

Live state of one workspace as its chip shows it

type Layout

type Layout struct {
	Theme  string   `json:"theme,omitempty"`
	Motion *float64 `json:"motion,omitempty"`
	Ratio  float64  `json:"ratio,omitempty"`
	Mode   string   `json:"mode,omitempty"`
	Main   int      `json:"main,omitempty"`
	// Index of the workspace on the stage
	Active int `json:"active,omitempty"`
	// Command ids run lately, newest first
	Recent     []string          `json:"recent,omitempty"`
	Workspaces []WorkspaceLayout `json:"workspaces,omitempty"`
}

What the manager keeps between runs, the defaults new workspaces take and every open workspace as it stands

type Level

type Level int

Severity of a toast

const (
	Info Level = iota
	Success
	Warn
	Error
)

type Mode

type Mode int

Arrangement of the tiles of a workspace, a master beside a stack or a spiral of splits

const (
	Master Mode = iota
	Dwindle
)

func ParseMode

func ParseMode(s string) (Mode, bool)

Mode named by a string, false for an unknown name

func (Mode) String

func (m Mode) String() string

type Model

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

Window manager that tiles cards per workspace, floats dialogs, animates every move and routes input

func New

func New(opts ...Option) *Model

Builds a manager with the Blackwall theme, one cell gaps, a two column stage margin and 60 over 30 frames

func (*Model) Active

func (m *Model) Active() *Workspace

Workspace shown on the stage

func (*Model) ActiveIndex

func (m *Model) ActiveIndex() int

Index of the workspace shown on the stage

func (*Model) AddWorkspace

func (m *Model) AddWorkspace(id string, cards ...Card) (*Workspace, tea.Cmd)

Adds a workspace tiling the cards in order with the first focused, showing it when it is the first workspace

func (*Model) Advance

func (m *Model) Advance(dt float64) bool

Advances every animation by dt seconds and reports whether anything is still moving

func (*Model) Attention

func (m *Model) Attention(c Card, u Urgency) tea.Cmd

Lights the frame of the card with an urgency until it is focused, Calm turning it off

func (*Model) Capturing

func (m *Model) Capturing() bool

Reports whether an overlay holds the input

func (*Model) Cascade

func (m *Model) Cascade() bool

Reports whether the flowing energy comet is enabled

func (*Model) Close

func (m *Model) Close(c Card) tea.Cmd

Closes the card wherever it is open, a tab leaving its group

func (*Model) CloseFocused

func (m *Model) CloseFocused() tea.Cmd

Closes the focused card when it allows closing

func (*Model) CloseKey

func (m *Model) CloseKey(key string) tea.Cmd

Closes the card with the key wherever it is open

func (*Model) CloseWorkspace

func (m *Model) CloseWorkspace() tea.Cmd

Closes the workspace on the stage through the app's workspace.close command, else directly

func (*Model) Commands

func (m *Model) Commands() []Command

Every command, the app's first

func (*Model) Cycle

func (m *Model) Cycle(k int) tea.Cmd

Moves focus k steps through the tiles and floats of the stage, wrapping at both ends

func (*Model) CycleTab

func (m *Model) CycleTab(d int) tea.Cmd

Shows the next tab of the focused group, or the one before it

func (*Model) Dismiss

func (m *Model) Dismiss() tea.Cmd

Drops the overlay and hands input back to the focused card, the sheet fading out behind the veil

func (*Model) Find

func (m *Model) Find(key string) (Card, *Workspace)

Card with the key and the workspace holding it, a tab of a group included

func (*Model) Fire

func (m *Model) Fire(id string) tea.Cmd

Fires the action at the focused card, or runs the command of that id

func (*Model) Fits added in v1.0.12

func (m *Model) Fits(ws *Workspace, c Card) bool

Reports whether the card could be tiled in the workspace with every tile at or above its least size

func (*Model) FlipSplit

func (m *Model) FlipSplit() tea.Cmd

Flips the cut that holds the focused tile between side by side and stacked

func (*Model) Focus

func (m *Model) Focus(c Card) tea.Cmd

Focuses the card, switching to its workspace when it is in another

func (*Model) FocusDir

func (m *Model) FocusDir(d Dir) tea.Cmd

Moves focus to the nearest tile in the direction, floats first stepping back to the tiles

func (*Model) Focused

func (m *Model) Focused() Card

Card with the input focus on the stage

func (*Model) FrameOf

func (m *Model) FrameOf(c Card) (Box, bool)

Box the frame of the card is painted in on its stage right now, false when it is not open

func (*Model) Has

func (m *Model) Has(key string) bool

Reports whether a card with the key is open anywhere

func (*Model) IndexOf

func (m *Model) IndexOf(ws *Workspace) int

Index of the workspace, -1 when it is not held

func (*Model) Init

func (m *Model) Init() tea.Cmd

Starts the frame clock

func (*Model) JoinTab

func (m *Model) JoinTab() tea.Cmd

Moves the focused window into the tile beside it as its shown tab, the tile becoming a tab group

func (*Model) Keys

func (m *Model) Keys() *keys.Map

Keymap the manager dispatches keys and paints legends from

func (*Model) Layout

func (m *Model) Layout() Layout

Layout as it stands, the defaults following the workspace on the stage

func (*Model) Motion

func (m *Model) Motion() float64

func (*Model) Move

func (m *Model) Move(d Dir) tea.Cmd

Trades the focused tile with its neighbor in the direction, or nudges a float by a few cells

func (*Model) NewWorkspace

func (m *Model) NewWorkspace() tea.Cmd

Opens a workspace the way the app's workspace.new command does, nudging when none is registered

func (*Model) OnToast

func (m *Model) OnToast(fn func(text string, level Level))

Calls fn with every toast as it is shown

func (*Model) Open

func (m *Model) Open(ws *Workspace, c Card) tea.Cmd

Opens the card in the workspace, tiled or floating as it asks, or focuses the one with its key already open

func (*Model) OpenAside

func (m *Model) OpenAside(ws *Workspace, c Card, origin Box) tea.Cmd

Opens the card in a hidden workspace without switching to it, the card waiting there as its focus

func (*Model) OpenFrom

func (m *Model) OpenFrom(ws *Workspace, c Card, origin Box) tea.Cmd

Opens the card the way Open does, growing it out of the origin box when one is given

func (*Model) OpenHere

func (m *Model) OpenHere(c Card) tea.Cmd

Opens the card in the workspace on the stage

func (*Model) OpenPalette

func (m *Model) OpenPalette() tea.Cmd

Opens the palette over titled ready commands and the focused card actions, recent first

func (*Model) OpenTab

func (m *Model) OpenTab(c Card) tea.Cmd

Opens a card as a new shown tab of the focused tile, on its own when no tile has the focus

func (*Model) Overlay

func (m *Model) Overlay() Card

Card shown above everything, nil when none is

func (*Model) Ratio

func (m *Model) Ratio() float64

Master share of the stage the workspace on the stage uses

func (*Model) RemoveWorkspace

func (m *Model) RemoveWorkspace(i int) tea.Cmd

Drops workspace i and its cards, showing a neighbor when it was on the stage

func (*Model) Repaint

func (m *Model) Repaint()

Draws every card again on the next render, for state they show that changed outside them

func (*Model) ResetLayout

func (m *Model) ResetLayout() tea.Cmd

Returns the master share, every split and every stack weight to their defaults

func (*Model) Resize

func (m *Model) Resize(delta float64) tea.Cmd

Changes the master share of the stage by delta, or the split the focused tile was cut off by

func (*Model) Resting

func (m *Model) Resting() bool

Reports whether the clock has stopped scheduling frames

func (*Model) Restore

func (m *Model) Restore(l Layout)

Applies the defaults, motion and recent commands of a saved layout where options did not fix them

func (*Model) RestoreWorkspace

func (m *Model) RestoreWorkspace(ws *Workspace, l WorkspaceLayout, resolve func(key string) Card) tea.Cmd

Opens the cards of a saved workspace through resolve and lays them out as saved, skipping unresolved keys

func (*Model) Run

func (m *Model) Run(id string) tea.Cmd

Runs the command with the id, nil when none applies

func (*Model) Selected

func (m *Model) Selected() string

Text currently swept, empty when nothing is selected

func (*Model) SetBar

func (m *Model) SetBar(fn func() Status)

Supplies what the bar shows each frame, the lane of every workspace, the waiting item and the dials

func (*Model) SetCascade

func (m *Model) SetCascade(on bool)

Turns the flowing energy comet on the focused card's border on or off

func (*Model) SetCommands

func (m *Model) SetCommands(cmds []Command)

Replaces the commands the app contributes, which take precedence over the built in ones

func (*Model) SetEmptyHints

func (m *Model) SetEmptyHints(ids ...string)

Actions an empty stage invites with, each shown with its key and label while bound

func (*Model) SetKeys

func (m *Model) SetKeys(km *keys.Map)

Replaces the keymap

func (*Model) SetLayout

func (m *Model) SetLayout(mode Mode) tea.Cmd

Switches the workspace on the stage to an arrangement

func (*Model) SetMainCount

func (m *Model) SetMainCount(delta int) tea.Cmd

Changes how many tiles the main area of the master arrangement holds

func (*Model) SetMotion

func (m *Model) SetMotion(scale float64)

Scales every animation, zero snapping layouts, decodes and the focus ring into place

func (*Model) SetProgress

func (m *Model) SetProgress(pb *tea.ProgressBar)

Shows a progress bar in the terminal, nil clearing it

func (*Model) SetRatio

func (m *Model) SetRatio(r float64) tea.Cmd

Sets the master share of the workspace on the stage

func (*Model) SetSize

func (m *Model) SetSize(w, h int)

Resizes the stage, snapping placed cards to their new boxes, which keep their drawing while more sizes may follow

func (*Model) SetStatus

func (m *Model) SetStatus(ps *tea.ProgramStatus)

Reports the program state to the terminal, nil clearing it

func (*Model) SetTheme

func (m *Model) SetTheme(t theme.Theme)

Replaces the palette, border set and padding, repainting every card

func (*Model) SetWindowTitle

func (m *Model) SetWindowTitle(title string)

Sets the terminal window title

func (*Model) ShowOverlay

func (m *Model) ShowOverlay(c Card) tea.Cmd

Shows a card above everything with first claim on input, replacing any overlay up

func (*Model) Size

func (m *Model) Size() (int, int)

Screen size the manager was last given

func (*Model) SplitTab

func (m *Model) SplitTab() tea.Cmd

Takes the shown tab of the focused group out into a tile of its own, a group left with one tab dissolving

func (*Model) SwapMaster

func (m *Model) SwapMaster() tea.Cmd

Trades the focused tile with the master, or the master with the first stack tile

func (*Model) Switch

func (m *Model) Switch(i int) tea.Cmd

Shows workspace i, sliding the stage toward it

func (*Model) Theme

func (m *Model) Theme() theme.Theme

Palette in use

func (*Model) Toast

func (m *Model) Toast(text string, level Level, ttl time.Duration) tea.Cmd

Shows a toast for ttl, the default life when ttl is zero

func (*Model) Toasts

func (m *Model) Toasts() []string

Text of every toast on screen, oldest first

func (*Model) ToggleFloat

func (m *Model) ToggleFloat() tea.Cmd

Floats the focused tile or tiles the focused float

func (*Model) ToggleLayout

func (m *Model) ToggleLayout() tea.Cmd

Switches the workspace on the stage between the master and dwindle arrangements

func (*Model) ToggleZoom

func (m *Model) ToggleZoom() tea.Cmd

Fills the stage with the focused card or gives the stage back

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Routes frames to the animation, keys to the focused card, and the mouse to the card under it

func (*Model) UrgencyOf

func (m *Model) UrgencyOf(c Card) Urgency

Urgency the card asks for

func (*Model) View

func (m *Model) View() tea.View

Composites the bar, the stage, the veil, the overlay and the toasts into a full screen view with mouse tracking

func (*Model) WorkspaceByID

func (m *Model) WorkspaceByID(id string) *Workspace

Workspace bound to the id, nil when none is

func (*Model) WorkspaceOf

func (m *Model) WorkspaceOf(c Card) *Workspace

Workspace holding the card, nil when it is not open

func (*Model) Workspaces

func (m *Model) Workspaces() []*Workspace

Workspaces in order

type Note

type Note struct {
	Text  string
	Style SegmentStyle
}

Line under the rows of a palette, such as where a pick is saved or a warning about the lit row

type Notice

type Notice struct {
	Text   string
	Signal Signal
	// Items queued behind this one
	More   int
	Action string
}

Item waiting on the person, shown in the field until its action serves it

type Option

type Option func(*Model)

Configures the manager at construction

func WithKeys

func WithKeys(km *keys.Map) Option

Replaces the keymap keys are dispatched and legends painted from

func WithMotion

func WithMotion(scale float64) Option

Scales every animation, one for full springs and zero for layouts that snap into place

func WithTheme

func WithTheme(t theme.Theme) Option

Replaces the Blackwall palette

func WithWindowTitle

func WithWindowTitle(title string) Option

Sets the terminal window title

type Painter added in v1.0.10

type Painter interface {
	Paint(buf *uv.Buffer)
}

Card that paints its content into cells itself, the buffer sized to its content and cleared beforehand

type Palette

type Palette struct {
	Placeholder string
	// Called with the text when enter is pressed on a palette without items
	OnText func(text string) tea.Cmd
	// Called once when the palette loses its place as the overlay
	OnClose func() tea.Cmd
	// Keeps the items it accepts for the typed text in their own order, the fuzzy match when nil
	Filter func(query string, it Item) bool
	// Keeps a prompt open after enter, its owner closing it or putting rows in its place
	Hold bool
	// Shows the text typed into a prompt as dots
	Masked bool
	// Keymap context of the actions the palette answers besides its own, empty for none
	Context string
	// Actions of Context by id
	Actions map[string]func() tea.Cmd
	// Hints of the actions of Context, shown ahead of the palette's own
	Extra []Hint
	// Lines under the rows, read on every view
	Notes func() []Note
	// Step behind the close key, reporting whether it took the key
	OnBack func() bool
	// Ignores typing, picks and actions while its owner waits for an answer
	Busy bool
	// contains filtered or unexported fields
}

Fuzzy picker typed into from the bar field with its matches hanging below, a line of text without items

func NewPalette

func NewPalette(t theme.Theme, items []Item) *Palette

Builds a palette over the items

func NewPrompt

func NewPrompt(t theme.Theme, placeholder, value string, submit func(text string) tea.Cmd) *Palette

Builds a palette that takes a line of text, prefilled with value

func (*Palette) Animate

func (p *Palette) Animate(dt float64) bool

Glides the highlight toward the selected row, jumping there when motion is off

func (*Palette) Ask

func (p *Palette) Ask(text string, yes func() tea.Cmd)

Asks a yes or no question in the field, the rows making way for the notes until it is answered

func (*Palette) Asking

func (p *Palette) Asking() bool

Reports whether a question waits for its answer

func (*Palette) Back

func (p *Palette) Back() bool

Close key while a question is asked or a step lies behind the palette: the question withdrawn, else the step taken

func (*Palette) Contexts

func (p *Palette) Contexts() []string

Keymap contexts in force, the yes and no keys while a question is asked and the palette's own context ahead of the picker keys

func (*Palette) Glyph

func (p *Palette) Glyph() string

func (*Palette) Hints

func (p *Palette) Hints() []Hint

Actions the palette answers, the yes and no of a question, else those of its own context ahead of the picker keys

func (*Palette) Init

func (p *Palette) Init() tea.Cmd

func (*Palette) Input

func (p *Palette) Input(w int, bg color.Color) (string, int)

Query in w columns scrolled to keep the caret in view, the placeholder while empty and the question while one is asked, with the caret column

func (*Palette) Key

func (p *Palette) Key() string

func (*Palette) Lit

func (p *Palette) Lit() (Item, bool)

Row under the selection, false when the typed text matches none

func (*Palette) Matches

func (p *Palette) Matches() []Item

Items matching the query, best first

func (*Palette) Query

func (p *Palette) Query() string

Text typed so far

func (*Palette) Rows

func (p *Palette) Rows() int

Rows the sheet under the field wants, the matches and the notes under them, none for a prompt that lives in the field alone

func (*Palette) Select

func (p *Palette) Select(id string) bool

Moves the selection to the row with the id, reporting whether the typed text leaves it listed

func (*Palette) SetItems

func (p *Palette) SetItems(items []Item)

Replaces the rows in place and filters them by the typed text, the selection back on the first, a palette without rows taking a line of text

func (*Palette) SetQuery

func (p *Palette) SetQuery(text string)

Replaces the typed text and filters the rows by it

func (*Palette) Status

func (p *Palette) Status() string

Count of the rows scrolled out of the sheet above and below, empty while every match shows

func (*Palette) Tally

func (p *Palette) Tally() string

Matches out of the items

func (*Palette) Title

func (p *Palette) Title() string

func (*Palette) Update

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

func (*Palette) View

func (p *Palette) View(w, h int) string

Match rows of the sheet with the notes under them, the input itself painted in the field

type Passer added in v1.0.10

type Passer interface {
	Passes(tea.KeyPressMsg) bool
}

Raw card that still lets some keys fire the actions of other contexts, such as the window keys of a terminal

type Positioned

type Positioned interface {
	Origin(x, y int)
}

Card told the screen cell its content starts at before it paints, for images placed by screen position

type Raw

type Raw interface {
	Raw() bool
}

Card that takes every key as typed while it answers true, only the actions of its own contexts firing

type Reporter added in v1.0.14

type Reporter interface {
	// Chip of the workspace while the card is its lead, an empty name leaving the chip bare
	Lane() Lane
	// First item waiting on the person inside the card, false while nothing waits
	Waiting() (text string, signal Signal, at time.Time, ok bool)
}

Card standing on the bar for the sessions it holds, naming its chip and what waits in it

type Segment

type Segment struct {
	Text   string
	Style  SegmentStyle
	Action string
}

Control at the right of the bar that fires its action when clicked

type SegmentStyle

type SegmentStyle int

Color role of a dial

const (
	Plain SegmentStyle = iota
	Dim
	Cool
	Warm
	Hot
	Good
	Bad
)

type Selectable

type Selectable interface {
	Selectable() bool
}

Card whose content may be swept with the mouse to copy text

type Signal

type Signal int

What a workspace or a waiting item reports, later signals needing the person more

const (
	Idle Signal = iota
	Working
	Fresh
	Failed
	Blocked
)

type Sized

type Sized interface {
	MinSize() (w, h int)
}

Card that declares the content size it opens at when floating and the least it is useful at when tiled

type SplitLayout

type SplitLayout struct {
	Key      string       `json:"key,omitempty"`
	Vertical bool         `json:"vertical,omitempty"`
	Ratio    float64      `json:"ratio,omitempty"`
	A        *SplitLayout `json:"a,omitempty"`
	B        *SplitLayout `json:"b,omitempty"`
}

Node of the dwindle tree, a tile key at a leaf or a cut between two subtrees

type Stateful

type Stateful interface {
	State() any
	SetState(json.RawMessage) error
}

Card that keeps state between runs, handed back on the next start what it reported

type Status

type Status struct {
	Lanes  map[*Workspace]Lane
	Notice Notice
	// Least important first, dropped from the left when the bar runs out of room
	Dials []Segment
}

Everything the app shows on the bar for one frame

type Statuser

type Statuser interface {
	Status() string
}

Card with a short trailer for its bottom edge

type Tabs

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

Several cards sharing one frame behind a tab strip, the active one receiving input and filling the rest

func NewTabs

func NewTabs(t theme.Theme, title, glyph string, cards ...Card) *Tabs

Builds a tab group under a title and glyph holding the cards in order

func (*Tabs) Active

func (g *Tabs) Active() (Card, int)

Card under the active tab and its index

func (*Tabs) Animate

func (g *Tabs) Animate(dt float64) bool

Keeps every tab's own motion in step, reporting whether the shown one moved

func (*Tabs) Awake

func (g *Tabs) Awake() bool

Keeps the frame clock running while any tab needs it

func (*Tabs) Cards

func (g *Tabs) Cards() []Card

Cards held, in tab order

func (*Tabs) Contexts

func (g *Tabs) Contexts() []string

Contexts of the active tab, then the tab strip's own unless the tab takes every key raw

func (*Tabs) Cursor

func (g *Tabs) Cursor() *tea.Cursor

Cursor of the active card moved down past the strip and its padding

func (*Tabs) Glyph

func (g *Tabs) Glyph() string

func (*Tabs) Grabs added in v1.0.11

func (g *Tabs) Grabs(x, y int) bool

Hands a press below the strip to the card shown, which may take hold of the pointer

func (*Tabs) Hints

func (g *Tabs) Hints() []Hint

Actions of the active tab, then the tab switching one that reaches the manager even past a raw tab

func (*Tabs) Holds

func (g *Tabs) Holds(c Card) bool

Reports whether the card is one of the tabs

func (*Tabs) Init

func (g *Tabs) Init() tea.Cmd

func (*Tabs) Key

func (g *Tabs) Key() string

func (*Tabs) Len

func (g *Tabs) Len() int

func (*Tabs) MinSize

func (g *Tabs) MinSize() (int, int)

func (*Tabs) Passes

func (g *Tabs) Passes(k tea.KeyPressMsg) bool

Lets the keys the active tab passes reach the manager while it takes keys raw

func (*Tabs) Raw

func (g *Tabs) Raw() bool

Takes every key as typed while the active tab does

func (*Tabs) Select

func (g *Tabs) Select(i int) tea.Cmd

Switches the active tab, telling the old and new cards about focus

func (*Tabs) Selectable

func (g *Tabs) Selectable() bool

func (*Tabs) SetState

func (g *Tabs) SetState(raw json.RawMessage) error

Shows the tab a saved state names, keeping the current one when no card has its key

func (*Tabs) SetTheme

func (g *Tabs) SetTheme(t theme.Theme)

Replaces the palette the strip paints with

func (*Tabs) State

func (g *Tabs) State() any

Key of the active tab for the next run

func (*Tabs) Status

func (g *Tabs) Status() string

func (*Tabs) Title

func (g *Tabs) Title() string

func (*Tabs) Tracks

func (g *Tabs) Tracks() bool

Tracks the pointer while the active tab does

func (*Tabs) Update

func (g *Tabs) Update(msg tea.Msg) (Card, tea.Cmd)

func (*Tabs) View

func (g *Tabs) View(w, h int) string

type TapMsg

type TapMsg struct {
	X, Y int
	Mod  tea.KeyMod
	Link string
}

Sent to a card whose text can be swept when a left press and its release fall on one cell of its content with no sweep between, in content coordinates with the modifier keys held and the hyperlink painted on the cell

type TileLayout

type TileLayout struct {
	Key    string  `json:"key"`
	Weight float64 `json:"weight,omitempty"`
}

Tile by key with its share of the stack it sits in

type Tracker added in v1.0.10

type Tracker interface {
	Tracks() bool
}

Card handed every pointer motion over its content, in content coordinates

type Transparent

type Transparent interface {
	Holes() []Box
}

Card with boxes of content cells that must keep no background, so an image the terminal placed under them shows

type Urgency

type Urgency int

How urgently a card wants attention, driving the color its frame glows with

const (
	Calm Urgency = iota
	// Something waits on the person, such as an approval
	Pulse
	// Something failed
	Alarm
)

type Waker

type Waker interface {
	Awake() bool
}

Card that needs the frame clock running even while the screen rests, such as one refreshing on an interval

type WheelPasser

type WheelPasser interface {
	PassesWheel() bool
}

Overlay that leaves the wheel turned outside its frame to the card under the pointer, so what it asks about can be read behind it

type Workspace

type Workspace struct {
	ID string
	// contains filtered or unexported fields
}

Group of cards bound to one session, tiled in master and stack order with dialogs floating above

func (*Workspace) Cards

func (w *Workspace) Cards() []Card

Cards in the workspace, tiles first then floats

func (*Workspace) Empty added in v1.0.12

func (w *Workspace) Empty() bool

Reports whether the workspace holds no card that is not on its way out

func (*Workspace) Focused

func (w *Workspace) Focused() Card

Card with the input focus

func (*Workspace) MainCount

func (w *Workspace) MainCount() int

Tiles the main area holds in the master arrangement

func (*Workspace) Master

func (w *Workspace) Master() Card

Card filling the master area

func (*Workspace) Mode

func (w *Workspace) Mode() Mode

Arrangement the tiles follow

func (*Workspace) Ratio

func (w *Workspace) Ratio() float64

Share of the stage the master area takes

func (*Workspace) Urgent

func (w *Workspace) Urgent() bool

Reports whether the workspace asked for attention while not shown

func (*Workspace) Zoomed

func (w *Workspace) Zoomed() Card

Card filling the stage, nil when none is zoomed

type WorkspaceLayout

type WorkspaceLayout struct {
	ID     string        `json:"id"`
	Mode   string        `json:"mode,omitempty"`
	Ratio  float64       `json:"ratio,omitempty"`
	Main   int           `json:"main,omitempty"`
	Tiles  []TileLayout  `json:"tiles,omitempty"`
	Floats []FloatLayout `json:"floats,omitempty"`
	Tree   *SplitLayout  `json:"tree,omitempty"`
	Focus  string        `json:"focus,omitempty"`
	Zoom   string        `json:"zoom,omitempty"`
	// State the cards keep between runs, by key
	Cards map[string]json.RawMessage `json:"cards,omitempty"`
}

One workspace as it stands, its tiles in stage order

func (WorkspaceLayout) Rekeyed

func (l WorkspaceLayout) Rekeyed(id string, rename func(key string) string) WorkspaceLayout

Workspace with every card key passed through rename, keys it returns empty for left out along with their tree leaves, focus, zoom and saved state

Jump to

Keyboard shortcuts

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