From 7275b5f73ff6c1164cba645a5f41ac088a10e7cc Mon Sep 17 00:00:00 2001 From: prabinpanta0 Date: Mon, 27 Oct 2025 10:35:13 +0545 Subject: config(hypr): run Weather.sh at startup; lower weather cache TTL to 5 minutes --- config/hypr/UserConfigs/Startup_Apps.conf | 3 +++ 1 file changed, 3 insertions(+) (limited to 'config/hypr/UserConfigs/Startup_Apps.conf') diff --git a/config/hypr/UserConfigs/Startup_Apps.conf b/config/hypr/UserConfigs/Startup_Apps.conf index 738eb2da..976208e9 100644 --- a/config/hypr/UserConfigs/Startup_Apps.conf +++ b/config/hypr/UserConfigs/Startup_Apps.conf @@ -47,6 +47,9 @@ exec-once = $UserScripts/RainbowBorders.sh # Starting hypridle to start hyprlock exec-once = hypridle +# Weather script to populate cache on startup +exec-once = $UserScripts/Weather.sh + # Here are list of features available but disabled by default # exec-once = swww-daemon --format xrgb && swww img $HOME/Pictures/wallpapers/mecha-nostalgia.png # persistent wallpaper -- cgit v1.2.3 From 2b750637da39e4418132c70c2b53c4070a813a84 Mon Sep 17 00:00:00 2001 From: prabinpanta0 Date: Tue, 28 Oct 2025 16:41:43 +0545 Subject: feat(weatherWrap): add Python‑first entrypoint with Bash fallback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Prefer Weather.py (Open‑Meteo) for reliable data and caching - Fallback to Weather.sh if Python is missing or Weather.py exits non‑zero - Pass through all CLI args; invoke Bash explicitly for consistent execution - Helps external callers (e.g., lock hooks) refresh ~/.cache/.weather_cache robustly --- config/hypr/UserConfigs/Startup_Apps.conf | 2 +- config/hypr/UserScripts/weatherWrap.sh | 33 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100755 config/hypr/UserScripts/weatherWrap.sh (limited to 'config/hypr/UserConfigs/Startup_Apps.conf') diff --git a/config/hypr/UserConfigs/Startup_Apps.conf b/config/hypr/UserConfigs/Startup_Apps.conf index 976208e9..c40d0b0a 100644 --- a/config/hypr/UserConfigs/Startup_Apps.conf +++ b/config/hypr/UserConfigs/Startup_Apps.conf @@ -48,7 +48,7 @@ exec-once = $UserScripts/RainbowBorders.sh exec-once = hypridle # Weather script to populate cache on startup -exec-once = $UserScripts/Weather.sh +exec-once = $UserScripts/weatherWrap.sh # Here are list of features available but disabled by default diff --git a/config/hypr/UserScripts/weatherWrap.sh b/config/hypr/UserScripts/weatherWrap.sh new file mode 100755 index 00000000..4c9a16dc --- /dev/null +++ b/config/hypr/UserScripts/weatherWrap.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## +# Weather entrypoint: prefer Python (Open‑Meteo), fallback to legacy Bash (wttr.in) + +SCRIPT_DIR="$(dirname "$0")" +PY_SCRIPT="$SCRIPT_DIR/Weather.py" +BASH_FALLBACK="$SCRIPT_DIR/Weather.sh" + +run_fallback() { + if [ -f "$BASH_FALLBACK" ]; then + # Invoke via bash to avoid requiring +x and ensure consistent shell + bash "$BASH_FALLBACK" "$@" + return $? + else + echo "Weather fallback not found: $BASH_FALLBACK" >&2 + return 127 + fi +} + +if command -v python3 >/dev/null 2>&1; then + python3 "$PY_SCRIPT" "$@" + exit_code=$? + if [ "$exit_code" -eq 0 ]; then + exit 0 + fi + echo "Weather.py failed with code $exit_code — falling back to Weather.sh" >&2 + run_fallback "$@" + exit $? +else + echo "python3 not found in PATH — falling back to Weather.sh" >&2 + run_fallback "$@" + exit $? +fi \ No newline at end of file -- cgit v1.2.3 From 2c1ce157c97ae690e1dfb8087a3bfa808ac57c18 Mon Sep 17 00:00:00 2001 From: brockar Date: Tue, 28 Oct 2025 18:08:12 -0300 Subject: weatherWrap.sh -> WeatherWrap.sh --- config/hypr/UserConfigs/Startup_Apps.conf | 2 +- config/hypr/UserScripts/WeatherWrap.sh | 33 +++++++++++++++++++++++++++++++ config/hypr/UserScripts/weatherWrap.sh | 33 ------------------------------- config/hypr/scripts/LockScreen.sh | 7 ++++--- 4 files changed, 38 insertions(+), 37 deletions(-) create mode 100755 config/hypr/UserScripts/WeatherWrap.sh delete mode 100755 config/hypr/UserScripts/weatherWrap.sh (limited to 'config/hypr/UserConfigs/Startup_Apps.conf') diff --git a/config/hypr/UserConfigs/Startup_Apps.conf b/config/hypr/UserConfigs/Startup_Apps.conf index c40d0b0a..2f5c7ae7 100644 --- a/config/hypr/UserConfigs/Startup_Apps.conf +++ b/config/hypr/UserConfigs/Startup_Apps.conf @@ -48,7 +48,7 @@ exec-once = $UserScripts/RainbowBorders.sh exec-once = hypridle # Weather script to populate cache on startup -exec-once = $UserScripts/weatherWrap.sh +exec-once = $UserScripts/WeatherWrap.sh # Here are list of features available but disabled by default diff --git a/config/hypr/UserScripts/WeatherWrap.sh b/config/hypr/UserScripts/WeatherWrap.sh new file mode 100755 index 00000000..4c9a16dc --- /dev/null +++ b/config/hypr/UserScripts/WeatherWrap.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## +# Weather entrypoint: prefer Python (Open‑Meteo), fallback to legacy Bash (wttr.in) + +SCRIPT_DIR="$(dirname "$0")" +PY_SCRIPT="$SCRIPT_DIR/Weather.py" +BASH_FALLBACK="$SCRIPT_DIR/Weather.sh" + +run_fallback() { + if [ -f "$BASH_FALLBACK" ]; then + # Invoke via bash to avoid requiring +x and ensure consistent shell + bash "$BASH_FALLBACK" "$@" + return $? + else + echo "Weather fallback not found: $BASH_FALLBACK" >&2 + return 127 + fi +} + +if command -v python3 >/dev/null 2>&1; then + python3 "$PY_SCRIPT" "$@" + exit_code=$? + if [ "$exit_code" -eq 0 ]; then + exit 0 + fi + echo "Weather.py failed with code $exit_code — falling back to Weather.sh" >&2 + run_fallback "$@" + exit $? +else + echo "python3 not found in PATH — falling back to Weather.sh" >&2 + run_fallback "$@" + exit $? +fi \ No newline at end of file diff --git a/config/hypr/UserScripts/weatherWrap.sh b/config/hypr/UserScripts/weatherWrap.sh deleted file mode 100755 index 4c9a16dc..00000000 --- a/config/hypr/UserScripts/weatherWrap.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## -# Weather entrypoint: prefer Python (Open‑Meteo), fallback to legacy Bash (wttr.in) - -SCRIPT_DIR="$(dirname "$0")" -PY_SCRIPT="$SCRIPT_DIR/Weather.py" -BASH_FALLBACK="$SCRIPT_DIR/Weather.sh" - -run_fallback() { - if [ -f "$BASH_FALLBACK" ]; then - # Invoke via bash to avoid requiring +x and ensure consistent shell - bash "$BASH_FALLBACK" "$@" - return $? - else - echo "Weather fallback not found: $BASH_FALLBACK" >&2 - return 127 - fi -} - -if command -v python3 >/dev/null 2>&1; then - python3 "$PY_SCRIPT" "$@" - exit_code=$? - if [ "$exit_code" -eq 0 ]; then - exit 0 - fi - echo "Weather.py failed with code $exit_code — falling back to Weather.sh" >&2 - run_fallback "$@" - exit $? -else - echo "python3 not found in PATH — falling back to Weather.sh" >&2 - run_fallback "$@" - exit $? -fi \ No newline at end of file diff --git a/config/hypr/scripts/LockScreen.sh b/config/hypr/scripts/LockScreen.sh index 17239406..e61490cd 100755 --- a/config/hypr/scripts/LockScreen.sh +++ b/config/hypr/scripts/LockScreen.sh @@ -2,9 +2,10 @@ # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## # For Hyprlock -#pidof hyprlock || hyprlock -q +#pidof hyprlock || hyprlock -q # Ensure weather cache is up-to-date before locking (Waybar/lockscreen readers) -bash "$HOME/.secret/Hyprland-Dots/config/hypr/UserScripts/weatherWrap.sh" >/dev/null 2>&1 +bash "$HOME/.config/hypr/UserScripts/WeatherWrap.sh" >/dev/null 2>&1 + +loginctl lock-session -loginctl lock-session \ No newline at end of file -- cgit v1.2.3