chrissnell / weather-bar

Pull weather reports from NOAA and Weather Underground and display them in a desktop bar like polybar or lemonbar
BSD 2-Clause "Simplified" License
20 stars 2 forks source link

weather-bar

weather-bar pulls weather reports from NOAA or Weather Underground and displays them in a desktop bar, like polybar or lemonbar. weather-bar can use geolocation to find the nearest NOAA weather station and will automatically update your location if you put your laptop to sleep and wake it up in a new location. Much like polybar and lemonbar, weather-bar is customizable. Using tokens in the config file, you can tweak the display to your liking.

How to use

  1. Download a binary release, install the AUR package, or compile your own binary and put the binary in your $PATH (e.g. /usr/local/bin/weather-bar)
  2. Using the example config file found here, create a config file in your $XDG_CONFIG_HOME directory (default config file is ${HOME}/.config/weather-bar/config) and edit if you desire. Install the Nerd Fonts if you want the icons in the example config to render correctly.
  3. Edit your bar config, as described below.

Polybar

Add a new module to your Polybar config that uses Polybar's script module to run weather-bar in tail fashion. See the config snippet in this repo for an example.

Lemonbar

Simply pipe the output of weather-bar to lemonbar: weather-bar | lemonbar. I recommend the patched version that supports Xft fonts so that you can have some sweet icons.

Weather Underground support

Unfortunately, Weather Underground no longer provides free keys, so you'll need one of their paid accounts to use this feature. Jerks. By default, weather-bar fetches weather conditions from NOAA but if you sign up for a free API key, weather-bar can fetch metrics from the Weather Underground, which gives you much more frequent weather updates (5 minutes vs. 1 hour for NOAA) and the option to pull weather from the large network of personal weather stations (PWS) that send data to WU.

Geolocation

By default, weather-bar uses freegeoip.net to geolocate your computer and computes the Haversine distance to nearby NOAA weather stations to determine the closest one. If the geolocation is inaccurate or if you don't wish to geolocate, you can specify a specific NOAA station by its ICAO code or a Weather Underground Personal Weather Station (PWS) by its ID. You can also specify a particular latitude and longitude and weather-bar will find the nearest NOAA station automatically.

Fonts

weather-bar looks best with the Font Awesome icons from Nerd Fonts. I used the "Sauce Code Pro" for the screenshot above.

License

See LICENSE