The Barista Logo

barista

An i3status alternative in golang

Download sample-bar Download i3status example View on GitHub

Volume

godoc
import "barista.run/modules/volume"

Show volume for a device: volume.New(someProvider).

Volume supports displaying the current audio volume settings using a variety of pluggable providers, with the ability to add custom providers fairly easily. Provider is just

type Provider interface {
	Worker(s *value.ErrorValue)
}

where Worker is a long-running function that pushes new Volume values when changes occur. The MakeVolume function can be used to construct Volume values and provide a controller for changing the volume state.

A few providers are included out of the box:

Configuration

Example

V:065
V:MUT

Show the volume percentage (or “MUT”):

volume.DefaultMixer().Output(func(v volume.Volume) bar.Output {
	if v.Mute {
		return outputs.Text("V:MUT")
	}
	return outputs.Textf("V:%03d", v.Pct())
})

Data: type Volume struct

Fields

Methods

Controller Methods

In addition to the data methods listed above, volume also provides controller methods to set the volume state: