From 8c4f40bdec79e55ff454eb43a2533a9da6717ab0 Mon Sep 17 00:00:00 2001 From: jeffser Date: Sun, 19 Nov 2023 01:03:14 -0600 Subject: [PATCH] Fixed everything --- .config/waybar/config.jsonc | 6 ++ .config/waybar/default-modules.jsonc | 13 +++- .config/waybar/scripts/waybar-wttr.py | 101 +++++++++++++------------- 3 files changed, 67 insertions(+), 53 deletions(-) diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc index dee9bc9..fa10437 100644 --- a/.config/waybar/config.jsonc +++ b/.config/waybar/config.jsonc @@ -21,6 +21,9 @@ "temperature", "network", "bluetooth" + ], + "include": [ + "~/.config/waybar/default-modules.jsonc" ] }, { @@ -44,6 +47,9 @@ "battery", "network", "bluetooth" + ], + "include": [ + "~/.config/waybar/default-modules.jsonc" ] } ] \ No newline at end of file diff --git a/.config/waybar/default-modules.jsonc b/.config/waybar/default-modules.jsonc index bf8054b..3fc119d 100644 --- a/.config/waybar/default-modules.jsonc +++ b/.config/waybar/default-modules.jsonc @@ -44,10 +44,19 @@ }, "custom/weather": { "tooltip": true, - "format": "{}", + "format": "{icon} {}", "interval": 30, "exec": "~/.config/waybar/scripts/waybar-wttr.py", - "return-type": "json" + "return-type": "json", + "format-icons": { + "sunny" : "󰖙", + "partly_cloudy" : "󰖕", + "cloudy" : "󰖐", + "rainy" : "󰖗", + "thundershower" : "󰖓", + "snowy" : "󰖘", + "snowstorm" : "󰼶" + } }, "tray": { "icon-size": 18, diff --git a/.config/waybar/scripts/waybar-wttr.py b/.config/waybar/scripts/waybar-wttr.py index 87918a7..a69de9b 100755 --- a/.config/waybar/scripts/waybar-wttr.py +++ b/.config/waybar/scripts/waybar-wttr.py @@ -5,54 +5,54 @@ from datetime import datetime WEATHER_CODES = { - '113': '☀️ ', - '116': '⛅ ', - '119': '☁️ ', - '122': '☁️ ', - '143': '☁️ ', - '176': '🌧️', - '179': '🌧️', - '182': '🌧️', - '185': '🌧️', - '200': '⛈️ ', - '227': '🌨️', - '230': '🌨️', - '248': '☁️ ', - '260': '☁️ ', - '263': '🌧️', - '266': '🌧️', - '281': '🌧️', - '284': '🌧️', - '293': '🌧️', - '296': '🌧️', - '299': '🌧️', - '302': '🌧️', - '305': '🌧️', - '308': '🌧️', - '311': '🌧️', - '314': '🌧️', - '317': '🌧️', - '320': '🌨️', - '323': '🌨️', - '326': '🌨️', - '329': '❄️ ', - '332': '❄️ ', - '335': '❄️ ', - '338': '❄️ ', - '350': '🌧️', - '353': '🌧️', - '356': '🌧️', - '359': '🌧️', - '362': '🌧️', - '365': '🌧️', - '368': '🌧️', - '371': '❄️', - '374': '🌨️', - '377': '🌨️', - '386': '🌨️', - '389': '🌨️', - '392': '🌧️', - '395': '❄️ ' + '113': 'sunny', + '116': 'partly_cloudy', + '119': 'cloudy', + '122': 'cloudy', + '143': 'cloudy', + '176': 'rainy', + '179': 'rainy', + '182': 'rainy', + '185': 'rainy', + '200': 'thundershower', + '227': 'snowy', + '230': 'snowy', + '248': 'cloudy', + '260': 'cloudy', + '263': 'rainy', + '266': 'rainy', + '281': 'rainy', + '284': 'rainy', + '293': 'rainy', + '296': 'rainy', + '299': 'rainy', + '302': 'rainy', + '305': 'rainy', + '308': 'rainy', + '311': 'rainy', + '314': 'rainy', + '317': 'rainy', + '320': 'snowy', + '323': 'snowy', + '326': 'snowy', + '329': 'snowstorm', + '332': 'snowstorm', + '335': 'snowstorm', + '338': 'snowstorm', + '350': 'rainy', + '353': 'rainy', + '356': 'rainy', + '359': 'rainy', + '362': 'rainy', + '365': 'rainy', + '368': 'rainy', + '371': 'snowstorm', + '374': 'snowy', + '377': 'snowy', + '386': 'snowy', + '389': 'snowy', + '392': 'rainy', + '395': 'snowstorm ' } data = {} @@ -92,9 +92,8 @@ def format_chances(hour): if tempint > 0 and tempint < 10: extrachar = '+' - -data['text'] = ' '+WEATHER_CODES[weather['current_condition'][0]['weatherCode']] + \ - " "+extrachar+weather['current_condition'][0]['FeelsLikeC']+"°" +data['alt'] = WEATHER_CODES[weather['current_condition'][0]['weatherCode']] +data['text'] = extrachar+weather['current_condition'][0]['FeelsLikeC']+"°" data['tooltip'] = f"{weather['current_condition'][0]['weatherDesc'][0]['value']} {weather['current_condition'][0]['temp_C']}°\n" data['tooltip'] += f"Feels like: {weather['current_condition'][0]['FeelsLikeC']}°\n"