group

package
v0.0.0-...-c936f35 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 5

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

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

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

func Simple

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.

Types

type Grouper

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

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

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

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

Jump to

Keyboard shortcuts

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