weather stuff
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -2,4 +2,9 @@ hosts/nas/*.conf
|
|||||||
hosts/nas/*.users
|
hosts/nas/*.users
|
||||||
result
|
result
|
||||||
*.raw
|
*.raw
|
||||||
.codegpt
|
.codegpt
|
||||||
|
.direnv
|
||||||
|
shell.nix
|
||||||
|
.vscode
|
||||||
|
**/*/*.py
|
||||||
|
.envrc
|
||||||
34
flake.lock
generated
34
flake.lock
generated
@@ -296,6 +296,24 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dxvk_2_git": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1752147070,
|
||||||
|
"narHash": "sha256-FsjTB7yalDZ/qvMh2iFk3i4sRnKVS0lzT30aqBnFvLQ=",
|
||||||
|
"ref": "refs/heads/master",
|
||||||
|
"rev": "e940893bdc00c3f76529bd05df4616d90ddb2444",
|
||||||
|
"revCount": 7209,
|
||||||
|
"submodules": true,
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/doitsujin/dxvk"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"submodules": true,
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/doitsujin/dxvk"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
@@ -1571,6 +1589,22 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"pe_parse_git": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1732739339,
|
||||||
|
"narHash": "sha256-DMwgFvEbsAf3hm7BdfN168qlFkDcoMcdIK7FMV/QGUQ=",
|
||||||
|
"owner": "trailofbits",
|
||||||
|
"repo": "pe-parse",
|
||||||
|
"rev": "31ac5966503689d5693cd9fb520bd525a8710e17",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "trailofbits",
|
||||||
|
"repo": "pe-parse",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"pi4-disko": {
|
"pi4-disko": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
inputs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
@@ -48,6 +49,8 @@ let
|
|||||||
udisks2
|
udisks2
|
||||||
unzip
|
unzip
|
||||||
winetricks
|
winetricks
|
||||||
|
|
||||||
|
inputs.desktop-lsfg.packages."x86_64-linux".default
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@@ -116,6 +119,7 @@ in
|
|||||||
# Virtualisation configuration
|
# Virtualisation configuration
|
||||||
virtualisation = {
|
virtualisation = {
|
||||||
libvirtd.enable = lib.mkDefault true;
|
libvirtd.enable = lib.mkDefault true;
|
||||||
|
podman.enable = true;
|
||||||
waydroid.enable = lib.mkDefault true;
|
waydroid.enable = lib.mkDefault true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ in
|
|||||||
bottles
|
bottles
|
||||||
unstable.compose2nix
|
unstable.compose2nix
|
||||||
discord
|
discord
|
||||||
|
distrobox
|
||||||
heroic
|
heroic
|
||||||
stable.vmware-horizon-client
|
stable.vmware-horizon-client
|
||||||
jq
|
jq
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ let
|
|||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
primaryDisplay = displayLeft;
|
||||||
|
networkInterface = "wlp9s0";
|
||||||
|
|
||||||
wallpaper = [
|
wallpaper = [
|
||||||
"${displayLeft.input}, /run/wallpaper.jpg"
|
"${displayLeft.input}, /run/wallpaper.jpg"
|
||||||
"${displayRight.input}, /run/wallpaper.jpg"
|
"${displayRight.input}, /run/wallpaper.jpg"
|
||||||
@@ -61,6 +64,7 @@ in
|
|||||||
"wireplumber#sink"
|
"wireplumber#sink"
|
||||||
"wireplumber#source"
|
"wireplumber#source"
|
||||||
"bluetooth"
|
"bluetooth"
|
||||||
|
"network"
|
||||||
"idle_inhibitor"
|
"idle_inhibitor"
|
||||||
"clock"
|
"clock"
|
||||||
"custom/weather"
|
"custom/weather"
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ in
|
|||||||
ratbagd.enable = lib.mkDefault true;
|
ratbagd.enable = lib.mkDefault true;
|
||||||
|
|
||||||
keyd = {
|
keyd = {
|
||||||
enable = true;
|
enable = false;
|
||||||
keyboards = {
|
keyboards = {
|
||||||
default = {
|
default = {
|
||||||
ids = [ "*" ];
|
ids = [ "*" ];
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
let
|
let
|
||||||
mosquittoPort = 1883;
|
mosquittoPort = 1883;
|
||||||
zigbee2mqttPort = 8080;
|
zigbee2mqttPort = 8080;
|
||||||
# "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
|
|
||||||
ha-bambulab = pkgs.stdenv.mkDerivation {
|
ha-bambulab = pkgs.stdenv.mkDerivation {
|
||||||
pname = "ha-bambulab";
|
pname = "ha-bambulab";
|
||||||
version = "v2.1.5"; # Update with correct version
|
version = "v2.1.5"; # Update with correct version
|
||||||
|
|||||||
@@ -1,13 +1,23 @@
|
|||||||
let
|
let
|
||||||
theme = import ../../modules/desktop-environments/hyprland/theme.nix;
|
theme = import ../../modules/desktop-environments/hyprland/theme.nix;
|
||||||
|
|
||||||
|
# Displays
|
||||||
|
display = {
|
||||||
|
input = "eDP-1";
|
||||||
|
resolution = "3456x2234";
|
||||||
|
refreshRate = "60.00000";
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
primaryDisplay = display;
|
||||||
|
networkInterface = "wlan0";
|
||||||
|
|
||||||
wallpaper = [
|
wallpaper = [
|
||||||
"eDP-1, /run/wallpaper.jpg"
|
"${display.input}, /run/wallpaper.jpg"
|
||||||
];
|
];
|
||||||
|
|
||||||
monitor = [
|
monitor = [
|
||||||
"eDP-1,3456x2234@60.00000,0x0,1.25,bitdepth,10,cm,hdr,sdrbrightness,1.2,sdrsaturation,0.98"
|
"${display.input},${display.resolution}@${display.refreshRate},0x0,1.25,bitdepth,10,cm,hdr,sdrbrightness,1.2,sdrsaturation,0.98"
|
||||||
];
|
];
|
||||||
|
|
||||||
# monitorv2 = {
|
# monitorv2 = {
|
||||||
@@ -19,9 +29,9 @@ in
|
|||||||
# };
|
# };
|
||||||
|
|
||||||
workspace = [
|
workspace = [
|
||||||
"name:firefox, monitor:eDP-1, default:false, special, class:(.*firefox.*)"
|
"name:firefox, monitor:${display.input}, default:false, special, class:(.*firefox.*)"
|
||||||
"name:discord, monitor:eDP-1, default:true, special, title:(.*vesktop.*), title:(.*Apple Music.*)"
|
"name:discord, monitor:${display.input}, default:true, special, title:(.*vesktop.*), title:(.*Apple Music.*)"
|
||||||
"name:steam, monitor:eDP-1, default:false, special, class:(.*[Ss]team.*)"
|
"name:steam, monitor:${display.input}, default:false, special, class:(.*[Ss]team.*)"
|
||||||
];
|
];
|
||||||
|
|
||||||
windowRule = [
|
windowRule = [
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ in
|
|||||||
./services.nix
|
./services.nix
|
||||||
./sops.nix
|
./sops.nix
|
||||||
../../modules/desktop-environments/hyprland
|
../../modules/desktop-environments/hyprland
|
||||||
# ./hass.nix
|
./hass.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# Enable nix flakes and nix-command tools
|
# Enable nix flakes and nix-command tools
|
||||||
|
|||||||
@@ -210,6 +210,9 @@ in
|
|||||||
"float, class:(.*FileRoller.*)"
|
"float, class:(.*FileRoller.*)"
|
||||||
"float, class:(.*wlogout.*)"
|
"float, class:(.*wlogout.*)"
|
||||||
"idleinhibit stayfocused, title:(.*mpv.*)"
|
"idleinhibit stayfocused, title:(.*mpv.*)"
|
||||||
|
|
||||||
|
"float, class:(.*nm-connection-editor.*)"
|
||||||
|
"move onscreen cursor 0% 0%, class:(.*nm-connection-editor.*)"
|
||||||
|
|
||||||
"float, title:(Media viewer)"
|
"float, title:(Media viewer)"
|
||||||
"float, class:(it.mijorus.smile),title:(Smile)"
|
"float, class:(it.mijorus.smile),title:(Smile)"
|
||||||
|
|||||||
@@ -151,30 +151,45 @@ in
|
|||||||
"bluetooth" = {
|
"bluetooth" = {
|
||||||
on-click = "overskride";
|
on-click = "overskride";
|
||||||
tooltip = true;
|
tooltip = true;
|
||||||
format = "{format-off}";
|
format = "{icon}";
|
||||||
format-disabled = "";
|
|
||||||
format-off = "";
|
|
||||||
format-on = "";
|
|
||||||
format-connected = "";
|
|
||||||
tooltip-format = "{status}";
|
tooltip-format = "{status}";
|
||||||
tooltip-format-disabled = "{status}";
|
tooltip-format-disabled = "{status}";
|
||||||
tooltip-format-off = "{status}";
|
tooltip-format-off = "{status}";
|
||||||
tooltip-format-on = "{status}";
|
tooltip-format-on = "{status}";
|
||||||
tooltip-format-connected = "{status}";
|
tooltip-format-connected = "{status}";
|
||||||
tooltip-format-enumerate-connected = { };
|
tooltip-format-enumerate-connected = { };
|
||||||
|
format-icons = {
|
||||||
|
disabled = "";
|
||||||
|
off = "";
|
||||||
|
on = "";
|
||||||
|
connected = "";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
network = {
|
network = {
|
||||||
interface = "wlan0";
|
interface = hyprlandSettings.networkInterface;
|
||||||
format = "{ifname}";
|
on-click = "nm-connection-editor";
|
||||||
format-wifi = ""; # "{essid} ({signalStrength}%) ";
|
format = "{icon}";
|
||||||
format-ethernet = ""; # "{ipaddr}/{cidr} ";
|
|
||||||
format-disconnected = "" ; # An empty format will hide the module.
|
|
||||||
tooltip-format = "{ifname} via {gwaddr} ";
|
tooltip-format = "{ifname} via {gwaddr} ";
|
||||||
tooltip-format-wifi = "{essid} ({signalStrength}%) ";
|
tooltip-format-wifi = ''
|
||||||
|
{essid} ({signalStrength}%) {icon}
|
||||||
|
{bandwidthDownBits} {bandwidthUpBits}
|
||||||
|
'';
|
||||||
tooltip-format-ethernet = "{ifname} ";
|
tooltip-format-ethernet = "{ifname} ";
|
||||||
tooltip-format-disconnected = "Disconnected";
|
tooltip-format-disconnected = "Disconnected";
|
||||||
max-length = 50;
|
max-length = 50;
|
||||||
|
format-icons = {
|
||||||
|
wifi = [
|
||||||
|
""
|
||||||
|
""
|
||||||
|
""
|
||||||
|
""
|
||||||
|
""
|
||||||
|
];
|
||||||
|
ethernet = "";
|
||||||
|
linked = "";
|
||||||
|
disconnected = "";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
idle_inhibitor = {
|
idle_inhibitor = {
|
||||||
@@ -245,6 +260,7 @@ in
|
|||||||
interval = 30;
|
interval = 30;
|
||||||
exec = "waybar-weather";
|
exec = "waybar-weather";
|
||||||
return-type = "json";
|
return-type = "json";
|
||||||
|
markup = "pango";
|
||||||
};
|
};
|
||||||
} // hyprlandSettings.waybar.extraModules or { };
|
} // hyprlandSettings.waybar.extraModules or { };
|
||||||
};
|
};
|
||||||
@@ -253,6 +269,16 @@ in
|
|||||||
# window.eDP-1 * { font-size: 10px; }
|
# window.eDP-1 * { font-size: 10px; }
|
||||||
|
|
||||||
style = ''
|
style = ''
|
||||||
|
.blink_me {
|
||||||
|
animation: blinker 1s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes blinker {
|
||||||
|
50% {
|
||||||
|
color: ${settings.theme.nord.aurora.nord11};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
font-family:
|
font-family:
|
||||||
Jetbrains Mono Nerd Font,
|
Jetbrains Mono Nerd Font,
|
||||||
@@ -321,6 +347,11 @@ in
|
|||||||
margin-right: ${hyprlandSettings.waybar.moduleStyle.window.margin-right or "4rem"};
|
margin-right: ${hyprlandSettings.waybar.moduleStyle.window.margin-right or "4rem"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* make window module transparent when no windows present */
|
||||||
|
#window.empty {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
#custom-weather {
|
#custom-weather {
|
||||||
color: ${settings.theme.nord.frost.nord10};
|
color: ${settings.theme.nord.frost.nord10};
|
||||||
background-color: ${settings.theme.nord.polarNight.nord0};
|
background-color: ${settings.theme.nord.polarNight.nord0};
|
||||||
@@ -367,6 +398,10 @@ in
|
|||||||
padding-right: 15px;
|
padding-right: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#network:hover {
|
||||||
|
background: ${settings.theme.nord.polarNight.nord3};
|
||||||
|
}
|
||||||
|
|
||||||
#bluetooth {
|
#bluetooth {
|
||||||
color: ${settings.theme.nord.frost.nord9};
|
color: ${settings.theme.nord.frost.nord9};
|
||||||
background-color: ${settings.theme.nord.polarNight.nord0};
|
background-color: ${settings.theme.nord.polarNight.nord0};
|
||||||
@@ -387,6 +422,14 @@ in
|
|||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#wireplumber.source.muted {
|
||||||
|
animation-name: blinker;
|
||||||
|
animation-duration: 2s;
|
||||||
|
animation-timing-function: linear;
|
||||||
|
animation-iteration-count: infinite;
|
||||||
|
padding-right: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
#wireplumber.source:hover {
|
#wireplumber.source:hover {
|
||||||
background: ${settings.theme.nord.polarNight.nord3};
|
background: ${settings.theme.nord.polarNight.nord3};
|
||||||
}
|
}
|
||||||
@@ -399,6 +442,13 @@ in
|
|||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#wireplumber.sink.muted {
|
||||||
|
animation-name: blinker;
|
||||||
|
animation-duration: 5s;
|
||||||
|
animation-timing-function: linear;
|
||||||
|
animation-iteration-count: infinite;
|
||||||
|
}
|
||||||
|
|
||||||
#wireplumber.sink:hover {
|
#wireplumber.sink:hover {
|
||||||
background: ${settings.theme.nord.polarNight.nord3};
|
background: ${settings.theme.nord.polarNight.nord3};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,11 @@ 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 json
|
import json
|
||||||
from datetime import datetime
|
import shutil
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
@@ -61,58 +64,43 @@ let
|
|||||||
"395": "HeavySnowShowers",
|
"395": "HeavySnowShowers",
|
||||||
}
|
}
|
||||||
|
|
||||||
WEATHER_SYMBOL_EMOJI = {
|
|
||||||
"Unknown": "✨",
|
|
||||||
"Cloudy": "☁️",
|
|
||||||
"Fog": "🌫",
|
|
||||||
"HeavyRain": "🌧",
|
|
||||||
"HeavyShowers": "🌧",
|
|
||||||
"HeavySnow": "❄️",
|
|
||||||
"HeavySnowShowers": "❄️",
|
|
||||||
"LightRain": "🌦",
|
|
||||||
"LightShowers": "🌦",
|
|
||||||
"LightSleet": "🌧",
|
|
||||||
"LightSleetShowers": "🌧",
|
|
||||||
"LightSnow": "🌨",
|
|
||||||
"LightSnowShowers": "🌨",
|
|
||||||
"PartlyCloudy": "⛅️",
|
|
||||||
"Sunny": "☀️",
|
|
||||||
"ThunderyHeavyRain": "🌩",
|
|
||||||
"ThunderyShowers": "⛈",
|
|
||||||
"ThunderySnowShowers": "⛈",
|
|
||||||
"VeryCloudy": "☁️",
|
|
||||||
}
|
|
||||||
|
|
||||||
WEATHER_SYMBOL = {
|
WEATHER_SYMBOL = {
|
||||||
"Unknown": "✨",
|
"Unknown": "",
|
||||||
"Cloudy": "☁️",
|
"Cloudy": "",
|
||||||
"Fog": "🌫",
|
"Fog": "",
|
||||||
"HeavyRain": "🌧",
|
"HeavyRain": "",
|
||||||
"HeavyShowers": "🌧",
|
"HeavyShowers": "",
|
||||||
"HeavySnow": "❄️",
|
"HeavySnow": "",
|
||||||
"HeavySnowShowers": "❄️",
|
"HeavySnowShowers": "",
|
||||||
"LightRain": "🌦",
|
"LightRain": "",
|
||||||
"LightShowers": "🌦",
|
"LightShowers": "",
|
||||||
"LightSleet": "🌧",
|
"LightSleet": "",
|
||||||
"LightSleetShowers": "🌧",
|
"LightSleetShowers": "",
|
||||||
"LightSnow": "🌨",
|
"LightSnow": "",
|
||||||
"LightSnowShowers": "🌨",
|
"LightSnowShowers": "",
|
||||||
"PartlyCloudy": "⛅️",
|
"PartlyCloudy": "",
|
||||||
"Sunny": "☀️",
|
"Sunny": "",
|
||||||
"ThunderyHeavyRain": "🌩",
|
"ThunderyHeavyRain": "",
|
||||||
"ThunderyShowers": "⛈",
|
"ThunderyShowers": "",
|
||||||
"ThunderySnowShowers": "⛈",
|
"ThunderySnowShowers": "",
|
||||||
"VeryCloudy": "☁️",
|
"VeryCloudy": "",
|
||||||
}
|
}
|
||||||
|
|
||||||
WEATHER_CODES = {key: WEATHER_SYMBOL[value] for key, value in WWO_CODE.items()}
|
WEATHER_CODES = {key: WEATHER_SYMBOL[value] for key, value in WWO_CODE.items()}
|
||||||
|
|
||||||
WIND_DIRECTION = [
|
WIND_DIRECTION = {
|
||||||
"↓", "↙", "←", "↖", "↑", "↗", "→", "↘",
|
"S": "↓",
|
||||||
]
|
"SW": "↙",
|
||||||
|
"W": "←",
|
||||||
|
"NW": "↖",
|
||||||
|
"N": "↑",
|
||||||
|
"NE": "↗",
|
||||||
|
"E": "→",
|
||||||
|
"SE": "↘",
|
||||||
|
}
|
||||||
|
|
||||||
MOON_PHASES = (
|
MOON_PHASES = (
|
||||||
"🌑", "🌒", "🌓", "🌔", "🌕", "🌖", "🌗", "🌘"
|
"", "", "", "", "", "", "", ""
|
||||||
)
|
)
|
||||||
|
|
||||||
WEATHER_SYMBOL_WI_DAY = {
|
WEATHER_SYMBOL_WI_DAY = {
|
||||||
@@ -129,7 +117,7 @@ let
|
|||||||
"LightSleetShowers": "",
|
"LightSleetShowers": "",
|
||||||
"LightSnow": "",
|
"LightSnow": "",
|
||||||
"LightSnowShowers": "",
|
"LightSnowShowers": "",
|
||||||
"PartlyCloudy": "",
|
"PartlyCloudy": "",
|
||||||
"Sunny": "",
|
"Sunny": "",
|
||||||
"ThunderyHeavyRain": "",
|
"ThunderyHeavyRain": "",
|
||||||
"ThunderyShowers": "",
|
"ThunderyShowers": "",
|
||||||
@@ -153,8 +141,8 @@ let
|
|||||||
"LightSleetShowers": "",
|
"LightSleetShowers": "",
|
||||||
"LightSnow": "",
|
"LightSnow": "",
|
||||||
"LightSnowShowers": "",
|
"LightSnowShowers": "",
|
||||||
"PartlyCloudy": "",
|
"PartlyCloudy": "",
|
||||||
"Sunny": "",
|
"Sunny": "",
|
||||||
"ThunderyHeavyRain": "",
|
"ThunderyHeavyRain": "",
|
||||||
"ThunderyShowers": "",
|
"ThunderyShowers": "",
|
||||||
"ThunderySnowShowers": "",
|
"ThunderySnowShowers": "",
|
||||||
@@ -163,21 +151,6 @@ let
|
|||||||
|
|
||||||
WEATHER_CODES_WI_NIGHT = {key: WEATHER_SYMBOL_WI_NIGHT[value] for key, value in WWO_CODE.items()}
|
WEATHER_CODES_WI_NIGHT = {key: WEATHER_SYMBOL_WI_NIGHT[value] for key, value in WWO_CODE.items()}
|
||||||
|
|
||||||
WIND_DIRECTION_WI = [
|
|
||||||
"", "", "", "", "", "", "", "",
|
|
||||||
]
|
|
||||||
|
|
||||||
WIND_SCALE_WI = [
|
|
||||||
"", "", "", "", "", "", "", "", "", "", "", "", "",
|
|
||||||
]
|
|
||||||
|
|
||||||
MOON_PHASES_WI = (
|
|
||||||
"", "", "", "", "", "", "",
|
|
||||||
"", "", "", "", "", "", "",
|
|
||||||
"", "", "", "", "", "", "",
|
|
||||||
"", "", "", "", "", "", "",
|
|
||||||
)
|
|
||||||
|
|
||||||
WEATHER_SYMBOL_WEGO = {
|
WEATHER_SYMBOL_WEGO = {
|
||||||
"Unknown": [
|
"Unknown": [
|
||||||
" .-. ",
|
" .-. ",
|
||||||
@@ -186,134 +159,137 @@ let
|
|||||||
" `-’ ",
|
" `-’ ",
|
||||||
" • "],
|
" • "],
|
||||||
"Sunny": [
|
"Sunny": [
|
||||||
"\033[38;5;226m \\ / \033[0m",
|
'<span foreground=\"#FFFF00\"> \\ / </span>',
|
||||||
"\033[38;5;226m .-. \033[0m",
|
'<span foreground=\"#FFFF00\"> .-. </span>',
|
||||||
"\033[38;5;226m ― ( ) ― \033[0m",
|
'<span foreground=\"#FFFF00\"> ― ( ) ― </span>',
|
||||||
"\033[38;5;226m `-’ \033[0m",
|
'<span foreground=\"#FFFF00\"> `-’ </span>',
|
||||||
"\033[38;5;226m / \\ \033[0m"],
|
'<span foreground=\"#FFFF00\"> / \\ </span>'],
|
||||||
"PartlyCloudy": [
|
"PartlyCloudy": [
|
||||||
"\033[38;5;226m \\ /\033[0m ",
|
'<span foreground=\"#FFFF00\"> \\ / </span>',
|
||||||
"\033[38;5;226m _ /\"\"\033[38;5;250m.-. \033[0m",
|
'<span foreground=\"#FFFF00\"> _ /\'\'</span>"<span foreground=\"#BBBBBB\">.-. </span>',
|
||||||
"\033[38;5;226m \\_\033[38;5;250m( ). \033[0m",
|
'<span foreground=\"#FFFF00\"> \\_</span>"<span foreground=\"#BBBBBB\">( ). </span>',
|
||||||
"\033[38;5;226m /\033[38;5;250m(___(__) \033[0m",
|
'<span foreground=\"#FFFF00\"> /</span>"<span foreground=\"#BBBBBB\">(___(__) </span>',
|
||||||
" "],
|
' '
|
||||||
|
],
|
||||||
"Cloudy": [
|
"Cloudy": [
|
||||||
" ",
|
' ',
|
||||||
"\033[38;5;250m .--. \033[0m",
|
'<span foreground=\"#BBBBBB\"> .--. </span>',
|
||||||
"\033[38;5;250m .-( ). \033[0m",
|
'<span foreground=\"#BBBBBB\"> .-( ). </span>',
|
||||||
"\033[38;5;250m (___.__)__) \033[0m",
|
'<span foreground=\"#BBBBBB\"> (___.__)__) </span>',
|
||||||
" "],
|
' '],
|
||||||
"VeryCloudy": [
|
"VeryCloudy": [
|
||||||
" ",
|
' ',
|
||||||
"\033[38;5;240;1m .--. \033[0m",
|
'<span foreground=\"#585858\"; font-weight: bold;"> .--. </span>',
|
||||||
"\033[38;5;240;1m .-( ). \033[0m",
|
'<span foreground=\"#585858\"; font-weight: bold;"> .-( ). </span>',
|
||||||
"\033[38;5;240;1m (___.__)__) \033[0m",
|
'<span foreground=\"#585858\"; font-weight: bold;"> (___.__)__) </span>',
|
||||||
" "],
|
' '],
|
||||||
"LightShowers": [
|
"LightShowers": [
|
||||||
"\033[38;5;226m _`/\"\"\033[38;5;250m.-. \033[0m",
|
'<span foreground=\"#FFFF00\"> _`/\'\'</span>"<span foreground=\"#BBBBBB\">.-. </span>',
|
||||||
"\033[38;5;226m ,\\_\033[38;5;250m( ). \033[0m",
|
'<span foreground=\"#FFFF00\"> ,\\_</span>"<span foreground=\"#BBBBBB\">( ). </span>',
|
||||||
"\033[38;5;226m /\033[38;5;250m(___(__) \033[0m",
|
'<span foreground=\"#FFFF00\"> /</span>"<span foreground=\"#BBBBBB\">(___(__) </span>',
|
||||||
"\033[38;5;111m ‘ ‘ ‘ ‘ \033[0m",
|
'<span foreground=\"#87afff\";"> ‘ ‘ ‘ ‘ </span>',
|
||||||
"\033[38;5;111m ‘ ‘ ‘ ‘ \033[0m"],
|
'<span foreground=\"#87afff\";"> ‘ ‘ ‘ ‘ </span>'],
|
||||||
"HeavyShowers": [
|
"HeavyShowers": [
|
||||||
"\033[38;5;226m _`/\"\"\033[38;5;240;1m.-. \033[0m",
|
'<span foreground=\"#FFFF00\"> _`/\'\'</span>"<span foreground=\"#585858\"; font-weight: bold;">.-. </span>',
|
||||||
"\033[38;5;226m ,\\_\033[38;5;240;1m( ). \033[0m",
|
'<span foreground=\"#FFFF00\"> ,\\_</span>"<span foreground=\"#585858\"; font-weight: bold;">( ). </span>',
|
||||||
"\033[38;5;226m /\033[38;5;240;1m(___(__) \033[0m",
|
'<span foreground=\"#FFFF00\"> /</span>"<span foreground=\"#585858\"; font-weight: bold;">(___(__) </span>',
|
||||||
"\033[38;5;21;1m ‚‘‚‘‚‘‚‘ \033[0m",
|
'<span foreground=\"#0000ff\"; font-weight: bold;"> ‚‘‚‘‚‘‚‘ </span>',
|
||||||
"\033[38;5;21;1m ‚’‚’‚’‚’ \033[0m"],
|
'<span foreground=\"#0000ff\"; font-weight: bold;"> ‚’‚’‚’‚’ </span>'],
|
||||||
"LightSnowShowers": [
|
"LightSnowShowers": [
|
||||||
"\033[38;5;226m _`/\"\"\033[38;5;250m.-. \033[0m",
|
'<span foreground=\"#FFFF00\"> _`/\'\'</span>"<span foreground=\"#BBBBBB\">.-. </span>',
|
||||||
"\033[38;5;226m ,\\_\033[38;5;250m( ). \033[0m",
|
'<span foreground=\"#FFFF00\"> ,\\_</span>"<span foreground=\"#BBBBBB\">( ). </span>',
|
||||||
"\033[38;5;226m /\033[38;5;250m(___(__) \033[0m",
|
'<span foreground=\"#FFFF00\"> /</span>"<span foreground=\"#BBBBBB\">(___(__) </span>',
|
||||||
"\033[38;5;255m * * * \033[0m",
|
'<span foreground=\"#eeeeee\";"> * * * </span>',
|
||||||
"\033[38;5;255m * * * \033[0m"],
|
'<span foreground=\"#eeeeee\";"> * * * </span>'],
|
||||||
"HeavySnowShowers": [
|
"HeavySnowShowers": [
|
||||||
"\033[38;5;226m _`/\"\"\033[38;5;240;1m.-. \033[0m",
|
'<span foreground=\"#FFFF00\"> _`/\'\'</span>"<span foreground=\"#585858\"; font-weight: bold;">.-. </span>',
|
||||||
"\033[38;5;226m ,\\_\033[38;5;240;1m( ). \033[0m",
|
'<span foreground=\"#FFFF00\"> ,\\_</span>"<span foreground=\"#585858\"; font-weight: bold;">( ). </span>',
|
||||||
"\033[38;5;226m /\033[38;5;240;1m(___(__) \033[0m",
|
'<span foreground=\"#FFFF00\"> /</span>"<span foreground=\"#585858\"; font-weight: bold;">(___(__) </span>',
|
||||||
"\033[38;5;255;1m * * * * \033[0m",
|
'<span foreground=\"#eeeeee\"; font-weight: bold;"> * * * * </span>',
|
||||||
"\033[38;5;255;1m * * * * \033[0m"],
|
'<span foreground=\"#eeeeee\"; font-weight: bold;"> * * * * </span>'],
|
||||||
"LightSleetShowers": [
|
"LightSleetShowers": [
|
||||||
"\033[38;5;226m _`/\"\"\033[38;5;250m.-. \033[0m",
|
'<span foreground=\"#FFFF00\"> _`/\'\'</span>"<span foreground=\"#BBBBBB\">.-. </span>',
|
||||||
"\033[38;5;226m ,\\_\033[38;5;250m( ). \033[0m",
|
'<span foreground=\"#FFFF00\"> ,\\_</span>"<span foreground=\"#BBBBBB\">( ). </span>',
|
||||||
"\033[38;5;226m /\033[38;5;250m(___(__) \033[0m",
|
'<span foreground=\"#FFFF00\"> /</span>"<span foreground=\"#BBBBBB\">(___(__) </span>',
|
||||||
"\033[38;5;111m ‘ \033[38;5;255m*\033[38;5;111m ‘ \033[38;5;255m* \033[0m",
|
'<span foreground=\"#87afff\";"> ‘ </span>"<span foreground=\"#eeeeee\";">*</span>"<span foreground=\"#87afff\";"> ‘ </span>"<span foreground=\"#eeeeee\";">* </span>',
|
||||||
"\033[38;5;255m *\033[38;5;111m ‘ \033[38;5;255m*\033[38;5;111m ‘ \033[0m"],
|
'<span foreground=\"#eeeeee\";"> *</span>"<span foreground=\"#87afff\";"> ‘ </span>"<span foreground=\"#eeeeee\";">*</span>"<span foreground=\"#87afff\";"> ‘ </span>'],
|
||||||
"ThunderyShowers": [
|
"ThunderyShowers": [
|
||||||
"\033[38;5;226m _`/\"\"\033[38;5;250m.-. \033[0m",
|
'<span foreground=\"#FFFF00\"> _`/\'\'</span>"<span foreground=\"#BBBBBB\">.-. </span>',
|
||||||
"\033[38;5;226m ,\\_\033[38;5;250m( ). \033[0m",
|
'<span foreground=\"#FFFF00\"> ,\\_</span>"<span foreground=\"#BBBBBB\">( ). </span>',
|
||||||
"\033[38;5;226m /\033[38;5;250m(___(__) \033[0m",
|
'<span foreground=\"#FFFF00\"> /</span>"<span foreground=\"#BBBBBB\">(___(__) </span>',
|
||||||
"\033[38;5;228;5m ⚡\033[38;5;111;25m‘ ‘\033[38;5;228;5m⚡\033[38;5;111;25m‘ ‘ \033[0m",
|
'<span foreground=\"#ffff87\";"> ⚡\\</span>"<span foreground=\"#87afff\";">‘ ‘</span>"<span foreground=\"#ffff87\";">⚡\\</span>"<span foreground=\"#87afff\";">‘ ‘ </span>',
|
||||||
"\033[38;5;111m ‘ ‘ ‘ ‘ \033[0m"],
|
'<span foreground=\"#87afff\";"> ‘ ‘ ‘ ‘ </span>'],
|
||||||
"ThunderyHeavyRain": [
|
"ThunderyHeavyRain": [
|
||||||
"\033[38;5;240;1m .-. \033[0m",
|
'<span foreground=\"#585858\"; font-weight: bold;"> .-. </span>',
|
||||||
"\033[38;5;240;1m ( ). \033[0m",
|
'<span foreground=\"#585858\"; font-weight: bold;"> ( ). </span>',
|
||||||
"\033[38;5;240;1m (___(__) \033[0m",
|
'<span foreground=\"#585858\"; font-weight: bold;"> (___(__) </span>',
|
||||||
"\033[38;5;21;1m ‚‘\033[38;5;228;5m⚡\033[38;5;21;25m‘‚\033[38;5;228;5m⚡\033[38;5;21;25m‚‘ \033[0m",
|
'<span foreground=\"#0000ff\"; font-weight: bold;"> ‚‘</span>"<span foreground=\"#ffff87\";">⚡\\</span>"<span foreground=\"#0000ff\";">‘‚</span>"<span foreground=\"#ffff87\";">⚡\\</span>"<span foreground=\"#0000ff\";">‚‘ </span>',
|
||||||
"\033[38;5;21;1m ‚’‚’\033[38;5;228;5m⚡\033[38;5;21;25m’‚’ \033[0m"],
|
'<span foreground=\"#0000ff\"; font-weight: bold;"> ‚’‚’</span>"<span foreground=\"#ffff87\";">⚡\\</span>"<span foreground=\"#0000ff\";">’‚’ </span>'],
|
||||||
"ThunderySnowShowers": [
|
"ThunderySnowShowers": [
|
||||||
"\033[38;5;226m _`/\"\"\033[38;5;250m.-. \033[0m",
|
'<span foreground=\"#FFFF00\"> _`/\'\'</span>"<span foreground=\"#BBBBBB\">.-. </span>',
|
||||||
"\033[38;5;226m ,\\_\033[38;5;250m( ). \033[0m",
|
'<span foreground=\"#FFFF00\"> ,\\_</span>"<span foreground=\"#BBBBBB\">( ). </span>',
|
||||||
"\033[38;5;226m /\033[38;5;250m(___(__) \033[0m",
|
'<span foreground=\"#FFFF00\"> /</span>"<span foreground=\"#BBBBBB\">(___(__) </span>',
|
||||||
"\033[38;5;255m *\033[38;5;228;5m⚡\033[38;5;255;25m*\033[38;5;228;5m⚡\033[38;5;255;25m* \033[0m",
|
'<span foreground=\"#eeeeee\";"> *</span>"<span foreground=\"#ffff87\";">⚡\\</span>"<span foreground=\"#eeeeee\";">*</span>"<span foreground=\"#ffff87\";">⚡\\</span>"<span foreground=\"#eeeeee\";">* </span>',
|
||||||
"\033[38;5;255m * * * \033[0m"],
|
'<span foreground=\"#eeeeee\";"> * * * </span>'],
|
||||||
"LightRain": [
|
"LightRain": [
|
||||||
"\033[38;5;250m .-. \033[0m",
|
'<span foreground=\"#BBBBBB\"> .-. </span>',
|
||||||
"\033[38;5;250m ( ). \033[0m",
|
'<span foreground=\"#BBBBBB\"> ( ). </span>',
|
||||||
"\033[38;5;250m (___(__) \033[0m",
|
'<span foreground=\"#BBBBBB\"> (___(__) </span>',
|
||||||
"\033[38;5;111m ‘ ‘ ‘ ‘ \033[0m",
|
'<span foreground=\"#87afff\";"> ‘ ‘ ‘ ‘ </span>',
|
||||||
"\033[38;5;111m ‘ ‘ ‘ ‘ \033[0m"],
|
'<span foreground=\"#87afff\";"> ‘ ‘ ‘ ‘ </span>'],
|
||||||
"HeavyRain": [
|
"HeavyRain": [
|
||||||
"\033[38;5;240;1m .-. \033[0m",
|
'<span foreground=\"#585858\"; font-weight: bold;"> .-. </span>',
|
||||||
"\033[38;5;240;1m ( ). \033[0m",
|
'<span foreground=\"#585858\"; font-weight: bold;"> ( ). </span>',
|
||||||
"\033[38;5;240;1m (___(__) \033[0m",
|
'<span foreground=\"#585858\"; font-weight: bold;"> (___(__) </span>',
|
||||||
"\033[38;5;21;1m ‚‘‚‘‚‘‚‘ \033[0m",
|
'<span foreground=\"#0000ff\"; font-weight: bold;"> ‚‘‚‘‚‘‚‘ </span>',
|
||||||
"\033[38;5;21;1m ‚’‚’‚’‚’ \033[0m"],
|
'<span foreground=\"#0000ff\"; font-weight: bold;"> ‚’‚’‚’‚’ </span>'],
|
||||||
"LightSnow": [
|
"LightSnow": [
|
||||||
"\033[38;5;250m .-. \033[0m",
|
'<span foreground=\"#BBBBBB\"> .-. </span>',
|
||||||
"\033[38;5;250m ( ). \033[0m",
|
'<span foreground=\"#BBBBBB\"> ( ). </span>',
|
||||||
"\033[38;5;250m (___(__) \033[0m",
|
'<span foreground=\"#BBBBBB\"> (___(__) </span>',
|
||||||
"\033[38;5;255m * * * \033[0m",
|
'<span foreground=\"#eeeeee\";"> * * * </span>',
|
||||||
"\033[38;5;255m * * * \033[0m"],
|
'<span foreground=\"#eeeeee\";"> * * * </span>'],
|
||||||
"HeavySnow": [
|
"HeavySnow": [
|
||||||
"\033[38;5;240;1m .-. \033[0m",
|
'<span foreground=\"#585858\"; font-weight: bold;"> .-. </span>',
|
||||||
"\033[38;5;240;1m ( ). \033[0m",
|
'<span foreground=\"#585858\"; font-weight: bold;"> ( ). </span>',
|
||||||
"\033[38;5;240;1m (___(__) \033[0m",
|
'<span foreground=\"#585858\"; font-weight: bold;"> (___(__) </span>',
|
||||||
"\033[38;5;255;1m * * * * \033[0m",
|
'<span foreground=\"#eeeeee\"; font-weight: bold;"> * * * * </span>',
|
||||||
"\033[38;5;255;1m * * * * \033[0m"],
|
'<span foreground=\"#eeeeee\"; font-weight: bold;"> * * * * </span>'],
|
||||||
"LightSleet": [
|
"LightSleet": [
|
||||||
"\033[38;5;250m .-. \033[0m",
|
'<span foreground=\"#BBBBBB\"> .-. </span>',
|
||||||
"\033[38;5;250m ( ). \033[0m",
|
'<span foreground=\"#BBBBBB\"> ( ). </span>',
|
||||||
"\033[38;5;250m (___(__) \033[0m",
|
'<span foreground=\"#BBBBBB\"> (___(__) </span>',
|
||||||
"\033[38;5;111m ‘ \033[38;5;255m*\033[38;5;111m ‘ \033[38;5;255m* \033[0m",
|
'<span foreground=\"#87afff\";"> ‘ </span>"<span foreground=\"#eeeeee\";">*</span>"<span foreground=\"#87afff\";"> ‘ </span>"<span foreground=\"#eeeeee\";">* </span>',
|
||||||
"\033[38;5;255m *\033[38;5;111m ‘ \033[38;5;255m*\033[38;5;111m ‘ \033[0m"],
|
'<span foreground=\"#eeeeee\";"> *</span>"<span foreground=\"#87afff\";"> ‘ </span>"<span foreground=\"#eeeeee\";">*</span>"<span foreground=\"#87afff\";"> ‘ </span>'],
|
||||||
"Fog": [
|
"Fog": [
|
||||||
" ",
|
' ',
|
||||||
"\033[38;5;251m _ - _ - _ - \033[0m",
|
'<span foreground=\"#c0c0c0\";"> _ - _ - _ - </span>',
|
||||||
"\033[38;5;251m _ - _ - _ \033[0m",
|
'<span foreground=\"#c0c0c0\";"> _ - _ - _ </span>',
|
||||||
"\033[38;5;251m _ - _ - _ - \033[0m",
|
'<span foreground=\"#c0c0c0\";"> _ - _ - _ - </span>',
|
||||||
" "],
|
' '],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WEATHER_CODES_WEGO = {key: WEATHER_SYMBOL_WEGO[value] for key, value in WWO_CODE.items()}
|
||||||
|
|
||||||
data = {}
|
data = {}
|
||||||
|
|
||||||
|
|
||||||
weather = requests.get("https://wttr.in/?u&format=j1").json()
|
|
||||||
moon = requests.get("https://wttr.in/?format=%m").text
|
|
||||||
|
|
||||||
|
|
||||||
def format_time(time):
|
def format_time(time):
|
||||||
|
"""get the time formatted"""
|
||||||
return datetime.strptime(format_24_time(time), "%H").strftime("%I %p")
|
return datetime.strptime(format_24_time(time), "%H").strftime("%I %p")
|
||||||
|
|
||||||
def format_24_time(time):
|
def format_24_time(time):
|
||||||
|
"""get the time formatted"""
|
||||||
return time.replace("00", "").zfill(2)
|
return time.replace("00", "").zfill(2)
|
||||||
|
|
||||||
|
|
||||||
def format_temp(temp):
|
def format_temp(temp):
|
||||||
return (hour["FeelsLikeF"] + "°").ljust(3)
|
"""get the temp formatted"""
|
||||||
|
return (temp + "°").ljust(3)
|
||||||
|
|
||||||
|
|
||||||
def format_chances(hour):
|
def format_chances(hour):
|
||||||
|
"""get the chances formatted"""
|
||||||
chances = {
|
chances = {
|
||||||
"chanceoffog": "Fog",
|
"chanceoffog": "Fog",
|
||||||
"chanceoffrost": "Frost",
|
"chanceoffrost": "Frost",
|
||||||
@@ -326,60 +302,130 @@ let
|
|||||||
}
|
}
|
||||||
|
|
||||||
conditions = []
|
conditions = []
|
||||||
for event in chances.keys():
|
for chance, event in chances.items():
|
||||||
if int(hour[event]) > 0:
|
if int(hour[chance]) > 0:
|
||||||
conditions.append(chances[event] + " " + hour[event] + "%")
|
conditions.append(event + " " + hour[chance] + "%")
|
||||||
return ", ".join(conditions)
|
return ", ".join(conditions)
|
||||||
|
|
||||||
|
def build_text(current_condition):
|
||||||
|
"""build the text string"""
|
||||||
|
feels_like_f = current_condition["FeelsLikeF"]
|
||||||
|
weather_code = current_condition["weatherCode"]
|
||||||
|
|
||||||
tempint = int(weather["current_condition"][0]["FeelsLikeF"])
|
tempint = int(feels_like_f)
|
||||||
extrachar = ""
|
extrachar = ""
|
||||||
if tempint > 0 and tempint < 10:
|
if 0 < tempint < 10:
|
||||||
extrachar = "+"
|
extrachar = "+"
|
||||||
|
|
||||||
|
current_weather = f"{WEATHER_CODES[weather_code]} {extrachar} {feels_like_f}°F"
|
||||||
|
|
||||||
data["text"] = (
|
return current_weather
|
||||||
" "
|
|
||||||
+ WEATHER_CODES[weather["current_condition"][0]["weatherCode"]]
|
|
||||||
+ " "
|
|
||||||
+ extrachar
|
|
||||||
+ weather["current_condition"][0]["FeelsLikeF"]
|
|
||||||
+ "°F"
|
|
||||||
)
|
|
||||||
|
|
||||||
data["tooltip"] = (
|
def build_tooltip(current_condition, astronomy, moon_icon):
|
||||||
f"<b>{weather['current_condition'][0]['weatherDesc'][0]['value']} {weather['current_condition'][0]['temp_F']}°</b>\n"
|
"""build the tooltip text"""
|
||||||
)
|
weather_description = current_condition['weatherDesc'][0]['value']
|
||||||
data["tooltip"] += f"Feels like: {weather['current_condition'][0]['FeelsLikeF']}°\n"
|
feels_like_f = current_condition["FeelsLikeF"]
|
||||||
data["tooltip"] += f"Wind: {weather['current_condition'][0]['windspeedMiles']}mph\n"
|
temp_f = current_condition['temp_F']
|
||||||
data["tooltip"] += f"Humidity: {weather['current_condition'][0]['humidity']}%\n"
|
humidity = current_condition['humidity']
|
||||||
data["tooltip"] += f"Moon phase: {weather["weather"][0]['astronomy'][0]['moon_phase']} " + moon + "\n"
|
wind_speed = current_condition['windspeedMiles']
|
||||||
for i, day in enumerate(weather["weather"]):
|
wind_dir = current_condition['winddir16Point']
|
||||||
data["tooltip"] += f"\n<b>"
|
moon_phase = astronomy['moon_phase']
|
||||||
if i == 0:
|
wego = WEATHER_CODES_WEGO[current_condition['weatherCode']]
|
||||||
data["tooltip"] += "Today, "
|
|
||||||
if i == 1:
|
tooltip = f"{wego[0]}{weather_description} {temp_f}°\n"
|
||||||
data["tooltip"] += "Tomorrow, "
|
tooltip += f"{wego[1]}Feels like: {feels_like_f}°\n"
|
||||||
date = datetime.strptime(day['date'], "%Y-%m-%d").strftime("%a %b %d %Y")
|
tooltip += f"{wego[2]}Wind: {wind_speed}mph {WIND_DIRECTION[wind_dir]}\n"
|
||||||
data["tooltip"] += f"{date}</b>\n"
|
tooltip += f"{wego[3]}Humidity: {humidity}%\n"
|
||||||
data["tooltip"] += f" {day['maxtempF']}°F {day['mintempF']}°F"
|
tooltip += f"{wego[4]}Moon phase: {moon_phase} " + moon_icon + "\n"
|
||||||
data[
|
|
||||||
"tooltip"
|
return tooltip
|
||||||
] += f" {day['astronomy'][0]['sunrise']} {day['astronomy'][0]['sunset']}\n"
|
|
||||||
for hour in day["hourly"]:
|
def build_forecast(weather):
|
||||||
|
"""build a 3 day forecast"""
|
||||||
|
tooltip = "\n"
|
||||||
|
|
||||||
|
for i, day in enumerate(weather):
|
||||||
|
# determine day
|
||||||
if i == 0:
|
if i == 0:
|
||||||
if int(format_24_time(hour["time"])) < datetime.now().hour - 2:
|
tooltip += "Today, "
|
||||||
|
if i == 1:
|
||||||
|
tooltip += "Tomorrow, "
|
||||||
|
# format the date
|
||||||
|
date = datetime.strptime(day['date'], "%Y-%m-%d").strftime("%a %b %d %Y")
|
||||||
|
tooltip += f"<b>{date}</b>\n"
|
||||||
|
# set the high and low
|
||||||
|
max_temp = day['maxtempF']
|
||||||
|
min_temp = day['mintempF']
|
||||||
|
tooltip += f" {max_temp}°F {min_temp}°F"
|
||||||
|
|
||||||
|
sunrise = day['astronomy'][0]['sunrise']
|
||||||
|
sunset = day['astronomy'][0]['sunset']
|
||||||
|
tooltip += f" {sunrise} {sunset}\n"
|
||||||
|
|
||||||
|
tooltip += build_hourly_forecast(i, day['hourly'], sunrise, sunset)
|
||||||
|
return tooltip
|
||||||
|
|
||||||
|
|
||||||
|
def build_hourly_forecast(day_num, hourly, sunrise, sunset):
|
||||||
|
"""build an hourly forecast"""
|
||||||
|
sunrise_hour = datetime.strptime(sunrise, "%I:%M %p").hour
|
||||||
|
sunset_hour = datetime.strptime(sunset, "%I:%M %p").hour
|
||||||
|
current_hour = datetime.now().hour
|
||||||
|
tooltip = ""
|
||||||
|
|
||||||
|
for hour in hourly:
|
||||||
|
time_24_hr = int(format_24_time(hour["time"]))
|
||||||
|
|
||||||
|
if day_num == 0:
|
||||||
|
if time_24_hr < current_hour - 2:
|
||||||
continue
|
continue
|
||||||
if int(format_24_time(hour["time"])) > datetime.strptime(day['astronomy'][0]['sunset'], "%I:%M %p").hour or int(format_24_time(hour["time"])) < datetime.strptime(day['astronomy'][0]['sunrise'], "%I:%M %p").hour:
|
|
||||||
|
# determine which code to use
|
||||||
|
if is_night_hour(time_24_hr, sunrise_hour, sunset_hour):
|
||||||
codes = WEATHER_CODES_WI_NIGHT
|
codes = WEATHER_CODES_WI_NIGHT
|
||||||
else:
|
else:
|
||||||
codes = WEATHER_CODES_WI_DAY
|
codes = WEATHER_CODES_WI_DAY
|
||||||
data[
|
|
||||||
"tooltip"
|
|
||||||
] += f"{format_time(hour['time'])} {codes[hour['weatherCode']]} {format_temp(hour['FeelsLikeF'])} {hour['weatherDesc'][0]['value']}, {format_chances(hour)}\n"
|
|
||||||
|
|
||||||
|
current_time = format_time(hour['time'])
|
||||||
|
current_weather_code = codes[hour['weatherCode']]
|
||||||
|
feels_like = format_temp(hour['FeelsLikeF'])
|
||||||
|
weather_desc = hour['weatherDesc'][0]['value']
|
||||||
|
current_chances = format_chances(hour)
|
||||||
|
|
||||||
print(json.dumps(data))
|
tooltip += f"{current_time} {current_weather_code} "
|
||||||
|
tooltip += f"{feels_like} {weather_desc}, {current_chances}\n"
|
||||||
|
|
||||||
|
return tooltip
|
||||||
|
|
||||||
|
def is_night_hour(time_24_hr, sunrise_hour, sunset_hour):
|
||||||
|
"""returns true if the hour is night"""
|
||||||
|
before_sunrise = time_24_hr < sunrise_hour
|
||||||
|
after_sunset = time_24_hr > sunset_hour
|
||||||
|
return after_sunset or before_sunrise
|
||||||
|
|
||||||
|
def get_wttr_json():
|
||||||
|
"""get the weather json"""
|
||||||
|
weather = requests.get("https://wttr.in/?u&format=j1", timeout=30).json()
|
||||||
|
moon = requests.get("https://wttr.in/?format=%m", timeout=30)
|
||||||
|
moon_icon = moon.text
|
||||||
|
|
||||||
|
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"])
|
||||||
|
|
||||||
|
return json.dumps(data)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""main"""
|
||||||
|
try:
|
||||||
|
print(get_wttr_json())
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
main()
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ in
|
|||||||
{
|
{
|
||||||
size = "200, 50";
|
size = "200, 50";
|
||||||
position = "0, -80";
|
position = "0, -80";
|
||||||
monitor = settings.displayLeft.input;
|
monitor = hyprlandSettings.primaryDisplay.input;
|
||||||
dots_center = true;
|
dots_center = true;
|
||||||
fade_on_empty = true;
|
fade_on_empty = true;
|
||||||
font_color = "rgb(202, 211, 245)";
|
font_color = "rgb(202, 211, 245)";
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
clinfo
|
clinfo
|
||||||
cpufetch
|
cpufetch
|
||||||
deadnix
|
deadnix
|
||||||
direnv
|
|
||||||
firefox
|
firefox
|
||||||
gamescope
|
gamescope
|
||||||
gamescope-wsi
|
gamescope-wsi
|
||||||
|
|||||||
@@ -14,27 +14,30 @@ let
|
|||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
programs.vscode = {
|
programs = {
|
||||||
enable = true;
|
vscode = {
|
||||||
package = pkgs.vscodium;
|
enable = true;
|
||||||
mutableExtensionsDir = false;
|
package = pkgs.vscodium;
|
||||||
profiles = {
|
mutableExtensionsDir = false;
|
||||||
default = {
|
profiles = {
|
||||||
enableUpdateCheck = false;
|
default = {
|
||||||
enableExtensionUpdateCheck = false;
|
enableUpdateCheck = false;
|
||||||
extensions = with pkgs; [
|
enableExtensionUpdateCheck = false;
|
||||||
vscode-extensions.bbenoist.nix
|
extensions = with pkgs; [
|
||||||
vscode-extensions.brettm12345.nixfmt-vscode
|
vscode-extensions.arrterian.nix-env-selector
|
||||||
vscode-extensions.cweijan.vscode-database-client2
|
vscode-extensions.bbenoist.nix
|
||||||
vscode-extensions.dendron.dendron-markdown-preview-enhanced
|
vscode-extensions.brettm12345.nixfmt-vscode
|
||||||
vscode-extensions.jnoortheen.nix-ide
|
vscode-extensions.cweijan.vscode-database-client2
|
||||||
vscode-extensions.ms-python.debugpy
|
vscode-extensions.dendron.dendron-markdown-preview-enhanced
|
||||||
vscode-extensions.ms-python.pylint
|
vscode-extensions.jnoortheen.nix-ide
|
||||||
vscode-extensions.ms-python.python
|
vscode-extensions.mkhl.direnv
|
||||||
# vscode-extensions.ms-python.vscode-pylance
|
vscode-extensions.ms-python.debugpy
|
||||||
vscode-extensions.redhat.vscode-xml
|
vscode-extensions.ms-python.pylint
|
||||||
vscode-extensions.redhat.vscode-yaml
|
vscode-extensions.ms-python.python
|
||||||
vscode-extensions.yy0931.vscode-sqlite3-editor
|
# vscode-extensions.ms-python.vscode-pylance
|
||||||
|
vscode-extensions.redhat.vscode-xml
|
||||||
|
vscode-extensions.redhat.vscode-yaml
|
||||||
|
vscode-extensions.yy0931.vscode-sqlite3-editor
|
||||||
|
|
||||||
# open-remote-ssh
|
# open-remote-ssh
|
||||||
nix-vscode-extensions.open-vsx.jeanp413.open-remote-ssh
|
nix-vscode-extensions.open-vsx.jeanp413.open-remote-ssh
|
||||||
@@ -59,81 +62,87 @@ in
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
userSettings = {
|
userSettings = {
|
||||||
|
|
||||||
"editor" = {
|
"editor" = {
|
||||||
"defaultFormatter" = "brettm12345.nixfmt-vscode";
|
"defaultFormatter" = "brettm12345.nixfmt-vscode";
|
||||||
"fontFamily" = "fira-code-nerd, FiraCode Nerd Font, Consolas, 'Courier New', monospace";
|
"fontFamily" = "fira-code-nerd, FiraCode Nerd Font, Consolas, 'Courier New', monospace";
|
||||||
"fontLigatures" = true;
|
"fontLigatures" = true;
|
||||||
"renderWhitespace" = "all";
|
"renderWhitespace" = "all";
|
||||||
};
|
|
||||||
|
|
||||||
"explorer" = {
|
|
||||||
"confirmDelete" = false;
|
|
||||||
"confirmDragAndDrop" = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
"git" = {
|
|
||||||
"confirmSync" = false;
|
|
||||||
"enableSmartCommit" = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
"github" = {
|
|
||||||
"copilot.nextEditSuggestions.enabled" = true;
|
|
||||||
"copilot.enable" = {
|
|
||||||
"nix" = true;
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
"[json]" = {
|
"explorer" = {
|
||||||
"editor.defaultFormatter" = "vscode.json-language-features";
|
"confirmDelete" = false;
|
||||||
};
|
"confirmDragAndDrop" = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
"git" = {
|
||||||
|
"confirmSync" = false;
|
||||||
|
"enableSmartCommit" = true;
|
||||||
|
};
|
||||||
|
|
||||||
"nix" = {
|
"github" = {
|
||||||
"enableLanguageServer" = true;
|
"copilot.nextEditSuggestions.enabled" = true;
|
||||||
"formatterPath" = "nixpkgs-fmt";
|
"copilot.enable" = {
|
||||||
"serverPath" = "nixd";
|
"nix" = true;
|
||||||
"serverSettings" = {
|
};
|
||||||
"nixd" = {
|
};
|
||||||
"formatting" = {
|
|
||||||
"command" = [ "nixpkgs-fmt" ];
|
"[json]" = {
|
||||||
};
|
"editor.defaultFormatter" = "vscode.json-language-features";
|
||||||
"options" = {
|
};
|
||||||
# By default, this entriy will be read from `import <nixpkgs> { }`.
|
|
||||||
# You can write arbitary Nix expressions here, to produce valid "options" declaration result.
|
"nix" = {
|
||||||
# Tip: for flake-based configuration, utilize `builtins.getFlake`
|
"enableLanguageServer" = true;
|
||||||
"nixos" = {
|
"formatterPath" = "nixpkgs-fmt";
|
||||||
"expr" = "(builtins.getFlake \"${config.home.homeDirectory}/nix-config\").nixosConfigurations.<name>.options";
|
"serverPath" = "nixd";
|
||||||
|
"serverSettings" = {
|
||||||
|
"nixd" = {
|
||||||
|
"formatting" = {
|
||||||
|
"command" = [ "nixpkgs-fmt" ];
|
||||||
};
|
};
|
||||||
"home-manager" = {
|
"options" = {
|
||||||
"expr" = "(builtins.getFlake \"${config.home.homeDirectory}/nix-config\").homeConfigurations.<name>.options";
|
# By default, this entriy will be read from `import <nixpkgs> { }`.
|
||||||
|
# You can write arbitary Nix expressions here, to produce valid "options" declaration result.
|
||||||
|
# Tip: for flake-based configuration, utilize `builtins.getFlake`
|
||||||
|
"nixos" = {
|
||||||
|
"expr" = "(builtins.getFlake \"${config.home.homeDirectory}/nix-config\").nixosConfigurations.<name>.options";
|
||||||
|
};
|
||||||
|
"home-manager" = {
|
||||||
|
"expr" = "(builtins.getFlake \"${config.home.homeDirectory}/nix-config\").homeConfigurations.<name>.options";
|
||||||
|
};
|
||||||
|
# # Tip: use ${workspaceFolder} variable to define path
|
||||||
|
# "nix-darwin" = {
|
||||||
|
# "expr" = "(builtins.getFlake \"${workspaceFolder}/path/to/flake\").darwinConfigurations.<name>.options"
|
||||||
|
# }
|
||||||
};
|
};
|
||||||
# # Tip: use ${workspaceFolder} variable to define path
|
|
||||||
# "nix-darwin" = {
|
|
||||||
# "expr" = "(builtins.getFlake \"${workspaceFolder}/path/to/flake\").darwinConfigurations.<name>.options"
|
|
||||||
# }
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
"[nix]" = {
|
"[nix]" = {
|
||||||
"editor" = {
|
"editor" = {
|
||||||
"defaultFormatter" = "brettm12345.nixfmt-vscode";
|
"defaultFormatter" = "brettm12345.nixfmt-vscode";
|
||||||
"tabSize" = 2;
|
"tabSize" = 2;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
"security.workspace.trust.untrustedFiles" = "open";
|
"security.workspace.trust.untrustedFiles" = "open";
|
||||||
|
|
||||||
"workbench" = {
|
"workbench" = {
|
||||||
"colorCustomizations" = null;
|
"colorCustomizations" = null;
|
||||||
"editorAssociations" = {
|
"editorAssociations" = {
|
||||||
"*.db" = "default";
|
"*.db" = "default";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
direnv = {
|
||||||
|
enable = true;
|
||||||
|
nix-direnv.enable = true;
|
||||||
|
enableZshIntegration = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user