added weather script

This commit is contained in:
Solomon Laing 2022-03-11 23:19:34 +10:30
parent dbcd59ed66
commit ff318eb66f

19
scripts/xmobar-status-weather Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
# simple script to read weather from airport code and return it for display in xmobar
weather=$(weather-report $1 -m --no-cache -n | \
grep -e '\[' \
-e 'Temp' | \
sed -e 's/\[using result //' \
-e 's/,.*\]//' \
-e 's/Temp.*: //' \
-e 's/ C//' \
-e 's/ //')
readarray -t y <<< "$weather"
loc=${y[0]}
temp=${y[1]}
echo -e "<fc=#ff79c6>$loc <fc=#FFFFFF>$temp</fc><fn=1>\u00b0</fn>C</fc>"