mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
use permanent location for weather report
this allows the weather to be cached and survive reboot(in case no internet is available after reboot)
This commit is contained in:
parent
d2808d1c5a
commit
a251c9a080
@ -2,5 +2,5 @@
|
|||||||
# Updates weather forecast
|
# Updates weather forecast
|
||||||
ping -q -w 1 -c 1 "$(ip r | grep default | tail -1 | cut -d ' ' -f 3)" >/dev/null || exit
|
ping -q -w 1 -c 1 "$(ip r | grep default | tail -1 | cut -d ' ' -f 3)" >/dev/null || exit
|
||||||
location="$1"; [ -z "$location" ] || location="$location+"
|
location="$1"; [ -z "$location" ] || location="$location+"
|
||||||
curl -s "wttr.in/$location" > /tmp/weatherreport
|
curl -s "wttr.in/$location" > $HOME/.cache/larbs/weatherreport
|
||||||
pkill -RTMIN+5 i3blocks && notify-send "🌞 Weather forecast updated."
|
pkill -RTMIN+5 i3blocks && notify-send "🌞 Weather forecast updated."
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
[ "$(stat -c %y /tmp/weatherreport | awk '{print $1}')" != "$(date '+%Y-%m-%d')" ] && getforecast
|
[ "$(stat -c %y $HOME/.cache/larbs/weatherreport | awk '{print $1}')" != "$(date '+%Y-%m-%d')" ] && getforecast
|
||||||
|
|
||||||
case $BLOCK_BUTTON in
|
case $BLOCK_BUTTON in
|
||||||
1) $TERMINAL -e less -S /tmp/weatherreport ;;
|
1) $TERMINAL -e less -S $HOME/.cache/larbs/weatherreport ;;
|
||||||
3) pgrep -x dunst >/dev/null && notify-send "<b>🌈 Weather module:</b>
|
3) pgrep -x dunst >/dev/null && notify-send "<b>🌈 Weather module:</b>
|
||||||
- Click for wttr.in forecast.
|
- Click for wttr.in forecast.
|
||||||
☔: Chance of rain/snow
|
☔: Chance of rain/snow
|
||||||
@ -10,6 +10,6 @@ case $BLOCK_BUTTON in
|
|||||||
🌞: Daily high" ;;
|
🌞: Daily high" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
printf "%s" "$(sed '16q;d' /tmp/weatherreport | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')"
|
printf "%s" "$(sed '16q;d' $HOME/.cache/larbs/weatherreport | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')"
|
||||||
|
|
||||||
sed '13q;d' /tmp/weatherreport | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄️",$1 "°","🌞",$2 "°"}'
|
sed '13q;d' $HOME/.cache/larbs/weatherreport | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄️",$1 "°","🌞",$2 "°"}'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user