nvidia😡

This commit is contained in:
2025-08-08 17:20:56 +02:00
parent 572a00828b
commit f28222614e
13 changed files with 125 additions and 68 deletions

View File

@@ -73,7 +73,7 @@
"min-length": 20
},
"custom/publicip": {
"interval": 60,
"interval": 30,
"return-type": "json",
"format": " {text}",
"tooltip-format": "{alt}",
@@ -131,8 +131,8 @@
"format-alt-click": "click-right",
//"format-icons": ["", ""],
"format-icons": [""],
"on-scroll-down": "brightnessctl -d $DISPLAY_DEVICE set 5%-",
"on-scroll-up": "brightnessctl -d $DISPLAY_DEVICE set +5%",
"on-scroll-down": "brightnessctl -d $HYPR_DISPLAY_DEVICE set 5%-",
"on-scroll-up": "brightnessctl -d $HYPR_DISPLAY_DEVICE set +5%",
"max-length": 6,
"min-length": 6
},

View File

@@ -25,6 +25,19 @@ time_log="$path/publicip.log"
[ "$1" == "force" ] && rm -f "$cache_file"
[ -f "$cache_file" ] && . "$cache_file"
# Try to check network connectivity before querying
if ! ping -c 1 -W 2 1.1.1.1 >/dev/null 2>&1; then
# No network, return cached values if available
[ -z "$CACHED_IP" ] && CACHED_IP="N/A"
[ -z "$CACHED_CODE" ] && CACHED_CODE="N/A"
jq -n --unbuffered --compact-output \
--arg ip "$CACHED_IP" \
--arg country "$CACHED_CODE" \
'{alt: $ip, text: $country}'
exit 0
fi
ip_current=$(curl -s -L -4 "$IP_QUERY_URL" | jq -r '.ip')
[ -z "$ip_current" ] && exit 1