Add .config/waybar/config
Add .config/waybar/scripts/PBPbattery.sh Add .config/waybar/scripts/keyhint.sh Add .config/waybar/scripts/power-menu.sh Add .config/waybar/scripts/weather.sh Add .config/waybar/style.css
This commit is contained in:
13
dot_config/waybar/scripts/executable_weather.sh
Normal file
13
dot_config/waybar/scripts/executable_weather.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
LOC="$1"
|
||||
# HTML encode string as %20
|
||||
LOCATION=$(sed -e "s/ /%20/g" <<<"$LOC")
|
||||
content=$(curl -sS "https://thisdavej.azurewebsites.net/api/weather/current?loc=$LOCATION°=C")
|
||||
ICON=$(curl -s 'https://wttr.in/?format=1' | sed 's/[+0-9a-cA-Z°-]//g' )
|
||||
# echo $ICON
|
||||
TEMP=$(echo $content | jq -r '. | "\(.temperature)°\(.degType)"' | sed 's/"//g')
|
||||
TOOLTIP=$(echo $content | jq -r '. | "\(.temperature)°\(.degType)\n\(.skytext)"' | sed 's/"//g')
|
||||
CLASS=$(echo $content | jq .skytext)
|
||||
echo '{"text": "'$TEMP'", "tooltip": "'$ICON $TOOLTIP $LOC'", "class": '$CLASS' }'
|
||||
|
Reference in New Issue
Block a user