weather
This commit is contained in:
@@ -315,12 +315,12 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
"custom/left-end" = {
|
"custom/left-end" = {
|
||||||
format = " ";
|
format = " ";
|
||||||
tooltip = false;
|
tooltip = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
"custom/right-end" = {
|
"custom/right-end" = {
|
||||||
format = " ";
|
format = " ";
|
||||||
tooltip = false;
|
tooltip = false;
|
||||||
};
|
};
|
||||||
} // cfg.extraModules;
|
} // cfg.extraModules;
|
||||||
@@ -418,7 +418,8 @@ in
|
|||||||
color: ${nord.frost.nord10};
|
color: ${nord.frost.nord10};
|
||||||
background-color: ${nord.polarNight.nord0};
|
background-color: ${nord.polarNight.nord0};
|
||||||
${defaultOpacity}
|
${defaultOpacity}
|
||||||
${borderRight}
|
${defaultCenterOptions}
|
||||||
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#battery {
|
#battery {
|
||||||
@@ -434,7 +435,8 @@ in
|
|||||||
color: ${nord.frost.nord9};
|
color: ${nord.frost.nord9};
|
||||||
background-color: ${nord.polarNight.nord0};
|
background-color: ${nord.polarNight.nord0};
|
||||||
${defaultOpacity}
|
${defaultOpacity}
|
||||||
${borderLeft}
|
${defaultCenterOptions}
|
||||||
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------- */
|
/* ------------- */
|
||||||
@@ -443,7 +445,8 @@ in
|
|||||||
color: ${nord.frost.nord10};
|
color: ${nord.frost.nord10};
|
||||||
background-color: ${nord.polarNight.nord0};
|
background-color: ${nord.polarNight.nord0};
|
||||||
${defaultOpacity}
|
${defaultOpacity}
|
||||||
${borderRight}
|
${defaultCenterOptions}
|
||||||
|
border-radius: 0;
|
||||||
padding-right: 1rem;
|
padding-right: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ let
|
|||||||
#! nix-shell -i python3 --pure
|
#! nix-shell -i python3 --pure
|
||||||
#! nix-shell -p python3 python3Packages.requests
|
#! nix-shell -p python3 python3Packages.requests
|
||||||
|
|
||||||
"""get waybar weather"""
|
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import shutil
|
import shutil
|
||||||
@@ -98,12 +97,16 @@ let
|
|||||||
WIND_DIRECTION = {
|
WIND_DIRECTION = {
|
||||||
"S": "↓",
|
"S": "↓",
|
||||||
"SW": "↙",
|
"SW": "↙",
|
||||||
|
"SSW": "↙",
|
||||||
"W": "←",
|
"W": "←",
|
||||||
"NW": "↖",
|
"NW": "↖",
|
||||||
|
"NNW": "↖",
|
||||||
"N": "↑",
|
"N": "↑",
|
||||||
"NE": "↗",
|
"NE": "↗",
|
||||||
|
"NNE": "↗",
|
||||||
"E": "→",
|
"E": "→",
|
||||||
"SE": "↘",
|
"SE": "↘",
|
||||||
|
"SSE": "↘",
|
||||||
}
|
}
|
||||||
|
|
||||||
MOON_PHASES = (
|
MOON_PHASES = (
|
||||||
@@ -339,11 +342,13 @@ let
|
|||||||
moon_phase = astronomy['moon_phase']
|
moon_phase = astronomy['moon_phase']
|
||||||
wego = WEATHER_CODES_WEGO[current_condition['weatherCode']]
|
wego = WEATHER_CODES_WEGO[current_condition['weatherCode']]
|
||||||
|
|
||||||
tooltip = f"{wego[0]}{weather_description} {temp_f}°\n"
|
current = f"{wego[0]}{weather_description} {temp_f}°\n"
|
||||||
tooltip += f"{wego[1]}Feels like: {feels_like_f}°\n"
|
feels = f"{wego[1]}Feels like: {feels_like_f}°\n"
|
||||||
tooltip += f"{wego[2]}Wind: {wind_speed}mph {WIND_DIRECTION[wind_dir]}\n"
|
wind = f"{wego[2]}Wind: {wind_speed}mph {WIND_DIRECTION[wind_dir]}\n"
|
||||||
tooltip += f"{wego[3]}Humidity: {humidity}%\n"
|
humidityl = f"{wego[3]}Humidity: {humidity}%\n"
|
||||||
tooltip += f"{wego[4]}Moon phase: {moon_phase} " + moon_icon + "\n"
|
moon = f"{wego[4]}Moon phase: {moon_phase} " + moon_icon + "\n"
|
||||||
|
|
||||||
|
tooltip = current + feels + wind + humidityl + moon
|
||||||
|
|
||||||
return tooltip
|
return tooltip
|
||||||
|
|
||||||
@@ -419,9 +424,12 @@ let
|
|||||||
current_condition = weather["current_condition"][0]
|
current_condition = weather["current_condition"][0]
|
||||||
astronomy = weather["weather"][0]['astronomy'][0]
|
astronomy = weather["weather"][0]['astronomy'][0]
|
||||||
|
|
||||||
data["text"] = build_text(current_condition)
|
text = build_text(current_condition)
|
||||||
data["tooltip"] = build_tooltip(current_condition, astronomy, moon_icon)
|
|
||||||
data["tooltip"] += build_forecast(weather["weather"])
|
tooltip = build_tooltip(current_condition, astronomy, moon_icon) + build_forecast(weather["weather"])
|
||||||
|
|
||||||
|
data["text"] = text
|
||||||
|
data["tooltip"] = tooltip
|
||||||
|
|
||||||
return json.dumps(data)
|
return json.dumps(data)
|
||||||
|
|
||||||
@@ -430,6 +438,7 @@ let
|
|||||||
try:
|
try:
|
||||||
print(get_wttr_json())
|
print(get_wttr_json())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
print("error")
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ in
|
|||||||
|
|
||||||
layer = "bottom";
|
layer = "bottom";
|
||||||
|
|
||||||
|
networkInterface = "wlp9s0";
|
||||||
|
|
||||||
modules-right = [
|
modules-right = [
|
||||||
"custom/lights"
|
"custom/lights"
|
||||||
"temperature"
|
"temperature"
|
||||||
|
|||||||
Reference in New Issue
Block a user