barista-contrib

Community modules and extensions for barista.

View barista-contrib on GitHub View barista on GitHub View official barista docs

DPMS

godoc
import "github.com/martinohmann/barista-contrib/modules/dpms"

Show the Display Power Management Signaling (DPMS) state: ip.New(someProvider).

DPMS supports displaying the DPMS using pluggable providers, with the ability to add custom providers fairly easily. Provider is just

type Provider interface {
	// Get retrieves the current DPMS status, returning true if it is enabled.
	Get() (bool, error)

	// Set enables or disables DPMS.
	Set(enabled bool) error
}

The following DPMS providers are available in barista-contrib:

Configuration

Examples

dpms: on

Show DPMS state an react on click events:

xset.New().Output(func(info dpms.Info) bar.Output {
    if info.Enabled {
        return outputs.Text("dpms: on").OnClick(click.Left(info.Disable))
    }

    return outputs.Text("dpms: off").OnClick(click.Left(info.Enable))
})

Using .OnClick(nil) prevents the default click handler of the dpms module from being added to part of the output.

Data: type Info struct

Fields

Methods

Controller Methods

In addition to the data methods listed above, dpms’ Info type also provides controller methods to interact with the DPMS state: