diff --git a/.gitignore b/.gitignore index 58ac354..e546427 100755 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,9 @@ hosts/nas/*.conf hosts/nas/*.users result *.raw -.codegpt \ No newline at end of file +.codegpt +.direnv +shell.nix +.vscode +**/*/*.py +.envrc \ No newline at end of file diff --git a/flake.lock b/flake.lock index 7d63614..4dc25fb 100755 --- a/flake.lock +++ b/flake.lock @@ -296,6 +296,24 @@ "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": false, "locked": { @@ -1571,6 +1589,22 @@ "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": { "inputs": { "nixpkgs": [ diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/configuration.nix index 5c2007d..85a7ed4 100755 --- a/hosts/desktop/configuration.nix +++ b/hosts/desktop/configuration.nix @@ -5,6 +5,7 @@ { lib, pkgs, + inputs, ... }: let @@ -48,6 +49,8 @@ let udisks2 unzip winetricks + + inputs.desktop-lsfg.packages."x86_64-linux".default ]; in { @@ -116,6 +119,7 @@ in # Virtualisation configuration virtualisation = { libvirtd.enable = lib.mkDefault true; + podman.enable = true; waydroid.enable = lib.mkDefault true; }; diff --git a/hosts/desktop/home.nix b/hosts/desktop/home.nix index 1509374..89b8beb 100755 --- a/hosts/desktop/home.nix +++ b/hosts/desktop/home.nix @@ -43,6 +43,7 @@ in bottles unstable.compose2nix discord + distrobox heroic stable.vmware-horizon-client jq diff --git a/hosts/desktop/hyprland-settings.nix b/hosts/desktop/hyprland-settings.nix index 92eaecb..55fe079 100644 --- a/hosts/desktop/hyprland-settings.nix +++ b/hosts/desktop/hyprland-settings.nix @@ -19,6 +19,9 @@ let }; in { + primaryDisplay = displayLeft; + networkInterface = "wlp9s0"; + wallpaper = [ "${displayLeft.input}, /run/wallpaper.jpg" "${displayRight.input}, /run/wallpaper.jpg" @@ -61,6 +64,7 @@ in "wireplumber#sink" "wireplumber#source" "bluetooth" + "network" "idle_inhibitor" "clock" "custom/weather" diff --git a/hosts/desktop/services.nix b/hosts/desktop/services.nix index fd1bbb3..dffc576 100755 --- a/hosts/desktop/services.nix +++ b/hosts/desktop/services.nix @@ -79,7 +79,7 @@ in ratbagd.enable = lib.mkDefault true; keyd = { - enable = true; + enable = false; keyboards = { default = { ids = [ "*" ]; diff --git a/hosts/homeassistant/homeassistant.nix b/hosts/homeassistant/homeassistant.nix index 18e72a1..983efa2 100755 --- a/hosts/homeassistant/homeassistant.nix +++ b/hosts/homeassistant/homeassistant.nix @@ -2,7 +2,7 @@ let mosquittoPort = 1883; zigbee2mqttPort = 8080; - # "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" + ha-bambulab = pkgs.stdenv.mkDerivation { pname = "ha-bambulab"; version = "v2.1.5"; # Update with correct version diff --git a/hosts/mac-nixos/hyprland-settings.nix b/hosts/mac-nixos/hyprland-settings.nix index 896689c..603f1e4 100644 --- a/hosts/mac-nixos/hyprland-settings.nix +++ b/hosts/mac-nixos/hyprland-settings.nix @@ -1,13 +1,23 @@ let theme = import ../../modules/desktop-environments/hyprland/theme.nix; + + # Displays + display = { + input = "eDP-1"; + resolution = "3456x2234"; + refreshRate = "60.00000"; + }; in { + primaryDisplay = display; + networkInterface = "wlan0"; + wallpaper = [ - "eDP-1, /run/wallpaper.jpg" + "${display.input}, /run/wallpaper.jpg" ]; 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 = { @@ -19,9 +29,9 @@ in # }; workspace = [ - "name:firefox, monitor:eDP-1, default:false, special, class:(.*firefox.*)" - "name:discord, monitor:eDP-1, default:true, special, title:(.*vesktop.*), title:(.*Apple Music.*)" - "name:steam, monitor:eDP-1, default:false, special, class:(.*[Ss]team.*)" + "name:firefox, monitor:${display.input}, default:false, special, class:(.*firefox.*)" + "name:discord, monitor:${display.input}, default:true, special, title:(.*vesktop.*), title:(.*Apple Music.*)" + "name:steam, monitor:${display.input}, default:false, special, class:(.*[Ss]team.*)" ]; windowRule = [ diff --git a/hosts/pi5/configuration.nix b/hosts/pi5/configuration.nix index fa25295..b532427 100755 --- a/hosts/pi5/configuration.nix +++ b/hosts/pi5/configuration.nix @@ -16,7 +16,7 @@ in ./services.nix ./sops.nix ../../modules/desktop-environments/hyprland -# ./hass.nix + ./hass.nix ]; # Enable nix flakes and nix-command tools diff --git a/modules/desktop-environments/hyprland/config/hypr/default.nix b/modules/desktop-environments/hyprland/config/hypr/default.nix index e9c29c8..86171aa 100755 --- a/modules/desktop-environments/hyprland/config/hypr/default.nix +++ b/modules/desktop-environments/hyprland/config/hypr/default.nix @@ -210,6 +210,9 @@ in "float, class:(.*FileRoller.*)" "float, class:(.*wlogout.*)" "idleinhibit stayfocused, title:(.*mpv.*)" + + "float, class:(.*nm-connection-editor.*)" + "move onscreen cursor 0% 0%, class:(.*nm-connection-editor.*)" "float, title:(Media viewer)" "float, class:(it.mijorus.smile),title:(Smile)" diff --git a/modules/desktop-environments/hyprland/config/waybar/default.nix b/modules/desktop-environments/hyprland/config/waybar/default.nix index 736eceb..6282966 100755 --- a/modules/desktop-environments/hyprland/config/waybar/default.nix +++ b/modules/desktop-environments/hyprland/config/waybar/default.nix @@ -151,30 +151,45 @@ in "bluetooth" = { on-click = "overskride"; tooltip = true; - format = "{format-off}"; - format-disabled = "󰂲"; - format-off = "󰂲"; - format-on = "󰂯"; - format-connected = "󰂱"; + format = "{icon}"; tooltip-format = "{status}"; tooltip-format-disabled = "{status}"; tooltip-format-off = "{status}"; tooltip-format-on = "{status}"; tooltip-format-connected = "{status}"; tooltip-format-enumerate-connected = { }; + format-icons = { + disabled = "󰂲"; + off = "󰂲"; + on = "󰂯"; + connected = "󰂱"; + }; }; network = { - interface = "wlan0"; - format = "{ifname}"; - format-wifi = ""; # "{essid} ({signalStrength}%) "; - format-ethernet = "󰊗"; # "{ipaddr}/{cidr} 󰊗"; - format-disconnected = "" ; # An empty format will hide the module. + interface = hyprlandSettings.networkInterface; + on-click = "nm-connection-editor"; + format = "{icon}"; tooltip-format = "{ifname} via {gwaddr} 󰊗"; - tooltip-format-wifi = "{essid} ({signalStrength}%) "; + tooltip-format-wifi = '' + {essid} ({signalStrength}%) {icon} +  {bandwidthDownBits}  {bandwidthUpBits} + ''; tooltip-format-ethernet = "{ifname} "; tooltip-format-disconnected = "Disconnected"; max-length = 50; + format-icons = { + wifi = [ + "󰤯" + "󰤟" + "󰤢" + "󰤥" + "󰤨" + ]; + ethernet = "󰈀"; + linked = "󰤫"; + disconnected = "󰤫"; + }; }; idle_inhibitor = { @@ -245,6 +260,7 @@ in interval = 30; exec = "waybar-weather"; return-type = "json"; + markup = "pango"; }; } // hyprlandSettings.waybar.extraModules or { }; }; @@ -253,6 +269,16 @@ in # window.eDP-1 * { font-size: 10px; } style = '' + .blink_me { + animation: blinker 1s linear infinite; + } + + @keyframes blinker { + 50% { + color: ${settings.theme.nord.aurora.nord11}; + } + } + * { font-family: Jetbrains Mono Nerd Font, @@ -321,6 +347,11 @@ in 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 { color: ${settings.theme.nord.frost.nord10}; background-color: ${settings.theme.nord.polarNight.nord0}; @@ -367,6 +398,10 @@ in padding-right: 15px; } + #network:hover { + background: ${settings.theme.nord.polarNight.nord3}; + } + #bluetooth { color: ${settings.theme.nord.frost.nord9}; background-color: ${settings.theme.nord.polarNight.nord0}; @@ -387,6 +422,14 @@ in 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 { background: ${settings.theme.nord.polarNight.nord3}; } @@ -399,6 +442,13 @@ in border-radius: 0; } + #wireplumber.sink.muted { + animation-name: blinker; + animation-duration: 5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + } + #wireplumber.sink:hover { background: ${settings.theme.nord.polarNight.nord3}; } diff --git a/modules/desktop-environments/hyprland/config/waybar/scripts/weather.nix b/modules/desktop-environments/hyprland/config/waybar/scripts/weather.nix index 6dccd84..a15e807 100644 --- a/modules/desktop-environments/hyprland/config/waybar/scripts/weather.nix +++ b/modules/desktop-environments/hyprland/config/waybar/scripts/weather.nix @@ -5,8 +5,11 @@ let #! nix-shell -i python3 --pure #! nix-shell -p python3 python3Packages.requests + """get waybar weather""" + import os import json - from datetime import datetime + import shutil + from datetime import datetime, timedelta import requests @@ -61,58 +64,43 @@ let "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 = { - "Unknown": "✨", - "Cloudy": "☁️", - "Fog": "🌫", - "HeavyRain": "🌧", - "HeavyShowers": "🌧", - "HeavySnow": "❄️", - "HeavySnowShowers": "❄️", - "LightRain": "🌦", - "LightShowers": "🌦", - "LightSleet": "🌧", - "LightSleetShowers": "🌧", - "LightSnow": "🌨", - "LightSnowShowers": "🌨", - "PartlyCloudy": "⛅️", - "Sunny": "☀️", - "ThunderyHeavyRain": "🌩", - "ThunderyShowers": "⛈", - "ThunderySnowShowers": "⛈", - "VeryCloudy": "☁️", + "Unknown": "", + "Cloudy": "", + "Fog": "", + "HeavyRain": "", + "HeavyShowers": "", + "HeavySnow": "", + "HeavySnowShowers": "", + "LightRain": "", + "LightShowers": "", + "LightSleet": "", + "LightSleetShowers": "", + "LightSnow": "", + "LightSnowShowers": "", + "PartlyCloudy": "󰖕", + "Sunny": "", + "ThunderyHeavyRain": "", + "ThunderyShowers": "", + "ThunderySnowShowers": "", + "VeryCloudy": "", } 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 = ( - "🌑", "🌒", "🌓", "🌔", "🌕", "🌖", "🌗", "🌘" + "󰽤", "󰽧", "󰽡", "󰽨", "󰽢", "󰽦", "󰽣", "󰽥" ) WEATHER_SYMBOL_WI_DAY = { @@ -129,7 +117,7 @@ let "LightSleetShowers": "", "LightSnow": "", "LightSnowShowers": "", - "PartlyCloudy": "", + "PartlyCloudy": "󰖕", "Sunny": "", "ThunderyHeavyRain": "", "ThunderyShowers": "", @@ -153,8 +141,8 @@ let "LightSleetShowers": "", "LightSnow": "", "LightSnowShowers": "", - "PartlyCloudy": "", - "Sunny": "", + "PartlyCloudy": "󰼱", + "Sunny": "󰖔", "ThunderyHeavyRain": "", "ThunderyShowers": "", "ThunderySnowShowers": "", @@ -163,21 +151,6 @@ let 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 = { "Unknown": [ " .-. ", @@ -186,134 +159,137 @@ let " `-’ ", " • "], "Sunny": [ - "\033[38;5;226m \\ / \033[0m", - "\033[38;5;226m .-. \033[0m", - "\033[38;5;226m ― ( ) ― \033[0m", - "\033[38;5;226m `-’ \033[0m", - "\033[38;5;226m / \\ \033[0m"], + ' \\ / ', + ' .-. ', + ' ― ( ) ― ', + ' `-’ ', + ' / \\ '], "PartlyCloudy": [ - "\033[38;5;226m \\ /\033[0m ", - "\033[38;5;226m _ /\"\"\033[38;5;250m.-. \033[0m", - "\033[38;5;226m \\_\033[38;5;250m( ). \033[0m", - "\033[38;5;226m /\033[38;5;250m(___(__) \033[0m", - " "], + ' \\ / ', + ' _ /\'\'".-. ', + ' \\_"( ). ', + ' /"(___(__) ', + ' ' + ], "Cloudy": [ - " ", - "\033[38;5;250m .--. \033[0m", - "\033[38;5;250m .-( ). \033[0m", - "\033[38;5;250m (___.__)__) \033[0m", - " "], + ' ', + ' .--. ', + ' .-( ). ', + ' (___.__)__) ', + ' '], "VeryCloudy": [ - " ", - "\033[38;5;240;1m .--. \033[0m", - "\033[38;5;240;1m .-( ). \033[0m", - "\033[38;5;240;1m (___.__)__) \033[0m", - " "], + ' ', + ' .--. ', + ' .-( ). ', + ' (___.__)__) ', + ' '], "LightShowers": [ - "\033[38;5;226m _`/\"\"\033[38;5;250m.-. \033[0m", - "\033[38;5;226m ,\\_\033[38;5;250m( ). \033[0m", - "\033[38;5;226m /\033[38;5;250m(___(__) \033[0m", - "\033[38;5;111m ‘ ‘ ‘ ‘ \033[0m", - "\033[38;5;111m ‘ ‘ ‘ ‘ \033[0m"], + ' _`/\'\'".-. ', + ' ,\\_"( ). ', + ' /"(___(__) ', + ' ‘ ‘ ‘ ‘ ', + ' ‘ ‘ ‘ ‘ '], "HeavyShowers": [ - "\033[38;5;226m _`/\"\"\033[38;5;240;1m.-. \033[0m", - "\033[38;5;226m ,\\_\033[38;5;240;1m( ). \033[0m", - "\033[38;5;226m /\033[38;5;240;1m(___(__) \033[0m", - "\033[38;5;21;1m ‚‘‚‘‚‘‚‘ \033[0m", - "\033[38;5;21;1m ‚’‚’‚’‚’ \033[0m"], + ' _`/\'\'".-. ', + ' ,\\_"( ). ', + ' /"(___(__) ', + ' ‚‘‚‘‚‘‚‘ ', + ' ‚’‚’‚’‚’ '], "LightSnowShowers": [ - "\033[38;5;226m _`/\"\"\033[38;5;250m.-. \033[0m", - "\033[38;5;226m ,\\_\033[38;5;250m( ). \033[0m", - "\033[38;5;226m /\033[38;5;250m(___(__) \033[0m", - "\033[38;5;255m * * * \033[0m", - "\033[38;5;255m * * * \033[0m"], + ' _`/\'\'".-. ', + ' ,\\_"( ). ', + ' /"(___(__) ', + ' * * * ', + ' * * * '], "HeavySnowShowers": [ - "\033[38;5;226m _`/\"\"\033[38;5;240;1m.-. \033[0m", - "\033[38;5;226m ,\\_\033[38;5;240;1m( ). \033[0m", - "\033[38;5;226m /\033[38;5;240;1m(___(__) \033[0m", - "\033[38;5;255;1m * * * * \033[0m", - "\033[38;5;255;1m * * * * \033[0m"], + ' _`/\'\'".-. ', + ' ,\\_"( ). ', + ' /"(___(__) ', + ' * * * * ', + ' * * * * '], "LightSleetShowers": [ - "\033[38;5;226m _`/\"\"\033[38;5;250m.-. \033[0m", - "\033[38;5;226m ,\\_\033[38;5;250m( ). \033[0m", - "\033[38;5;226m /\033[38;5;250m(___(__) \033[0m", - "\033[38;5;111m ‘ \033[38;5;255m*\033[38;5;111m ‘ \033[38;5;255m* \033[0m", - "\033[38;5;255m *\033[38;5;111m ‘ \033[38;5;255m*\033[38;5;111m ‘ \033[0m"], + ' _`/\'\'".-. ', + ' ,\\_"( ). ', + ' /"(___(__) ', + '"*""* ', + ' *""*"'], "ThunderyShowers": [ - "\033[38;5;226m _`/\"\"\033[38;5;250m.-. \033[0m", - "\033[38;5;226m ,\\_\033[38;5;250m( ). \033[0m", - "\033[38;5;226m /\033[38;5;250m(___(__) \033[0m", - "\033[38;5;228;5m ⚡\033[38;5;111;25m‘ ‘\033[38;5;228;5m⚡\033[38;5;111;25m‘ ‘ \033[0m", - "\033[38;5;111m ‘ ‘ ‘ ‘ \033[0m"], + ' _`/\'\'".-. ', + ' ,\\_"( ). ', + ' /"(___(__) ', + ' ⚡\\"‘ ‘"⚡\\"‘ ‘ ', + ' ‘ ‘ ‘ ‘ '], "ThunderyHeavyRain": [ - "\033[38;5;240;1m .-. \033[0m", - "\033[38;5;240;1m ( ). \033[0m", - "\033[38;5;240;1m (___(__) \033[0m", - "\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", - "\033[38;5;21;1m ‚’‚’\033[38;5;228;5m⚡\033[38;5;21;25m’‚’ \033[0m"], + ' .-. ', + ' ( ). ', + ' (___(__) ', + ' ‚‘"⚡\\"‘‚"⚡\\"‚‘ ', + ' ‚’‚’"⚡\\"’‚’ '], "ThunderySnowShowers": [ - "\033[38;5;226m _`/\"\"\033[38;5;250m.-. \033[0m", - "\033[38;5;226m ,\\_\033[38;5;250m( ). \033[0m", - "\033[38;5;226m /\033[38;5;250m(___(__) \033[0m", - "\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", - "\033[38;5;255m * * * \033[0m"], + ' _`/\'\'".-. ', + ' ,\\_"( ). ', + ' /"(___(__) ', + ' *"⚡\\"*"⚡\\"* ', + ' * * * '], "LightRain": [ - "\033[38;5;250m .-. \033[0m", - "\033[38;5;250m ( ). \033[0m", - "\033[38;5;250m (___(__) \033[0m", - "\033[38;5;111m ‘ ‘ ‘ ‘ \033[0m", - "\033[38;5;111m ‘ ‘ ‘ ‘ \033[0m"], + ' .-. ', + ' ( ). ', + ' (___(__) ', + ' ‘ ‘ ‘ ‘ ', + ' ‘ ‘ ‘ ‘ '], "HeavyRain": [ - "\033[38;5;240;1m .-. \033[0m", - "\033[38;5;240;1m ( ). \033[0m", - "\033[38;5;240;1m (___(__) \033[0m", - "\033[38;5;21;1m ‚‘‚‘‚‘‚‘ \033[0m", - "\033[38;5;21;1m ‚’‚’‚’‚’ \033[0m"], + ' .-. ', + ' ( ). ', + ' (___(__) ', + ' ‚‘‚‘‚‘‚‘ ', + ' ‚’‚’‚’‚’ '], "LightSnow": [ - "\033[38;5;250m .-. \033[0m", - "\033[38;5;250m ( ). \033[0m", - "\033[38;5;250m (___(__) \033[0m", - "\033[38;5;255m * * * \033[0m", - "\033[38;5;255m * * * \033[0m"], + ' .-. ', + ' ( ). ', + ' (___(__) ', + ' * * * ', + ' * * * '], "HeavySnow": [ - "\033[38;5;240;1m .-. \033[0m", - "\033[38;5;240;1m ( ). \033[0m", - "\033[38;5;240;1m (___(__) \033[0m", - "\033[38;5;255;1m * * * * \033[0m", - "\033[38;5;255;1m * * * * \033[0m"], + ' .-. ', + ' ( ). ', + ' (___(__) ', + ' * * * * ', + ' * * * * '], "LightSleet": [ - "\033[38;5;250m .-. \033[0m", - "\033[38;5;250m ( ). \033[0m", - "\033[38;5;250m (___(__) \033[0m", - "\033[38;5;111m ‘ \033[38;5;255m*\033[38;5;111m ‘ \033[38;5;255m* \033[0m", - "\033[38;5;255m *\033[38;5;111m ‘ \033[38;5;255m*\033[38;5;111m ‘ \033[0m"], + ' .-. ', + ' ( ). ', + ' (___(__) ', + '"*""* ', + ' *""*"'], "Fog": [ - " ", - "\033[38;5;251m _ - _ - _ - \033[0m", - "\033[38;5;251m _ - _ - _ \033[0m", - "\033[38;5;251m _ - _ - _ - \033[0m", - " "], + ' ', + ' _ - _ - _ - ', + ' _ - _ - _ ', + ' _ - _ - _ - ', + ' '], } + WEATHER_CODES_WEGO = {key: WEATHER_SYMBOL_WEGO[value] for key, value in WWO_CODE.items()} + data = {} - weather = requests.get("https://wttr.in/?u&format=j1").json() - moon = requests.get("https://wttr.in/?format=%m").text - - def format_time(time): + """get the time formatted""" return datetime.strptime(format_24_time(time), "%H").strftime("%I %p") def format_24_time(time): + """get the time formatted""" return time.replace("00", "").zfill(2) def format_temp(temp): - return (hour["FeelsLikeF"] + "°").ljust(3) + """get the temp formatted""" + return (temp + "°").ljust(3) def format_chances(hour): + """get the chances formatted""" chances = { "chanceoffog": "Fog", "chanceoffrost": "Frost", @@ -326,60 +302,130 @@ let } conditions = [] - for event in chances.keys(): - if int(hour[event]) > 0: - conditions.append(chances[event] + " " + hour[event] + "%") + for chance, event in chances.items(): + if int(hour[chance]) > 0: + conditions.append(event + " " + hour[chance] + "%") 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"]) - extrachar = "" - if tempint > 0 and tempint < 10: - extrachar = "+" + tempint = int(feels_like_f) + extrachar = "" + if 0 < tempint < 10: + extrachar = "+" + current_weather = f"{WEATHER_CODES[weather_code]} {extrachar} {feels_like_f}°F" - data["text"] = ( - " " - + WEATHER_CODES[weather["current_condition"][0]["weatherCode"]] - + " " - + extrachar - + weather["current_condition"][0]["FeelsLikeF"] - + "°F" - ) + return current_weather - data["tooltip"] = ( - f"{weather['current_condition'][0]['weatherDesc'][0]['value']} {weather['current_condition'][0]['temp_F']}°\n" - ) - data["tooltip"] += f"Feels like: {weather['current_condition'][0]['FeelsLikeF']}°\n" - data["tooltip"] += f"Wind: {weather['current_condition'][0]['windspeedMiles']}mph\n" - data["tooltip"] += f"Humidity: {weather['current_condition'][0]['humidity']}%\n" - data["tooltip"] += f"Moon phase: {weather["weather"][0]['astronomy'][0]['moon_phase']} " + moon + "\n" - for i, day in enumerate(weather["weather"]): - data["tooltip"] += f"\n" - if i == 0: - data["tooltip"] += "Today, " - if i == 1: - data["tooltip"] += "Tomorrow, " - date = datetime.strptime(day['date'], "%Y-%m-%d").strftime("%a %b %d %Y") - data["tooltip"] += f"{date}\n" - data["tooltip"] += f" {day['maxtempF']}°F  {day['mintempF']}°F" - data[ - "tooltip" - ] += f" {day['astronomy'][0]['sunrise']}  {day['astronomy'][0]['sunset']}\n" - for hour in day["hourly"]: + def build_tooltip(current_condition, astronomy, moon_icon): + """build the tooltip text""" + weather_description = current_condition['weatherDesc'][0]['value'] + feels_like_f = current_condition["FeelsLikeF"] + temp_f = current_condition['temp_F'] + humidity = current_condition['humidity'] + wind_speed = current_condition['windspeedMiles'] + wind_dir = current_condition['winddir16Point'] + 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" + + return tooltip + + def build_forecast(weather): + """build a 3 day forecast""" + tooltip = "\n" + + for i, day in enumerate(weather): + # determine day 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"{date}\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 - 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 else: 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 { diff --git a/modules/desktop-environments/hyprland/home.nix b/modules/desktop-environments/hyprland/home.nix index 944661a..1fec878 100755 --- a/modules/desktop-environments/hyprland/home.nix +++ b/modules/desktop-environments/hyprland/home.nix @@ -177,7 +177,7 @@ in { size = "200, 50"; position = "0, -80"; - monitor = settings.displayLeft.input; + monitor = hyprlandSettings.primaryDisplay.input; dots_center = true; fade_on_empty = true; font_color = "rgb(202, 211, 245)"; diff --git a/modules/home/defaults.nix b/modules/home/defaults.nix index d90236f..65a5b84 100644 --- a/modules/home/defaults.nix +++ b/modules/home/defaults.nix @@ -9,7 +9,6 @@ clinfo cpufetch deadnix - direnv firefox gamescope gamescope-wsi diff --git a/modules/home/vscode.nix b/modules/home/vscode.nix index a126538..34439f3 100644 --- a/modules/home/vscode.nix +++ b/modules/home/vscode.nix @@ -14,27 +14,30 @@ let }; in { - programs.vscode = { - enable = true; - package = pkgs.vscodium; - mutableExtensionsDir = false; - profiles = { - default = { - enableUpdateCheck = false; - enableExtensionUpdateCheck = false; - extensions = with pkgs; [ - vscode-extensions.bbenoist.nix - vscode-extensions.brettm12345.nixfmt-vscode - vscode-extensions.cweijan.vscode-database-client2 - vscode-extensions.dendron.dendron-markdown-preview-enhanced - vscode-extensions.jnoortheen.nix-ide - vscode-extensions.ms-python.debugpy - vscode-extensions.ms-python.pylint - vscode-extensions.ms-python.python - # vscode-extensions.ms-python.vscode-pylance - vscode-extensions.redhat.vscode-xml - vscode-extensions.redhat.vscode-yaml - vscode-extensions.yy0931.vscode-sqlite3-editor + programs = { + vscode = { + enable = true; + package = pkgs.vscodium; + mutableExtensionsDir = false; + profiles = { + default = { + enableUpdateCheck = false; + enableExtensionUpdateCheck = false; + extensions = with pkgs; [ + vscode-extensions.arrterian.nix-env-selector + vscode-extensions.bbenoist.nix + vscode-extensions.brettm12345.nixfmt-vscode + vscode-extensions.cweijan.vscode-database-client2 + vscode-extensions.dendron.dendron-markdown-preview-enhanced + vscode-extensions.jnoortheen.nix-ide + vscode-extensions.mkhl.direnv + vscode-extensions.ms-python.debugpy + vscode-extensions.ms-python.pylint + vscode-extensions.ms-python.python + # 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 nix-vscode-extensions.open-vsx.jeanp413.open-remote-ssh @@ -59,81 +62,87 @@ in } ]; - userSettings = { + userSettings = { - "editor" = { - "defaultFormatter" = "brettm12345.nixfmt-vscode"; - "fontFamily" = "fira-code-nerd, FiraCode Nerd Font, Consolas, 'Courier New', monospace"; - "fontLigatures" = true; - "renderWhitespace" = "all"; - }; - - "explorer" = { - "confirmDelete" = false; - "confirmDragAndDrop" = false; - }; - - "git" = { - "confirmSync" = false; - "enableSmartCommit" = true; - }; - - "github" = { - "copilot.nextEditSuggestions.enabled" = true; - "copilot.enable" = { - "nix" = true; + "editor" = { + "defaultFormatter" = "brettm12345.nixfmt-vscode"; + "fontFamily" = "fira-code-nerd, FiraCode Nerd Font, Consolas, 'Courier New', monospace"; + "fontLigatures" = true; + "renderWhitespace" = "all"; }; - }; - "[json]" = { - "editor.defaultFormatter" = "vscode.json-language-features"; - }; + "explorer" = { + "confirmDelete" = false; + "confirmDragAndDrop" = false; + }; + + "git" = { + "confirmSync" = false; + "enableSmartCommit" = true; + }; - "nix" = { - "enableLanguageServer" = true; - "formatterPath" = "nixpkgs-fmt"; - "serverPath" = "nixd"; - "serverSettings" = { - "nixd" = { - "formatting" = { - "command" = [ "nixpkgs-fmt" ]; - }; - "options" = { - # By default, this entriy will be read from `import { }`. - # 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..options"; + "github" = { + "copilot.nextEditSuggestions.enabled" = true; + "copilot.enable" = { + "nix" = true; + }; + }; + + "[json]" = { + "editor.defaultFormatter" = "vscode.json-language-features"; + }; + + "nix" = { + "enableLanguageServer" = true; + "formatterPath" = "nixpkgs-fmt"; + "serverPath" = "nixd"; + "serverSettings" = { + "nixd" = { + "formatting" = { + "command" = [ "nixpkgs-fmt" ]; }; - "home-manager" = { - "expr" = "(builtins.getFlake \"${config.home.homeDirectory}/nix-config\").homeConfigurations..options"; + "options" = { + # By default, this entriy will be read from `import { }`. + # 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..options"; + }; + "home-manager" = { + "expr" = "(builtins.getFlake \"${config.home.homeDirectory}/nix-config\").homeConfigurations..options"; + }; + # # Tip: use ${workspaceFolder} variable to define path + # "nix-darwin" = { + # "expr" = "(builtins.getFlake \"${workspaceFolder}/path/to/flake\").darwinConfigurations..options" + # } }; - # # Tip: use ${workspaceFolder} variable to define path - # "nix-darwin" = { - # "expr" = "(builtins.getFlake \"${workspaceFolder}/path/to/flake\").darwinConfigurations..options" - # } }; }; }; - }; - "[nix]" = { - "editor" = { - "defaultFormatter" = "brettm12345.nixfmt-vscode"; - "tabSize" = 2; + "[nix]" = { + "editor" = { + "defaultFormatter" = "brettm12345.nixfmt-vscode"; + "tabSize" = 2; + }; }; - }; - "security.workspace.trust.untrustedFiles" = "open"; + "security.workspace.trust.untrustedFiles" = "open"; - "workbench" = { - "colorCustomizations" = null; - "editorAssociations" = { - "*.db" = "default"; + "workbench" = { + "colorCustomizations" = null; + "editorAssociations" = { + "*.db" = "default"; + }; }; }; }; }; }; + direnv = { + enable = true; + nix-direnv.enable = true; + enableZshIntegration = true; + }; }; } \ No newline at end of file