barista.run: barista.run/group Index | Files | Directories

package group

import "barista.run/group"

Package group provides a module that groups existing modules, and uses a provided Grouper to selectively display output from these modules.

Index

Package Files

group.go

func New Uses

func New(g Grouper, m ...bar.Module) bar.Module

New constructs a new group using the given Grouper and modules.

func Simple Uses

func Simple(mods ...bar.Module) bar.Module

Simple groups modules together with no extra controls. This is useful if you need multiple modules where only one module is accepted.

type Grouper Uses

type Grouper interface {
    // Visible returns true if the module at a given index is visible.
    Visible(index int) bool
    // Button returns the bar output for the buttons on either end.
    Buttons() (start, end bar.Output)
}

Grouper controls how a group displays the output from it's modules.

type Signaller Uses

type Signaller interface {
    // Signal returns a channel that signals any updates from the grouper.
    // Signals to this channel will cause the group to recalculate output.
    Signal() <-chan struct{}
}

Signaller adds an additional source of updates to the group, based on changes that do not cause any of the modules to refresh.

type UpdateListener Uses

type UpdateListener interface {
    // Updated is called with the index of the module that just updated
    // its output, before the calls to Button(...) or Visble(...)
    Updated(index int)
}

UpdateListener receives an update whenever a module in the group updates its output.

Directories

PathSynopsis
collapsingPackage collapsing provides a group that supports expanding/collapsing, and a controller to allow programmatic expansion/collapse.
cyclingPackage cycling provides a group that continuously cycles between all modules at a fixed interval.
followingPackage following provides a group that always shows the output from the most recently updated module in the set.
modalPackage modal provides a group with various "modes", each mode identified by a string key and containing multiple modules.
switchingPackage switching provides a group that displays modules one at a time, and a controller to switch to the next/previous/specific module.

Package group imports 5 packages (graph) and is imported by 5 packages. Updated 2018-12-22. Refresh now. Tools for package owners.