aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/UserScripts/WeatherWrap.sh
diff options
context:
space:
mode:
authorMartin Guzman <55927935+brockar@users.noreply.github.com>2026-01-21 16:18:43 -0300
committerGitHub <noreply@github.com>2026-01-21 16:18:43 -0300
commitc6198c1bedeffd08ec3f60f7ba3a41e6c5870885 (patch)
tree458c030873b4e70ff9eda0baed5df257434871f4 /config/hypr/UserScripts/WeatherWrap.sh
parent7dedbe3d4a4560ac15987fdf8164dbbb1f4701bf (diff)
parent88a09344e8cc7cffe69a017eb752e8c6fa17ddcb (diff)
Merge pull request #927 from JaKooLit/development
Merge Development to main branch for release
Diffstat (limited to 'config/hypr/UserScripts/WeatherWrap.sh')
-rwxr-xr-xconfig/hypr/UserScripts/WeatherWrap.sh26
1 files changed, 25 insertions, 1 deletions
diff --git a/config/hypr/UserScripts/WeatherWrap.sh b/config/hypr/UserScripts/WeatherWrap.sh
index 10c125dc..5b266930 100755
--- a/config/hypr/UserScripts/WeatherWrap.sh
+++ b/config/hypr/UserScripts/WeatherWrap.sh
@@ -6,6 +6,30 @@ SCRIPT_DIR="$(dirname "$0")"
PY_SCRIPT="$SCRIPT_DIR/Weather.py"
BASH_FALLBACK="$SCRIPT_DIR/Weather.sh"
+# Function to check network connectivity
+check_network() {
+ # Try multiple methods to check network
+ if ping -c1 -W2 8.8.8.8 >/dev/null 2>&1; then
+ return 0
+ fi
+
+ if ping -c1 -W2 1.1.1.1 >/dev/null 2>&1; then
+ return 0
+ fi
+
+ if curl -s --connect-timeout 3 "https://ipinfo.io" >/dev/null 2>&1; then
+ return 0
+ fi
+
+ return 1
+}
+
+# If no network, return offline status immediately
+if ! check_network; then
+ echo '{"text":"󰖪", "alt":"Offline", "tooltip":"No network connection"}'
+ exit 0
+fi
+
run_fallback() {
if [ -f "$BASH_FALLBACK" ]; then
# Invoke via bash to avoid requiring +x and ensure consistent shell
@@ -30,4 +54,4 @@ else
echo "python3 not found in PATH — falling back to Weather.sh" >&2
run_fallback "$@"
exit $?
-fi \ No newline at end of file
+fi
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage