From 4d1bfe67ab1e72e9dd2d700faf4b396746ddae9a Mon Sep 17 00:00:00 2001 From: filip <“filip.rabiega@gmail.com”> Date: Wed, 21 Jan 2026 13:10:55 +0100 Subject: wrocwttr rewrite --- wrocwttr | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'wrocwttr') diff --git a/wrocwttr b/wrocwttr index 4aa5b3a..dccb1cc 100755 --- a/wrocwttr +++ b/wrocwttr @@ -1,12 +1,14 @@ #!/bin/sh +# Check the temperature in Wrocław, Poland -# export DISPLAY=:0.0 -# export HOME=/home/filipek +CITY="Wroc%C5%82aw" +CACHE_DIR="$HOME/.cache/weather" +FILE="$CACHE_DIR/wroc.txt" -# ł is URL-encoded -temp=$(curl "wttr.in/Wroc%C5%82aw?format=1" | awk '{print $2}') -file="$HOME/.cache/weather/wroc.txt" +mkdir -p "$CACHE_DIR" + +temp="$(curl -fsS --max-time 5 -A "wrocwttr/1.0" \ + "https://wttr.in/$CITY?format=%t")" || exit 1 [ -z "$temp" ] && exit 1 -echo "$temp" > "$file" -# notify-send "Temperature updated." +echo "$temp" > "$FILE" -- cgit v1.2.3