/weatherbar

Fetch a weather forecast from weather.gov

Primary LanguageGo

weatherbar

Description

weatherbar is a simple program for fetching and formatting weather information suited for a status bar from weather.gov.

Installation

Either clone the repository and run

go install .

inside of it, or run this directly:

go install github.com/ntBre/weatherbar@latest

Usage

The intended usage is inside of dwmblocks to put weather in your status bar. Below is a minimal blocks.h that only has this block in it with an interval of 600 seconds and a signal of RTMIN+12 associated with it.

static const Block blocks[] = {
  {"", "weatherbar -f LBF -x 133 -y 37", 600, 12},
};

static char delim = '|';

Getting Weather

First, find the latitude and longitude for your location. Use these with the following command to get your grid x and y coordinates.

curl -X GET "https://api.weather.gov/points/41.64,-91.54" | grep 'grid[XY]'
# -> "gridX": 33,
#    "gridY": 70,

Then you can set these in your program invocation using the -f, -x, and -y flags:

weatherbar -f LBF -x 33 -y 70