Files
dotfiles/waybar/scripts/weather.sh
2024-06-08 16:50:33 +02:00

10 lines
268 B
Bash
Executable File

#!/bin/bash
LOC="$1"
# HTML encode string as %20
TEMP=$(curl -s 'https://wttr.in/'${LOC}'?format=%t\n&m')
ICON=$(curl -s 'https://wttr.in/'${LOC}'?format=1' | grep -o '^\S*' )
# echo $ICON
echo '{"text": "'$TEMP'", "tooltip": "'$ICON' '$LOC'", "class": "weather" }'