barista-contrib

Community modules and extensions for barista.

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

OpenWeatherMap

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

Convenience extension for the OpenWeatherMap provider of the built-in weather module.

Configuration

Examples

14°C, few clouds

Load openweathermap API key and config from a file and create a new weather module:

configFile := configdir.LocalConfig("i3/barista/openweathermap.json")

owm, err := openweathermap.NewFromConfig(configFile)
if err != nil {
  log.Fatal(err)
}

weather.New(owm).Output(func(info weather.Weather) bar.Output {
  return outputs.Textf("%.0f°C, %s", info.Temperature.Celsius(), info.Description)
})