From 763ca33ca082346ab8ef558efe0439304f8ef63c Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Tue, 21 Jul 2020 13:13:12 +0200 Subject: waybar: Add weather module --- .config/waybar/modules/weather.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 .config/waybar/modules/weather.sh (limited to '.config/waybar/modules') diff --git a/.config/waybar/modules/weather.sh b/.config/waybar/modules/weather.sh new file mode 100755 index 0000000..9f7780d --- /dev/null +++ b/.config/waybar/modules/weather.sh @@ -0,0 +1,19 @@ +#!/bin/sh +set -e +[ -n "$DEBUG" ] && set -x + +loc=$1 + +if [ -n "$REPORT" ]; then + curl -s v2.wttr.in/"${loc}"?F | less + exit 0 +fi + +curl -s wttr.in/"${loc}"?format=j1 \ + | jq \ + --raw-output \ + --unbuffered \ + --compact-output \ + --arg tooltip "$(curl -s v2.wttr.in/"${loc}"?ATFQ | tail -n5)" \ + '.current_condition[] | { text: .weatherDesc[0].value, percentage: (.temp_C | tonumber), class: .weatherCode, alt: .weatherCode, tooltip: ($tooltip) }' + -- cgit 1.4.1