Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clickable ¶
Clickable is an optional extension; modules that implement it receive click dispatches for any segment whose ClickID they emit.
type Hoverable ¶
type Hoverable interface {
HoverText() string
}
Hoverable is an optional extension; modules implementing it provide extra text shown in a popup tooltip while the pointer hovers any of their segments. Returning "" suppresses the popup. The method is called from the dispatch goroutine on every hover-enter transition, so implementations must be cheap and safe for concurrent reads.
type Module ¶
type Module interface {
// Name returns a short identifier used in logs and for click-id namespacing.
Name() string
// Start launches the module's background work. It must close the returned
// channel when ctx is cancelled. Each receive on the channel means "my
// state changed, please redraw."
Start(ctx context.Context) <-chan struct{}
// Render is called from the main loop after a signal; it must be fast and
// return the current visible content. Implementations may cache and return
// the same slice between updates.
Render() []Segment
}
Module is the contract every bar plug-in implements. Modules run in their own goroutine started by Start, signal "redraw me" on the returned channel, and produce visible content via Render. OnClick is optional.
type Scrollable ¶
Scrollable is an optional extension; modules that implement it receive vertical scroll (mouse-wheel) dispatches for any segment whose ClickID they emit. up is true for an away-from-user scroll, false for toward-the-user.
type Segment ¶
type Segment struct {
Icon string // optional, drawn before Text. Single nerd-font glyph.
Text string // primary text (may be empty if icon-only)
// Disc, when > 0, makes the segment a filled anti-aliased circle of this
// diameter (logical pixels) in the FG colour. When BG is also set, a
// larger BG halo circle is drawn behind it. Icon and Text are ignored.
// Used for tag dots, which want smooth anti-aliased circles rather than
// a font glyph.
Disc int32
FG color.RGBA // text colour (zero-value = use theme default)
BG color.RGBA // background colour (zero-value = transparent — uses bar bg)
PadL int32 // extra left padding, in pixels
PadR int32 // extra right padding, in pixels
GapIcon int32 // gap between icon and text in pixels (default 4)
ClickID string // non-empty makes the segment a click target
}
Segment is one atomic visible unit on the bar: optional icon glyph, text, foreground/background colours, and an optional click identifier. Modules build their visible content as an ordered list of Segments.