new weather script alltogether

This commit is contained in:
Maximilian Wagner 2024-06-25 21:16:36 +02:00
parent 8fad648a6e
commit da5ddaa09d
3 changed files with 11 additions and 1 deletions

View File

@ -159,7 +159,7 @@
// to use the weather module replace <your_location> 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,
},

9
scripts/weather.py Executable file
View File

@ -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]}"' + '}')

1
scripts/weather_new.sh Normal file
View File

@ -0,0 +1 @@
#!/bin/bash