The Barista Logo


An i3status alternative in golang

Download sample-bar Download i3status example View on GitHub


import ""

Create a group that shows one module at a time: grp, ctrl := switching.Group(...).

The returned group is a bar.Module and can be added to the bar directly. The second return value is a Controller that provides methods to control the group programatically. If you only use the built-in buttons to control the group, it can be safely ignored: grp, _ := switching.Group(...).



A simple example of a collapsing group, with custom buttons.

// For simplicity, assuming a, b, c are simple text modules that show 'a', 'b', and 'c'.
grp, ctrl := switching.Group(a, b, c)
// The button function receives the current index and the count.
ctrl.ButtonFunc(func(index, count int) (start, end bar.Output) {
	if index + 1 < count {
		end = outputs.Text("+")
	if index > 0 {
		start = outputs.Text("-")
	return // start, end