From b5da5b662ac4516a762d086d03af90f71665f71d Mon Sep 17 00:00:00 2001 From: MineralwaterXu Date: Tue, 1 Dec 2020 22:24:45 +0800 Subject: autostart and dwmstatus --- dwmbar-functions/dwm_weather.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 dwmbar-functions/dwm_weather.sh (limited to 'dwmbar-functions/dwm_weather.sh') 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 +# 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 -- cgit v1.2.1