switching

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: 8 Imported by: 1

Documentation

Overview

Package switching provides a group that displays modules one at a time, and a controller to switch to the next/previous/specific module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultButtons

func DefaultButtons(c Controller) (start, end bar.Output)

DefaultButtons provides the default switching buttons: - '<' at the start, if there are modules before the current one, - '>' at the end, if there are modules after the current one.

Types

type ButtonFunc

type ButtonFunc func(Controller) (start, end bar.Output)

ButtonFunc produces outputs for buttons in a switching group.

type Controller

type Controller interface {
	// Current returns the index of the currently active module.
	Current() int
	// Previous switches to the previous module.
	Previous()
	// Next switches to the next module.
	Next()
	// Show sets the currently active module.
	Show(int)
	// Count returns the number of modules in this group
	Count() int
	// ButtonFunc controls the output for the buttons on either end.
	ButtonFunc(ButtonFunc)
}

Controller provides an interface to control a switching group.

func Group

func Group(m ...bar.Module) (bar.Module, Controller)

Group returns a new switching group, and a linked controller.

Jump to

Keyboard shortcuts

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