From d9cc97a1d99f8d22235584579dcbb9fc9b482565 Mon Sep 17 00:00:00 2001 From: Ben Aaron Goldberg Date: Sat, 12 Sep 2020 19:04:22 -0400 Subject: [PATCH] Change weather_sleep to avoid writing to tracked files Changed weather_sleep.sh and dracula.sh so that they do not assume that weather.txt exist. As a result I was able to remove weather.txt as a tracked file. --- .gitignore | 1 + data/.gitkeep | 0 data/weather.txt | 1 - scripts/dracula.sh | 5 +++++ scripts/sleep_weather.sh | 4 ++++ 5 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 data/.gitkeep delete mode 100644 data/weather.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..36570c9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +data/weather.txt diff --git a/data/.gitkeep b/data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/data/weather.txt b/data/weather.txt deleted file mode 100644 index da28569..0000000 --- a/data/weather.txt +++ /dev/null @@ -1 +0,0 @@ -Loading... diff --git a/scripts/dracula.sh b/scripts/dracula.sh index bf9c146..f3adc12 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -104,6 +104,11 @@ main() # status bar tmux set-option -g status-style "bg=${gray},fg=${white}" + # wait unit data/weather.txt exists just to avoid errors + # this should almost never need to wait unless something unexpected occurs + while [ ! -f $current_dir/../data/weather.txt ]; do + sleep 0.01 + done # Powerline Configuration if $show_powerline; then diff --git a/scripts/sleep_weather.sh b/scripts/sleep_weather.sh index c3de174..d42adb0 100755 --- a/scripts/sleep_weather.sh +++ b/scripts/sleep_weather.sh @@ -19,6 +19,10 @@ main() current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + if [ ! -f $current_dir/../data/weather.txt ]; then + printf "Loading..." > $current_dir/../data/weather.txt + fi + $current_dir/weather.sh > $current_dir/../data/weather.txt while tmux has-session &> /dev/null