summaryrefslogtreecommitdiff
path: root/dwmbar-functions/dwm_weather.sh
diff options
context:
space:
mode:
Diffstat (limited to 'dwmbar-functions/dwm_weather.sh')
-rwxr-xr-xdwmbar-functions/dwm_weather.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/dwmbar-functions/dwm_weather.sh b/dwmbar-functions/dwm_weather.sh
new file mode 100755
index 0000000..ac43add
--- /dev/null
+++ b/dwmbar-functions/dwm_weather.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# A dwm_bar function to print the weather from wttr.in
+# Joe Standring <[email protected]>
+# GNU GPLv3
+
+# Dependencies: curl
+
+# Change the value of LOCATION to match your city
+dwm_weather() {
+ LOCATION=city
+
+ printf "%s" "$SEP1"
+ if [ "$IDENTIFIER" = "unicode" ]; then
+ printf "%s" "$(curl -s wttr.in/$LOCATION?format=1)"
+ else
+ printf "WEA %s" "$(curl -s wttr.in/$LOCATION?format=1 | grep -o "[0-9].*")"
+ fi
+ printf "%s\n" "$SEP2"
+}
+
+dwm_weather