From da5ddaa09d35e5f2e05cacb17837c8735c426d94 Mon Sep 17 00:00:00 2001 From: Maximilian Wagner Date: Tue, 25 Jun 2024 21:16:36 +0200 Subject: [PATCH] new weather script alltogether --- hypr-config | 2 +- scripts/weather.py | 9 +++++++++ scripts/weather_new.sh | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100755 scripts/weather.py create mode 100644 scripts/weather_new.sh diff --git a/hypr-config b/hypr-config index d1da147..85b9d4a 100644 --- a/hypr-config +++ b/hypr-config @@ -159,7 +159,7 @@ // to use the weather module replace with your city or town // note: do not use spaces: new york would be newyork "custom/weather": { - "exec": "~/.config/waybar/scripts/weather.sh Euskirchen", + "exec": "~/.config/waybar/scripts/weather.py Euskirchen", "return-type": "json", "interval": 600, }, diff --git a/scripts/weather.py b/scripts/weather.py new file mode 100755 index 0000000..0c5e9ad --- /dev/null +++ b/scripts/weather.py @@ -0,0 +1,9 @@ +#!/bin/python3 + +import requests +import sys + +req = requests.get(f'https://wttr.in/{sys.argv[1]}?format="%t:%c:%C"').text[1:-1].split(':') + +print('{' + f'"text": "{req[0]} {req[1]}", "tooltip": "", "class": "{req[2]}"' + '}') + diff --git a/scripts/weather_new.sh b/scripts/weather_new.sh new file mode 100644 index 0000000..f4b0ccf --- /dev/null +++ b/scripts/weather_new.sh @@ -0,0 +1 @@ +#!/bin/bash