blob: 6bd079161bda9103a9c4e1f78c5a57e6f9065b72 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#!/bin/sh
[ "$BLOCK_BUTTON" = 3 ] && $BROWSER 'https://www.windy.com/36.865/-76.468?36.362,-76.468,8'
API_KEY="$(cat ~/.config/openweathermap)"
ZIP_CODE=23435
while read line
do
case $line in
icon*)
case "${line#icon }" in
01d)
ICON=
;;
01n)
ICON=
;;
02d)
ICON=
;;
02n)
ICON=
;;
03*|04*)
ICON=
;;
09*|10*)
ICON=
;;
11*)
ICON=
;;
13*)
ICON=
;;
50*)
ICON=
;;
esac
;;
description*)
DESCRIPTION="${line#description }"
;;
humidity*)
HUMIDITY="${line#humidity }"
;;
feels_like*)
FEELS_LIKE="${line#feels_like }"
;;
esac
done << EOF
$(fetch -qo - "https://api.openweathermap.org/data/2.5/weather?zip=$ZIP_CODE&units=imperial&appid=$API_KEY" \
| tr -d '"{}[]' \
| tr ',' '\n' \
| tr ':' ' ')
EOF
printf "%s %s %2.1f℉ %.2d%%\n" "$ICON" "$DESCRIPTION" "$FEELS_LIKE" "$HUMIDITY"
|