barista

package module
v0.0.0-...-290cb81 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 16 Imported by: 33

README

Logo

Barista

Release GoDoc Maintainability Test Coverage

Barista is an i3 status bar written in golang.

This is not an official Google product

Features

  • Based on push rather than fixed interval polling. This allows immediate updates for many modules, like volume, media, shell, etc.

  • Produces a single binary via go build. This makes it easy to set up the bar executable, since no import paths, environment variables, et al. need to be configured.

  • Good click handlers (especially media and volume), since we can wait for a command and update the bar immediately rather than waiting for the next 'tick'.

  • Configuration is code, providing oodles of customization options without needing myriad configuration options in a file somewhere. If/then/else, loops, functions, variables, and even other go packages can all be used seamlessly.

Usage

See samples/sample-bar.go for a sample bar.

To build your own bar, simply create a package main go file, import and configure the modules you wish to use, and call barista.Run().

To show your bar in i3, set the status_command of a bar { ... } section to be the newly built bar binary, e.g.

bar {
  position top
  status_command exec ~/bin/mybar
  font pango:DejaVu Sans Mono 10
}

See the quickstart for more details.

Documentation

Overview

Package barista provides the building blocks for a custom i3 status bar.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(module bar.Module)

Add adds a module to the bar.

func DefaultErrorHandler

func DefaultErrorHandler(e bar.ErrorEvent)

DefaultErrorHandler invokes i3-nagbar to show the full error message.

func Run

func Run(modules ...bar.Module) error

Run sets up all the streams and enters the main loop. If any modules are provided, they are added to the bar now. This allows both styles of bar construction: `bar.Add(a); bar.Add(b); bar.Run()`, and `bar.Run(a, b)`.

func SetErrorHandler

func SetErrorHandler(handler func(bar.ErrorEvent))

SetErrorHandler sets the function to be called when an error segment is right clicked. This replaces the DefaultErrorHandler.

func SuppressSignals

func SuppressSignals(suppressSignals bool)

SuppressSignals instructs the bar to skip the pause/resume signal handling. Must be called before Run.

func TestMode

func TestMode(reader io.Reader, writer io.Writer)

TestMode creates a new instance of the bar for testing purposes, and runs it on the provided streams instead of stdin/stdout.

Types

This section is empty.

Directories

Path Synopsis
Package bar allows a user to create a go binary that follows the i3bar protocol.
Package bar allows a user to create a go binary that follows the i3bar protocol.
base
click
Package click provides methods to compose click handlers.
Package click provides methods to compose click handlers.
notifier
Package notifier provides a channel that can send update notifications.
Package notifier provides a channel that can send update notifications.
value
Package value provides atomic values with update notifications.
Package value provides atomic values with update notifications.
watchers/dbus
Package dbus provides watchers that notify when dbus name owners or object properties change, and infrastructure for testing code that uses them.
Package dbus provides watchers that notify when dbus name owners or object properties change, and infrastructure for testing code that uses them.
watchers/file
Package file uses the fsnotify library to watch for changes to files.
Package file uses the fsnotify library to watch for changes to files.
watchers/localtz
Package localtz watches for changes to the local machine's time zone.
Package localtz watches for changes to the local machine's time zone.
watchers/netlink
Package netlink uses the netlink library to watch for changes in link states.
Package netlink uses the netlink library to watch for changes in link states.
Package colors provides helper functions to manage color and color schemes.
Package colors provides helper functions to manage color and color schemes.
Package core provides some of the basic barista functionality, enabling more complex constructs without duplicating code or logic.
Package core provides some of the basic barista functionality, enabling more complex constructs without duplicating code or logic.
Package format provides utility methods for formatting units.
Package format provides utility methods for formatting units.
Package group provides a module that groups existing modules, and uses a provided Grouper to selectively display output from these modules.
Package group provides a module that groups existing modules, and uses a provided Grouper to selectively display output from these modules.
collapsing
Package collapsing provides a group that supports expanding/collapsing, and a controller to allow programmatic expansion/collapse.
Package collapsing provides a group that supports expanding/collapsing, and a controller to allow programmatic expansion/collapse.
cycling
Package cycling provides a group that continuously cycles between all modules at a fixed interval.
Package cycling provides a group that continuously cycles between all modules at a fixed interval.
following
Package following provides a group that always shows the output from the most recently updated module in the set.
Package following provides a group that always shows the output from the most recently updated module in the set.
modal
Package modal provides a group with various "modes", each mode identified by a string key and containing multiple modules.
Package modal provides a group with various "modes", each mode identified by a string key and containing multiple modules.
switching
Package switching provides a group that displays modules one at a time, and a controller to switch to the next/previous/specific module.
Package switching provides a group that displays modules one at a time, and a controller to switch to the next/previous/specific module.
Package logging provides logging functions for use in the bar and modules.
Package logging provides logging functions for use in the bar and modules.
modules
battery
Package battery provides a battery status i3bar module.
Package battery provides a battery status i3bar module.
bluetooth
Package bluetooth provides modules for watching the status of Bluetooth adapters and devices.
Package bluetooth provides modules for watching the status of Bluetooth adapters and devices.
clock
Package clock displays a clock.
Package clock displays a clock.
counter
Package counter demonstrates an extremely simple i3bar module that shows a counter which can be chnaged by clicking on it.
Package counter demonstrates an extremely simple i3bar module that shows a counter which can be chnaged by clicking on it.
cpuload
Package cpuload implements an i3bar module that shows load averages.
Package cpuload implements an i3bar module that shows load averages.
cputemp
Package cputemp implements an i3bar module that shows the CPU temperature.
Package cputemp implements an i3bar module that shows the CPU temperature.
diskio
Package diskio implements an i3bar module to show disk IO rates.
Package diskio implements an i3bar module to show disk IO rates.
diskspace
Package diskspace provides an i3bar module for disk space usage.
Package diskspace provides an i3bar module for disk space usage.
funcs
Package funcs provides the ability to construct i3bar modules from simple Funcs.
Package funcs provides the ability to construct i3bar modules from simple Funcs.
github
Package github provides a barista module to show github notifications.
Package github provides a barista module to show github notifications.
gsuite/calendar
Package calendar provides a Google Calendar barista module.
Package calendar provides a Google Calendar barista module.
gsuite/gmail
Package gmail provides a gmail barista module.
Package gmail provides a gmail barista module.
hwmon
Package hwmon implements an i3bar module that shows the temperature from /sys/class/hwmon
Package hwmon implements an i3bar module that shows the temperature from /sys/class/hwmon
media
Package media provides an i3bar module for an MPRIS-compatible media player.
Package media provides an i3bar module for an MPRIS-compatible media player.
meminfo
Package meminfo provides an i3bar module that shows memory information.
Package meminfo provides an i3bar module that shows memory information.
meta/multicast
Package multicast provides a method to convert any bar.Module into one that can be added to the bar multiple times.
Package multicast provides a method to convert any bar.Module into one that can be added to the bar multiple times.
meta/reformat
Package reformat provides a module that "wraps" an existing module and transforms it's output.
Package reformat provides a module that "wraps" an existing module and transforms it's output.
meta/slot
Package slot provides multiple slots for a single module, allowing it to be moved between various positions on the bar.
Package slot provides multiple slots for a single module, allowing it to be moved between various positions on the bar.
meta/split
Package split provides a module that splits the output from an existing module and sends it to two new modules.
Package split provides a module that splits the output from an existing module and sends it to two new modules.
netinfo
Package netinfo provides an i3bar module for network information.
Package netinfo provides an i3bar module for network information.
netspeed
Package netspeed provides an i3bar module to display network utilisation.
Package netspeed provides an i3bar module to display network utilisation.
shell
Package shell provides modules to display the output of shell commands.
Package shell provides modules to display the output of shell commands.
static
Package static provides a simple module that shows static content on the bar, with methods to set the content.
Package static provides a simple module that shows static content on the bar, with methods to set the content.
sysinfo
Package sysinfo implements i3bar modules that show system information.
Package sysinfo implements i3bar modules that show system information.
systemd
Package systemd provides modules for watching the status of a systemd unit.
Package systemd provides modules for watching the status of a systemd unit.
volume
Package volume provides an i3bar module that interfaces with alsa or pulse to display and control the system volume.
Package volume provides an i3bar module that interfaces with alsa or pulse to display and control the system volume.
vpn
Package vpn provides an i3bar module for openvpn information.
Package vpn provides an i3bar module for openvpn information.
weather
Package weather provides an i3bar module that displays weather info.
Package weather provides an i3bar module that displays weather info.
weather/metar
Package metar provides weather using the METAR API from the NOAA Aviation Digital Data Service, available at https://www.aviationweather.gov/.
Package metar provides weather using the METAR API from the NOAA Aviation Digital Data Service, available at https://www.aviationweather.gov/.
weather/openweathermap
Package openweathermap provides weather using the OpenWeatherMap API, available at https://openweathermap.org/api.
Package openweathermap provides weather using the OpenWeatherMap API, available at https://openweathermap.org/api.
wlan
Package wlan provides an i3bar module for wireless information.
Package wlan provides an i3bar module for wireless information.
Package oauth provides oauth capabilities to barista and modules.
Package oauth provides oauth capabilities to barista and modules.
Package outputs provides helper functions to construct bar.Outputs.
Package outputs provides helper functions to construct bar.Outputs.
Package pango provides a type-safe way to construct pango markup.
Package pango provides a type-safe way to construct pango markup.
icons
Package icons provides an interface for using icon fonts in a bar.
Package icons provides an interface for using icon fonts in a bar.
icons/fontawesome
Package fontawesome provides support for FontAwesome Icons from https://github.com/FortAwesome/Font-Awesome
Package fontawesome provides support for FontAwesome Icons from https://github.com/FortAwesome/Font-Awesome
icons/material
Package material provides support for Google's Material Design Icons from https://github.com/google/material-design-icons
Package material provides support for Google's Material Design Icons from https://github.com/google/material-design-icons
icons/mdi
Package mdi provides support for "Material Design Icons" from https://materialdesignicons.com/, a fork and extension of Material.
Package mdi provides support for "Material Design Icons" from https://materialdesignicons.com/, a fork and extension of Material.
icons/typicons
Package typicons provides support for Typicons from https://github.com/stephenhutchings/typicons.font
Package typicons provides support for Typicons from https://github.com/stephenhutchings/typicons.font
samples
i3status
i3status is a port of the default i3status configuration to barista.
i3status is a port of the default i3status configuration to barista.
sample-bar
sample-bar demonstrates a sample i3bar built using barista.
sample-bar demonstrates a sample i3bar built using barista.
simple
simple demonstrates a simpler i3bar built using barista.
simple demonstrates a simpler i3bar built using barista.
stable-api
stable-api demonstrates a bar that exercises barista's stable API.
stable-api demonstrates a bar that exercises barista's stable API.
yubikey
Package yubikey provides an indicator for a waiting yubikey.
Package yubikey provides an indicator for a waiting yubikey.
Package sink provides functions to create sinks.
Package sink provides functions to create sinks.
testing
bar
Package bar provides utilities for testing barista modules using a fake bar instance.
Package bar provides utilities for testing barista modules using a fake bar instance.
cron
Package cron provides a function to run a test only in Travis CI cron runs, and retry the test with increasing delays a few times before failing the build.
Package cron provides a function to run a test only in Travis CI cron runs, and retry the test with increasing delays a few times before failing the build.
fail
Package fail provides methods to test and verify failing assertions.
Package fail provides methods to test and verify failing assertions.
githubfs
Package githubfs provides an afero FS that's backed by github.com.
Package githubfs provides an afero FS that's backed by github.com.
httpcache
Package httpcache provides a RoundTripper that stores all responses on disk, and returns cached responses for any requests that have been made before.
Package httpcache provides a RoundTripper that stores all responses on disk, and returns cached responses for any requests that have been made before.
httpclient
Package httpclient provides a testable wrapper around an existing *http.Client.
Package httpclient provides a testable wrapper around an existing *http.Client.
httpserver
Package httpserver provides a test http server that can serve some canned responses, e.g.
Package httpserver provides a test http server that can serve some canned responses, e.g.
mockio
Package mockio provides infinite streams that can be used for testing stdin/stdout.
Package mockio provides infinite streams that can be used for testing stdin/stdout.
module
Package module provides a test module that can be used in tests.
Package module provides a test module that can be used in tests.
notifier
Package notifier provides assertions that notifier channels (<-chan struct{}) received or did not receive a signal.
Package notifier provides assertions that notifier channels (<-chan struct{}) received or did not receive a signal.
output
Package output provides utilities for testing barista outputs and segments.
Package output provides utilities for testing barista outputs and segments.
pango
Package pango provides provides a method to test markup equality.
Package pango provides provides a method to test markup equality.
Package timing provides a testable interface for timing and scheduling.
Package timing provides a testable interface for timing and scheduling.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL