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

package funcs

import "barista.run/modules/funcs"

Package funcs provides the ability to construct i3bar modules from simple Funcs.

Index

Package Files

funcs.go

type Func Uses

type Func func(bar.Sink)

Func receives a bar.Sink and uses it for output.

type OnceModule Uses

type OnceModule struct {
    Func
}

OnceModule represents a bar.Module that runs a function once. If the function sets an error output, it will be restarted on the next click.

func Once Uses

func Once(f Func) *OnceModule

Once constructs a bar module that runs the given function once. Useful if the function loops internally.

func (*OnceModule) Stream Uses

func (o *OnceModule) Stream(s bar.Sink)

Stream starts the module.

type OnclickModule Uses

type OnclickModule struct {
    Func
}

OnclickModule represents a bar.Module that runs a function and marks the module as finished, causing the next click to start the module again.

func OnClick Uses

func OnClick(f Func) *OnclickModule

OnClick constructs a bar module that runs the given function when clicked. The function is given a Channel to allow multiple outputs (e.g. Loading... Done), and when the function returns, the next click will call it again.

func (OnclickModule) Stream Uses

func (o OnclickModule) Stream(s bar.Sink)

Stream starts the module.

type RepeatingModule Uses

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

RepeatingModule represents a bar.Module that runs a function at a fixed interval (while accounting for bar paused/resumed state).

func Every Uses

func Every(d time.Duration, f Func) *RepeatingModule

Every constructs a bar module that repeatedly runs the given function. Useful if the function needs to poll a resource for output.

func (*RepeatingModule) Stream Uses

func (r *RepeatingModule) Stream(s bar.Sink)

Stream starts the module.

Package funcs imports 3 packages (graph). Updated 2018-11-08. Refresh now. Tools for package owners.