barista.run: barista.run/modules/volume Index | Files

package volume

import "barista.run/modules/volume"

Package volume provides an i3bar module that interfaces with alsa or pulse to display and control the system volume.

Index

Package Files

alsa.go alsa_capi.go pulse.go volume.go

type Module Uses

type Module struct {
    // contains filtered or unexported fields
}

Module represents a bar.Module that displays volume information.

func DefaultMixer Uses

func DefaultMixer() *Module

DefaultMixer constructs an instance of the volume module for the default mixer.

func DefaultSink Uses

func DefaultSink() *Module

DefaultSink creates a PulseAudio volume module that follows the default sink.

func Mixer Uses

func Mixer(card, mixer string) *Module

Mixer constructs an instance of the volume module for a specific card and mixer on that card.

func Sink Uses

func Sink(sinkName string) *Module

Sink creates a PulseAudio volume module for a named sink.

func (*Module) Output Uses

func (m *Module) Output(outputFunc func(Volume) bar.Output) *Module

Output configures a module to display the output of a user-defined function.

func (*Module) Stream Uses

func (m *Module) Stream(s bar.Sink)

Stream starts the module.

type Volume Uses

type Volume struct {
    Min, Max, Vol int64
    Mute          bool
    // contains filtered or unexported fields
}

Volume represents the current audio volume and mute state.

func (Volume) Frac Uses

func (v Volume) Frac() float64

Frac returns the current volume as a fraction of the total range.

func (Volume) Pct Uses

func (v Volume) Pct() int

Pct returns the current volume in the range 0-100.

func (Volume) SetMuted Uses

func (v Volume) SetMuted(muted bool)

SetMuted controls whether the system volume is muted.

func (Volume) SetVolume Uses

func (v Volume) SetVolume(volume int64)

SetVolume sets the system volume. It does not change the mute status.

Package volume imports 11 packages (graph) and is imported by 2 packages. Updated 2019-11-19. Refresh now. Tools for package owners.