basic rofi and more macos cleanup

This commit is contained in:
Noah Masur
2022-05-07 09:24:17 -04:00
parent 43571c66dd
commit 4540327cb8
27 changed files with 155 additions and 23 deletions

16
macos/bin/weather_cached Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
CACHE_FILE="$HOME/.cache/weather_cache"
if [ "$1" = "clear" ]; then
rm -f "$CACHE_FILE"
fi
CACHE_TIME="$(stat -f %m "$CACHE_FILE" 2>/dev/null)"
NOW_TIME=$(date +%s)
TIME_PASSED=$((NOW_TIME-CACHE_TIME))
if [ "$TIME_PASSED" -gt "1200" ]
then
curl -m 2 -s "wttr.in/$WEATHER_CITY?format=%c%t" > "$CACHE_FILE"
fi
cat "$CACHE_FILE"