wm

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 25 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 (
	// Every move: hover, clicks, drags and the wheel
	MouseAll = "all"
	// Clicks, drags and the wheel, no hover
	MouseClicks = "clicks"
	// Nothing: the terminal keeps the mouse, its selection and its taps to itself
	MouseOff = "off"
)

How much of the mouse the app follows, as the setting of the mouse names it

View Source
const (
	GroupRecent  = "Recent"
	GroupWindows = "Windows"
	GroupTabs    = "Tabs"
	GroupLayout  = "Layout"
	GroupSpaces  = "Spaces"
)

Headings the palette lists the manager's own commands under, and the one over the commands used last. What the focused window answers is listed under its kind, such as Chat

View Source
const DefaultToastTTL = 4 * time.Second

Default life of a toast

View Source
const SheetArmDelay = 600 * time.Millisecond

Quiet time after a sheet or a guarded overlay comes into view before keys and clicks reach it

Variables

This section is empty.

Functions

func HiddenText

func HiddenText(above, below int) string

Words for the rows a scrolled picker or table hides above and below, in the language of the window

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 Tracking

func Tracking(value string) tea.MouseMode

Mouse tracking the terminal is asked for by the setting's value, every move for a value it does not name

Types

type ActionMsg

type ActionMsg struct {
	ID string
}

Keymap action fired at the focused card

type Addressed

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 Answerer

type Answerer interface {
	Answers(action string) bool
}

Card that says which actions of its contexts it has a use for, so the palette lists those and no others

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
	// What it does in a few words, shown beside the title: the description of the key action of its id when empty
	Detail string
	// Heading the palette lists it under, the commands of one heading together in the order they come
	Group string
	// Reports whether the command applies right now, always when nil
	When func() bool
	// Listed under every other command, where the way out of the application belongs
	Last 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 Fitter

type Fitter interface {
	FitIn(w, h int) (int, int)
}

Card that sizes itself to the room it is given, the content columns and rows it takes within w by h

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 Footer interface {
	Footer(room int) FooterLine
}

Card that paints a line of its own into its bottom edge, its status, given the columns the two parts may take together

type FooterLine

type FooterLine struct {
	Left, Right string
	// Spans of either part that fire an action when clicked
	Spans []FooterSpan
}

Status a card paints into its bottom edge, a part at the left end and one at the right end with the border running between them

type FooterSpan

type FooterSpan struct {
	X0, X1 int
	Right  bool
	Action string
}

Columns of a footer part, counted from its first cell, that fire an action when clicked

type Glypher

type Glypher interface {
	Glyph() string
}

Card with an icon shown before its title

type Grabber

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 Guarded

type Guarded interface {
	Guarded() bool
}

Overlay that, like a sheet, holds its answer keys back for a moment after it appears and while a burst of typing goes on

type Hint

type Hint struct {
	Action string
	// Word on the button, the label of the action when empty
	Label string
}

A button on the bottom edge of the focused card. Enter presses the first one, tab moves to the next, a click presses any

type Hinter

type Hinter interface {
	Hints() []Hint
}

Card with buttons: the things to do with what it shows now, the one enter does first

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
	// Heading the row is listed under while nothing is typed, the rows of one heading coming together. Typed text finds the row by the
	// heading too. No headings show when no row names one
	Group string
	// Second listing of a row, as under a heading of the rows used last: left out once text is typed, and out of the count
	Again bool
	Run   func() tea.Cmd
}

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 Kinded

type Kinded interface {
	Kind() string
}

Card that names its kind, such as Chat or Terminal, for the commands the palette lists for it

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 {
	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 arrangement new workspaces take, the workspace on the stage, the commands run lately and every open workspace as it stands. The style and the motion are settings of the app, which keep them

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 on screen is still moving, the cards of the workspaces off the stage moving on without counting

func (*Model) Attach

func (m *Model) Attach(card, sheet Card) tea.Cmd

Shows the sheet inside the frame of the card that asked for it, queued behind the sheets that card already holds, the card glowing while it is not focused. A card that is not open shows the sheet as an overlay

func (*Model) Attached

func (m *Model) Attached(sheet Card) bool

Whether the card waits as a sheet inside another card's frame

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) Blurred

func (m *Model) Blurred() bool

Whether the terminal said it lost the focus of the desktop, the person looking at another window

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) 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) Composed

func (m *Model) Composed() ([]uv.Line, uint64)

Cells of the frame as last composed, laid out as the screen shows them, and the count of the frames composed so far, which moves each time the cells may have changed: the kit finds the pictures the terminal places by position in them

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) Detach

func (m *Model) Detach(sheet Card) tea.Cmd

Takes the sheet out of the card it sits in, the next one waiting there coming into view

func (*Model) Dismiss

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

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

func (*Model) DismissCard

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

Closes the card wherever it waits, on top, held beneath another overlay or as a sheet in a card's frame

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) 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) FocusAttention

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

Focuses the card a sheet waits in, the sheets in view first and the oldest first, then a card that glows for attention, skipping the focused card

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) FocusReported

func (m *Model) FocusReported() bool

Whether the terminal has said anything of its focus yet, which a terminal that reports focus does as it gains or loses it

func (*Model) Focused

func (m *Model) Focused() Card

Card with the input focus on the stage

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 arrangement new workspaces take following the workspace on the stage

func (*Model) LeaderWait

func (m *Model) LeaderWait() time.Duration

How long the keys after the leader wait before they close by themselves, zero for until a key

func (*Model) Leading

func (m *Model) Leading() bool

Whether the keys after the leader wait to be pressed now

func (*Model) Mirror

func (m *Model) Mirror(on bool)

Lets the frame be drawn right to left while the window's language is written so, or keeps it left to right whatever the language, for a terminal that mirrors what it is sent itself

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) 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) 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, each under its heading: the commands used last, the app's, what the focused window answers under its kind, then the manager's own. A command the app lists last ends the rows of its heading

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) Pointer

func (m *Model) Pointer() (x, y int, at time.Time, ok bool)

Cell of the screen the terminal last reported the pointer at and when, false while the terminal is not asked to report its every move, or reported none yet

func (*Model) Ratio

func (m *Model) Ratio() float64

Master share of the stage the workspace on the stage uses

func (*Model) Redraw

func (m *Model) Redraw()

Draws the screen again on the next render with the cards as they are drawn, for what the window manager draws around them that changed outside any message to it, such as the readout in its corner

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) Restore

func (m *Model) Restore(l Layout)

Applies the arrangement new workspaces take and the commands run lately of a saved layout, the workspaces open now taking the arrangement too

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 and lays them out as saved: a card resolve makes takes the state it kept before it starts, a tab group is made again around the tabs resolve makes of it, and a key resolve makes nothing for, or one open already elsewhere, is skipped. The cards the workspace holds already keep their place before the saved ones

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, time.Time)

Text currently swept with the time now, else the text the last sweep copied with when it ended; empty when nothing was swept

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 comet that runs round the frame of the focused card on or off, which shows while motion is on and the theme is not plain

func (*Model) SetCommandSource

func (m *Model) SetCommandSource(source func() []Command)

Sets where the commands the app contributes come from, asked each time they are listed or run and taking 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, every legend drawn from the one before drawn again

func (*Model) SetLayout

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

Switches the workspace on the stage to an arrangement

func (*Model) SetLeaderWait

func (m *Model) SetLeaderWait(wait time.Duration)

Has the keys after the leader close by themselves once they waited this long, a wait of zero or less keeping them until a key

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) SetMouse

func (m *Model) SetMouse(value string)

Sets the mouse tracking the next frame asks the terminal for, by the setting's value

func (*Model) SetReadout

func (m *Model) SetReadout(read func() (string, Level))

Sets the readout painted over the bottom right corner of every frame, such as the frame rate, nil for none

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 what the program does to the terminal by the Program Status Protocol, nil clearing it: each report replaces the one before whole, so a report that stays the same is no change

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, a sticky one held beneath until this one closes

func (*Model) ShowsOverlay

func (m *Model) ShowsOverlay(c Card) bool

Whether the card is the overlay on top or one held beneath it

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) 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) ToastRegion

func (m *Model) ToastRegion() (Box, bool)

Screen box the toasts take now, the right half of the rows they stack in, false while none shows

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) Touch

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

Draws the card, or the card holding it, again on the next render and no other: for what it shows that changed outside any message to it, such as what work done for it alone brought. No card is drawn again for one no longer on screen anywhere

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. Handed the screen as last drawn while the message before it changed nothing that shows

func (*Model) Wake

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

Starts the frame clock again when it stopped, for an app whose card began to move without any input reaching the window manager

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 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 WithMouse

func WithMouse(value string) Option

Asks the terminal for the mouse tracking of the setting's value

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 Ordered

type Ordered interface {
	KeepsOrder() bool
}

A card whose content keeps the order it is drawn in when the window is drawn right to left, such as a terminal whose program lays out its own screen: the card moves to the mirrored place, what is inside it stays as the program drew it

type Painter

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
	// contains filtered or unexported fields
}

Fuzzy picker of the commands typed into from the bar field with its matches hanging below

func NewPalette

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

Builds a palette over the items

func (*Palette) Animate

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

Glides the highlight toward the selected row, jumping there when motion is off. It is drawn on whole rows, so it rests once it shows the row it glides to

func (*Palette) Contexts

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

Keymap contexts in force, the picker keys ahead of the field keys

func (*Palette) Glyph

func (p *Palette) Glyph() string

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, 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) Measure

func (p *Palette) Measure(w int)

Tells the palette the columns its rows get, before its rows are counted

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 detail of the lit row where the rows leave theirs out, none while there is no row

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

How many rows the typed text found, nothing while none is typed

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, the input itself painted in the field. Matches that run past the rows scroll beside a scrollbar in the last two columns, on a sheet wide enough for one

func (*Palette) Wants

func (p *Palette) Wants() int

Columns the rows want so that every one of them shows whole, whatever is typed

type Passer

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 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 SelfClosing

type SelfClosing interface {
	ClosesItself() bool
}

Overlay or sheet that carries out its close key itself, a question declining and staying until its asker drops it

type SheetHolder

type SheetHolder interface {
	SheetArea(w, h int) Box
}

Card that gives the sheets it holds a part of its content, such as the rows above its prompt, in content coordinates

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 Sticky

type Sticky interface {
	Sticky() bool
}

Overlay that only its answer or an explicit dismissal closes, held beneath the palette or a later overlay instead of dropped

type SweepScroller

type SweepScroller interface {
	// Window rows the scrolling text fills, the first and one past the last
	SweepArea() (top, bottom int)
	// Scrolls the text by rows, negative toward its start, returning the rows it moved
	SweepScroll(rows int) int
	// Plain text of window rows counted from the first row of the window, rows outside the window included
	SweepRows(from, to int) []string
}

Card whose text scrolls under a sweep held past its edge, so one sweep can cover more than a window of it

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) Answers

func (g *Tabs) Answers(action string) bool

Whether the shown tab has a use for the action

func (*Tabs) Awake

func (g *Tabs) Awake() bool

Keeps the frame clock running while the tab in front needs it, the tabs behind it showing nothing and moving on whenever the clock runs

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) Footer

func (g *Tabs) Footer(room int) FooterLine

Footer line of the active tab

func (*Tabs) Glyph

func (g *Tabs) Glyph() string

func (*Tabs) Grabs

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

Buttons of the active 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

type Tracker interface {
	Tracks() bool
}

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

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) MainCount

func (w *Workspace) MainCount() int

Tiles the main area holds in the master arrangement

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"`
	// Tab groups by the key of the frame they share, the keys of their tabs in order
	Groups map[string][]string `json:"groups,omitempty"`
	// State the cards keep between runs, by key, the tabs of the groups among them
	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 key of a card passed through rename, keys it returns empty for left out along with their tree leaves, focus, zoom and saved state. The key of a tab group is the manager's own and stays, its tabs renamed and the tab it showed with them; a group none of whose tabs is left is left out

Jump to

Keyboard shortcuts

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