mirror of
https://github.com/nmasur/dotfiles
synced 2025-07-05 20:50:15 +00:00
basic rofi and more macos cleanup
This commit is contained in:
16
macos/bin/weather_cached
Executable file
16
macos/bin/weather_cached
Executable 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"
|
Reference in New Issue
Block a user