Split
godocimport "barista.run/modules/meta/split"
Split splits the output from an existing module into two distinct modules, making it easy to show part of the modules output in a different location or on-demand instead of always.
Splitting a module output: first2, remaining := split.New(existingModule, 2)
.
Example
Mail:5+
Mail:5>ToDo:2Important:1Bugs:2<
Splitting up unread message counts to show inbox in the main bar, and all others in a group:
labels := []string{"INBOX", "ToDo", "Important", "Bugs"}
mail := mailProvider.New(labels...).
Output(func(m mailProvider.Info) bar.Output {
o := outputs.Group()
for _, lbl := range labels {
o.Append(outputs.Textf("%s:%d", lbl, m[lbl]))
}
return o
})
inbox, others := split.New(mail, 1)
// Add inbox, and hide others behind a collapsible group.
grp, _ := collapsing.Group(others)
barista.Run(inbox, grp)