The Barista Logo


An i3status alternative in golang

Download sample-bar Download i3status example View on GitHub


import ""

Value and ErrorValue provide atomic value storage with update notifications. Mostly used in modules to store configuration and select {} changes to the configuration. For example, most modules will update the output when either the interval elapses, or the output function is changed, so a common pattern is:

type Module struct {
	outputFormat value.Value
	// ...

// ...

func (m *Module) Stream(sink bar.Sink) {
	// ...
	for {
		select {
			case <-m.outputFormat.Next():
				format = m.outputFormat.Get().(/* output format type */)
			case <-scheduler.Tick():
				data = /* read new data */
		// output with format, data


Value provides simple atomic storage and update notifications:


ErrorValue extends Value with support for storing errors.