wbar
: simple go utility for fetching and formatting weather information.
Built for a status bar, and it fetches its data from
weather.gov.
Clone the repository and run
go install .
inside of it, or install directly (ensure your $PATH
is set):
go install github.com/ealvar3z/wbar@latest
The intended usage is inside of i3status
, i3blocks
, or
dwmblocks
to put weather in your status bar.
-
dwm:
Below is a minimalblocks.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[] = { {"", "wbar -f DMX -x 133 -y 37", 600, 12}, }; static char delim = '|';
-
i3status:
bar { status_command i3status | /path/to/w3bar }
-
i3blocks:
[weather] command=/path/to/w3bar interval=600
First, find the latitude and longitude for your location. Use these with the following command to get your grid x and y coordinates.
curl ipinfo.io | grep 'loc'
# -> "loc": "133.37, 37.133",
curl -sX GET "https://api.weather.gov/points/133.37,37.133" |\
grep -iE '(gridid|grid[xy])'
# -> "gridId": "DMX",
# "gridX": 42,
# "gridY": 69,
Then you can set these in your program invocation using the office
,
-x
, and -y
flags:
wbar -office DMX -x 42 -y 69