From bd64a45601262ef3f8da9d56e5c70c273a013a9c Mon Sep 17 00:00:00 2001 From: Dane Williams Date: Sat, 14 Mar 2020 21:13:46 -0700 Subject: [PATCH] hopefully fixed weather to now run every 10 minutes --- dracula.tmux | 5 ++++- sleep_weather.sh | 15 +++++++++++++++ weather.sh | 2 +- weather.txt | 6 ++++++ 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100755 sleep_weather.sh create mode 100644 weather.txt diff --git a/dracula.tmux b/dracula.tmux index f3cc43c..1c89774 100755 --- a/dracula.tmux +++ b/dracula.tmux @@ -37,6 +37,9 @@ main() # message styling tmux set-option -g message-style "bg=${gray},fg=${white}" + # run weather script in background + ./sleep_weather.sh & + # status bar tmux set-option -g status-style "bg=${gray},fg=${white}" @@ -44,7 +47,7 @@ main() tmux set-option -g status-right "#[fg=${dark_gray},bg=${pink}] #(~/.tmux/plugins/tmux-dracula/battery.sh) " tmux set-option -ga status-right "#[fg=${dark_gray},bg=${cyan}] tructus " - tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] #() " + tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] #(cat weather.txt) " tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %m/%d %I:%M %p #(date +%Z) " # window tabs diff --git a/sleep_weather.sh b/sleep_weather.sh new file mode 100755 index 0000000..195cdf0 --- /dev/null +++ b/sleep_weather.sh @@ -0,0 +1,15 @@ +#/usr/bin/env bash + +#wrapper script for running weather on interval + +main() +{ + while true + do + ./weather.sh + sleep 600 + done +} + +#run main driver function +main diff --git a/weather.sh b/weather.sh index 4ab4867..626bdd0 100755 --- a/weather.sh +++ b/weather.sh @@ -57,8 +57,8 @@ display_weather() main() { + # process should be cancelled when session is killed if ping -q -c 1 -W 1 ipinfo.io &>/dev/null; then - echo "$(display_weather) $city, $(get_region_code)" else echo "Location Unavailable" diff --git a/weather.txt b/weather.txt new file mode 100644 index 0000000..87fcd32 --- /dev/null +++ b/weather.txt @@ -0,0 +1,6 @@ + { + "error": { + "title": "Rate limit exceeded", + "message": "You've hit the daily limit for the unauthenticated API. Create an API access token by signing up to get 50k req/month." + } +}, { "error": { "title": "Rate limit exceeded", "message": "You've hit the daily limit for the unauthenticated API. Create an API access token by signing up to get 50k req/month." } }