aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/UserScripts/WeatherWrap.sh
diff options
context:
space:
mode:
authorbrockar <martinnguzman.mg@gmail.com>2025-10-28 18:08:12 -0300
committerbrockar <martinnguzman.mg@gmail.com>2025-10-28 18:08:12 -0300
commit2c1ce157c97ae690e1dfb8087a3bfa808ac57c18 (patch)
tree696a05536d8e88b10455c5d0a33e2071ecd99910 /config/hypr/UserScripts/WeatherWrap.sh
parentc29becbee7b0dc02d50a0e3be3945b087e77cf37 (diff)
weatherWrap.sh -> WeatherWrap.sh
Diffstat (limited to 'config/hypr/UserScripts/WeatherWrap.sh')
-rwxr-xr-xconfig/hypr/UserScripts/WeatherWrap.sh33
1 files changed, 33 insertions, 0 deletions
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
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage