From ae8039dba00feeff0dfaee3157485d488a5a3a74 Mon Sep 17 00:00:00 2001 From: mjallen18 Date: Thu, 7 Aug 2025 22:30:18 -0500 Subject: [PATCH] weather --- modules/home/programs/waybar/default.nix | 13 +++++---- .../home/programs/waybar/scripts/weather.nix | 27 ++++++++++++------- .../specialisations/hyprland/home/default.nix | 2 ++ 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/modules/home/programs/waybar/default.nix b/modules/home/programs/waybar/default.nix index 7a35241..b5e6f26 100755 --- a/modules/home/programs/waybar/default.nix +++ b/modules/home/programs/waybar/default.nix @@ -315,12 +315,12 @@ in }; "custom/left-end" = { - format = " "; + format = " "; tooltip = false; }; "custom/right-end" = { - format = " "; + format = " "; tooltip = false; }; } // cfg.extraModules; @@ -418,7 +418,8 @@ in color: ${nord.frost.nord10}; background-color: ${nord.polarNight.nord0}; ${defaultOpacity} - ${borderRight} + ${defaultCenterOptions} + border-radius: 0; } #battery { @@ -434,7 +435,8 @@ in color: ${nord.frost.nord9}; background-color: ${nord.polarNight.nord0}; ${defaultOpacity} - ${borderLeft} + ${defaultCenterOptions} + border-radius: 0; } /* ------------- */ @@ -443,7 +445,8 @@ in color: ${nord.frost.nord10}; background-color: ${nord.polarNight.nord0}; ${defaultOpacity} - ${borderRight} + ${defaultCenterOptions} + border-radius: 0; padding-right: 1rem; } diff --git a/modules/home/programs/waybar/scripts/weather.nix b/modules/home/programs/waybar/scripts/weather.nix index 10ee8bb..cb8390d 100644 --- a/modules/home/programs/waybar/scripts/weather.nix +++ b/modules/home/programs/waybar/scripts/weather.nix @@ -12,7 +12,6 @@ let #! nix-shell -i python3 --pure #! nix-shell -p python3 python3Packages.requests - """get waybar weather""" import os import json import shutil @@ -98,12 +97,16 @@ let WIND_DIRECTION = { "S": "↓", "SW": "↙", + "SSW": "↙", "W": "←", "NW": "↖", + "NNW": "↖", "N": "↑", "NE": "↗", + "NNE": "↗", "E": "→", "SE": "↘", + "SSE": "↘", } MOON_PHASES = ( @@ -339,11 +342,13 @@ let moon_phase = astronomy['moon_phase'] wego = WEATHER_CODES_WEGO[current_condition['weatherCode']] - tooltip = f"{wego[0]}{weather_description} {temp_f}°\n" - tooltip += f"{wego[1]}Feels like: {feels_like_f}°\n" - tooltip += f"{wego[2]}Wind: {wind_speed}mph {WIND_DIRECTION[wind_dir]}\n" - tooltip += f"{wego[3]}Humidity: {humidity}%\n" - tooltip += f"{wego[4]}Moon phase: {moon_phase} " + moon_icon + "\n" + current = f"{wego[0]}{weather_description} {temp_f}°\n" + feels = f"{wego[1]}Feels like: {feels_like_f}°\n" + wind = f"{wego[2]}Wind: {wind_speed}mph {WIND_DIRECTION[wind_dir]}\n" + humidityl = f"{wego[3]}Humidity: {humidity}%\n" + moon = f"{wego[4]}Moon phase: {moon_phase} " + moon_icon + "\n" + + tooltip = current + feels + wind + humidityl + moon return tooltip @@ -419,9 +424,12 @@ let current_condition = weather["current_condition"][0] astronomy = weather["weather"][0]['astronomy'][0] - data["text"] = build_text(current_condition) - data["tooltip"] = build_tooltip(current_condition, astronomy, moon_icon) - data["tooltip"] += build_forecast(weather["weather"]) + text = build_text(current_condition) + + tooltip = build_tooltip(current_condition, astronomy, moon_icon) + build_forecast(weather["weather"]) + + data["text"] = text + data["tooltip"] = tooltip return json.dumps(data) @@ -430,6 +438,7 @@ let try: print(get_wttr_json()) except Exception as e: + print("error") print(e) main() diff --git a/systems/x86_64-linux/desktop/specialisations/hyprland/home/default.nix b/systems/x86_64-linux/desktop/specialisations/hyprland/home/default.nix index 5274a8f..8e67b02 100644 --- a/systems/x86_64-linux/desktop/specialisations/hyprland/home/default.nix +++ b/systems/x86_64-linux/desktop/specialisations/hyprland/home/default.nix @@ -79,6 +79,8 @@ in layer = "bottom"; + networkInterface = "wlp9s0"; + modules-right = [ "custom/lights" "temperature"